From ed60ce75c75e0c5c5b83a07c90bf47a825ba35b6 Mon Sep 17 00:00:00 2001 From: Philippe Brochard Date: Sat, 7 May 2011 21:36:23 +0200 Subject: [PATCH] src/clfswm-nw-hooks.lisp (make-permanent-nw-hook-frame): New function. Prevent to add or delete a new window hook for this frame. --- ChangeLog | 4 ++++ TODO | 2 +- src/bindings-second-mode.lisp | 26 ++++++++++++++++---------- src/clfswm-nw-hooks.lisp | 21 +++++++++++++++------ src/clfswm-util.lisp | 7 ------- 5 files changed, 36 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index 726b6d3..5941f3b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2011-05-07 Philippe Brochard + * src/clfswm-nw-hooks.lisp (make-permanent-nw-hook-frame): New + function. Prevent to add or delete a new window hook for this + frame. + * src/clfswm-layout.lisp (update-layout-managed-children-position): New function. diff --git a/TODO b/TODO index 8af8326..187ee6b 100644 --- a/TODO +++ b/TODO @@ -7,7 +7,7 @@ URGENT PROBLEMS =============== Should handle these soon. -Stop all pending actions +-> Nothing here yet. FOR THE NEXT RELEASE diff --git a/src/bindings-second-mode.lisp b/src/bindings-second-mode.lisp index 2fb219d..ab590a2 100644 --- a/src/bindings-second-mode.lisp +++ b/src/bindings-second-mode.lisp @@ -68,6 +68,13 @@ (set-layout-once #'tile-layout) (leave-second-mode)) + +(defun stop-all-pending-actions () + "Stop all pending actions" + (clear-all-nw-hooks) + (leave-second-mode)) + + ;;; default shell programs (defmacro define-shell (key name docstring cmd) "Define a second key to start a shell command" @@ -93,13 +100,12 @@ (define-second-key ("l") 'open-frame-fill-menu) (define-second-key ("r") 'open-frame-resize-menu) (define-second-key ("x") 'update-layout-managed-children-position) - (define-second-key (#\g :control) 'stop-all-pending-actions) + (define-second-key ("g" :control) 'stop-all-pending-actions) (define-second-key ("i") 'identify-key) (define-second-key ("colon") 'eval-from-query-string) (define-second-key ("exclam") 'run-program-from-query-string) (define-second-key ("Return") 'leave-second-mode) (define-second-key ("Escape") 'leave-second-mode) - (define-second-key ("g" :control) 'leave-second-mode) (define-second-key ("t") 'tile-current-frame) (define-second-key ("Home" :mod-1 :control :shift) 'exit-clfswm) (define-second-key ("Right" :mod-1) 'select-next-brother) @@ -131,10 +137,10 @@ (define-second-key ("Home" :mod-1) 'switch-to-root-frame) (define-second-key ("Home" :mod-1 :shift) 'switch-and-select-root-frame) (define-second-key ("Menu") 'toggle-show-root-frame) - (define-second-key (#\b :mod-1) 'banish-pointer) - (define-second-key (#\o) 'set-open-in-new-frame-in-parent-frame-nw-hook) - (define-second-key (#\o :control) 'set-open-in-new-frame-in-root-frame-nw-hook) - (define-second-key (#\a) 'add-default-frame) + (define-second-key ("b" :mod-1) 'banish-pointer) + (define-second-key ("o") 'set-open-in-new-frame-in-parent-frame-nw-hook) + (define-second-key ("o" :control) 'set-open-in-new-frame-in-root-frame-nw-hook) + (define-second-key ("a") 'add-default-frame) ;; Escape (define-second-key ("Escape" :control) 'ask-close/kill-current-window) ;; Selection @@ -145,12 +151,12 @@ (define-second-key ("v" :control :shift) 'paste-selection-no-clear) (define-second-key ("Delete" :control) 'remove-current-child) (define-second-key ("Delete") 'delete-current-child) - (define-shell (#\c) b-start-xterm "start an xterm" "cd $HOME && exec xterm") - (define-shell (#\e) b-start-emacs "start emacs" "cd $HOME && exec emacs") - (define-shell (#\e :control) b-start-emacsremote + (define-shell ("c") b-start-xterm "start an xterm" "cd $HOME && exec xterm") + (define-shell ("e") b-start-emacs "start emacs" "cd $HOME && exec emacs") + (define-shell ("e" :control) b-start-emacsremote "start an emacs for another user" "exec xterm -e emacsremote") - (define-shell (#\h) b-start-xclock "start an xclock" "exec xclock -d") + (define-shell ("h") b-start-xclock "start an xclock" "exec xclock -d") (define-second-key ("F10" :mod-1) 'fast-layout-switch) (define-second-key ("F10" :shift :control) 'toggle-show-root-frame) (define-second-key ("F10") 'expose-windows-current-child-mode) diff --git a/src/clfswm-nw-hooks.lisp b/src/clfswm-nw-hooks.lisp index 188db76..327dcd6 100644 --- a/src/clfswm-nw-hooks.lisp +++ b/src/clfswm-nw-hooks.lisp @@ -38,6 +38,7 @@ (defparameter *nw-hook-current-key* (char-code #\a)) +(defparameter *permanent-nw-hook-frames* nil) (defun set-nw-hook (hook) @@ -45,8 +46,9 @@ (let ((frame (if (xlib:window-p *current-child*) (find-parent-frame *current-child*) *current-child*))) - (setf (frame-nw-hook frame) hook) - (leave-second-mode))) + (unless (child-member frame *permanent-nw-hook-frames*) + (setf (frame-nw-hook frame) hook) + (leave-second-mode)))) (defun register-nw-hook (hook) (add-menu-key 'frame-nw-hook-menu (code-char *nw-hook-current-key*) hook) @@ -60,13 +62,15 @@ (defun leave-if-not-frame (child) "Leave the child if it's not a frame" - (when (xlib:window-p child) + (unless (frame-p child) (leave-frame) (select-previous-level))) (defun clear-nw-hook (frame) "Clear the frame new window hook" - (setf (frame-nw-hook frame) nil)) + (unless (child-member frame *permanent-nw-hook-frames*) + (setf (frame-nw-hook frame) nil))) + (defun clear-all-nw-hooks () "Clear all new window hooks for all frames" @@ -74,6 +78,11 @@ (clear-nw-hook frame))) +(defun make-permanent-nw-hook-frame (frame) + "Prevent to add or delete a new window hook for this frame" + (when (frame-p frame) + (push frame *permanent-nw-hook-frames*))) + ;;; Default frame new window hook (defun default-frame-nw-hook (frame window) @@ -238,7 +247,7 @@ ;;; Absorb window. -;;; The frame absorb the new window if it match the absorb-nw-test +;;; The frame absorb the new window if it match the nw-absorb-test ;;; frame data slot. (defun absorb-window-nw-hook (frame window) (let ((absorb-nw-test (frame-data-slot frame :nw-absorb-test))) @@ -256,7 +265,7 @@ nil) (defun set-absorb-window-nw-hook () - "Open the window in this frame if it match absorb-nw-test" + "Open the window in this frame if it match nw-absorb-test" (set-nw-hook #'absorb-window-nw-hook)) (register-nw-hook 'set-absorb-window-nw-hook) diff --git a/src/clfswm-util.lisp b/src/clfswm-util.lisp index 0e42fc3..65fab73 100644 --- a/src/clfswm-util.lisp +++ b/src/clfswm-util.lisp @@ -71,13 +71,6 @@ (char= (char rep 0) #\Y)))) -;;(error "stop-all-pending-actions: TODO") -(defun stop-all-pending-actions () - "Stop all pending actions" - ()) - ;;(error "TODO")) - - (defun rename-current-child () "Rename the current child" -- 2.11.4.GIT