From 615e0210435865ddcc144cc1ffff55ca21d9cf7f Mon Sep 17 00:00:00 2001 From: Philippe Brochard Date: Sat, 25 Sep 2010 15:08:49 +0200 Subject: [PATCH] src/clfswm-expose-mode.lisp: Move and rename present*-windows in a separate clfswm-expose-mode.lisp file. --- ChangeLog | 3 +++ clfswm.asd | 4 ++- src/bindings-second-mode.lisp | 4 ++- src/bindings.lisp | 4 ++- src/clfswm-corner.lisp | 38 --------------------------- src/clfswm-expose-mode.lisp | 60 +++++++++++++++++++++++++++++++++++++++++++ src/clfswm-keys.lisp | 6 ++++- src/clfswm-util.lisp | 2 +- src/package.lisp | 2 ++ 9 files changed, 80 insertions(+), 43 deletions(-) create mode 100644 src/clfswm-expose-mode.lisp diff --git a/ChangeLog b/ChangeLog index d03a347..7714dfb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2010-09-25 Philippe Brochard + * src/clfswm-expose-mode.lisp: Move and rename present*-windows in + a separate clfswm-expose-mode.lisp file. + * src/clfswm-util.lisp (speed-mouse-right, speed-mouse-down): Use screen size instead of hardcoded test coordinates. diff --git a/clfswm.asd b/clfswm.asd index d4cf148..cda725d 100644 --- a/clfswm.asd +++ b/clfswm.asd @@ -46,8 +46,10 @@ (:file "clfswm-second-mode" :depends-on ("package" "clfswm" "clfswm-internal" "clfswm-generic-mode" "clfswm-placement")) + (:file "clfswm-expose-mode" + :depends-on ("package" "config" "clfswm-internal" "xlib-util" "tools")) (:file "clfswm-corner" - :depends-on ("package" "config" "clfswm-internal")) + :depends-on ("package" "config" "clfswm-internal" "clfswm-expose-mode" "xlib-util")) (:file "clfswm-info" :depends-on ("package" "version" "xlib-util" "config" "clfswm-keys" "clfswm" "clfswm-internal" "clfswm-autodoc" "clfswm-corner" diff --git a/src/bindings-second-mode.lisp b/src/bindings-second-mode.lisp index f398276..5cf0cfb 100644 --- a/src/bindings-second-mode.lisp +++ b/src/bindings-second-mode.lisp @@ -147,7 +147,9 @@ (define-second-key ("F10" :mod-1) 'fast-layout-switch) (define-second-key ("F10" :shift) 'show-all-frames-info-key) (define-second-key ("F10" :shift :mod-1) 'show-all-frames-info) - (define-second-key ("F10" :control) 'toggle-show-root-frame) + (define-second-key ("F10" :shift :control) 'toggle-show-root-frame) + (define-second-key ("F10") 'expose-windows) + (define-second-key ("F10" :control) 'expose-all-windows) ;; Bind or jump functions (define-second-key ("1" :mod-1) 'bind-or-jump 1) (define-second-key ("2" :mod-1) 'bind-or-jump 2) diff --git a/src/bindings.lisp b/src/bindings.lisp index 7646484..c025370 100644 --- a/src/bindings.lisp +++ b/src/bindings.lisp @@ -61,7 +61,9 @@ (define-main-key ("F10" :mod-1) 'fast-layout-switch) (define-main-key ("F10" :shift) 'show-all-frames-info-key) (define-main-key ("F10" :shift :mod-1) 'show-all-frames-info) - (define-main-key ("F10" :control) 'toggle-show-root-frame) + (define-main-key ("F10" :shift :control) 'toggle-show-root-frame) + (define-main-key ("F10") 'expose-windows) + (define-main-key ("F10" :control) 'expose-all-windows) (define-main-key (#\b :mod-1) 'banish-pointer) ;; Escape (define-main-key ("Escape" :control) 'ask-close/kill-current-window) diff --git a/src/clfswm-corner.lisp b/src/clfswm-corner.lisp index a927dae..1dae591 100644 --- a/src/clfswm-corner.lisp +++ b/src/clfswm-corner.lisp @@ -73,44 +73,6 @@ Corner is one of :bottom-right :bottom-left :top-right :top-left" ;;;***************************************;;; ;;; CONFIG - Corner actions definitions: ;;; ;;;***************************************;;; - -(defmacro present-windows-generic ((first-restore-frame) &body body) - `(progn - (with-all-frames (,first-restore-frame frame) - (setf (frame-data-slot frame :old-layout) (frame-layout frame) - (frame-layout frame) #'tile-space-layout)) - (show-all-children *current-root*) - (wait-no-key-or-button-press) - (wait-a-key-or-button-press ) - (wait-no-key-or-button-press) - (multiple-value-bind (x y) (xlib:query-pointer *root*) - (let* ((child (find-child-under-mouse x y)) - (parent (find-parent-frame child *root-frame*))) - (when (and child parent) - ,@body - (focus-all-children child parent)))) - (with-all-frames (,first-restore-frame frame) - (setf (frame-layout frame) (frame-data-slot frame :old-layout) - (frame-data-slot frame :old-layout) nil)) - (show-all-children *current-root*))) - -(defun present-windows () - "Present all windows in the current frame (An expose like)" - (stop-button-event) - (present-windows-generic (*current-root*)) - t) - -(defun present-all-windows () - "Present all windows in all frames (An expose like)" - (stop-button-event) - (switch-to-root-frame :show-later t) - (present-windows-generic (*root-frame*) - (hide-all-children *root-frame*) - (setf *current-root* parent)) - t) - - - (defun find-window-in-query-tree (target-win) (dolist (win (xlib:query-tree *root*)) (when (child-equal-p win target-win) diff --git a/src/clfswm-expose-mode.lisp b/src/clfswm-expose-mode.lisp new file mode 100644 index 0000000..3939967 --- /dev/null +++ b/src/clfswm-expose-mode.lisp @@ -0,0 +1,60 @@ +;;; -------------------------------------------------------------------------- +;;; CLFSWM - FullScreen Window Manager +;;; +;;; -------------------------------------------------------------------------- +;;; Documentation: Expose functions - An expose like. +;;; -------------------------------------------------------------------------- +;;; +;;; (C) 2010 Philippe Brochard +;;; +;;; This program is free software; you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +;;; +;;; -------------------------------------------------------------------------- + +(in-package :clfswm) + +(defun expose-windows-generic (first-restore-frame func) + (with-all-frames (first-restore-frame frame) + (setf (frame-data-slot frame :old-layout) (frame-layout frame) + (frame-layout frame) #'tile-space-layout)) + (show-all-children *current-root*) + (wait-no-key-or-button-press) + (wait-a-key-or-button-press ) + (wait-no-key-or-button-press) + (multiple-value-bind (x y) (xlib:query-pointer *root*) + (let* ((child (find-child-under-mouse x y)) + (parent (find-parent-frame child *root-frame*))) + (when (and child parent) + (pfuncall func parent) + (focus-all-children child parent)))) + (with-all-frames (first-restore-frame frame) + (setf (frame-layout frame) (frame-data-slot frame :old-layout) + (frame-data-slot frame :old-layout) nil)) + (show-all-children *current-root*) + t) + +(defun expose-windows () + "Present all windows in the current frame (An expose like)" + (stop-button-event) + (expose-windows-generic *current-root* nil)) + +(defun expose-all-windows () + "Present all windows in all frames (An expose like)" + (stop-button-event) + (switch-to-root-frame :show-later t) + (expose-windows-generic *root-frame* + (lambda (parent) + (hide-all-children *root-frame*) + (setf *current-root* parent)))) diff --git a/src/clfswm-keys.lisp b/src/clfswm-keys.lisp index 52fce43..a83400e 100644 --- a/src/clfswm-keys.lisp +++ b/src/clfswm-keys.lisp @@ -65,7 +65,8 @@ (define-init-hash-table-key *circulate-keys* "Circulate mode keys") (define-init-hash-table-key *circulate-keys-release* "Circulate mode release keys") - +(define-init-hash-table-key *expose-keys* "Expose windows mode keys") +(define-init-hash-table-key *expose-mouse* "Mouse buttons actions in expose windows mode") (defun unalias-modifiers (list) (dolist (mod *modifier-alias*) @@ -122,9 +123,12 @@ (define-define-key "circulate" *circulate-keys*) (define-define-key "circulate-release" *circulate-keys-release*) +(define-define-key "expose" *expose-keys*) + (define-define-mouse "main-mouse" *main-mouse*) (define-define-mouse "second-mouse" *second-mouse*) (define-define-mouse "info-mouse" *info-mouse*) +(define-define-mouse "expose" *expose-mouse*) diff --git a/src/clfswm-util.lisp b/src/clfswm-util.lisp index bd2ac94..72b6299 100644 --- a/src/clfswm-util.lisp +++ b/src/clfswm-util.lisp @@ -1377,7 +1377,7 @@ For window: set current child to window or its parent according to window-parent (leave-second-mode)) -;;; Speed mouse movement +;;; Speed mouse movement. (let (minx miny maxx maxy history lx ly) (labels ((middle (x1 x2) (round (/ (+ x1 x2) 2))) diff --git a/src/package.lisp b/src/package.lisp index 99c253b..446a645 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -161,6 +161,8 @@ It is particulary useful with CLISP/MIT-CLX.") (defparameter *query-keys* nil) (defparameter *circulate-keys* nil) (defparameter *circulate-keys-release* nil) +(defparameter *expose-keys* nil) +(defparameter *expose-mouse* nil) (defparameter *other-window-manager* nil) -- 2.11.4.GIT