From 1013010bff2b7c1d7de31882a049b4fb88bf9665 Mon Sep 17 00:00:00 2001 From: Philippe Brochard Date: Tue, 20 Jul 2010 23:33:35 +0200 Subject: [PATCH] src/clfswm-internal.lisp (remove-child-in-frame): Do not destroy the frame window and the frame gc. Close a very annoying bug when cuting/pasting a frame or moving a child over frames with the mouse. --- ChangeLog | 5 +++++ load.lisp | 2 +- src/bindings.lisp | 2 +- src/clfswm-internal.lisp | 32 +++++++++++++++++++++++--------- src/clfswm-util.lisp | 16 +++++----------- src/clfswm.lisp | 4 ++-- 6 files changed, 37 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index c431fe7..5b15923 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2010-07-20 Philippe Brochard + * src/clfswm-internal.lisp (remove-child-in-frame): Do not destroy + the frame window and the frame gc. Close a very annoying bug when + cuting/pasting a frame or moving a child over frames with the + mouse. + * src/clfswm-util.lisp (mouse-click-to-focus-generic): Redisplay all children in *current-root* after moving/resizing a frame. diff --git a/load.lisp b/load.lisp index 6808e45..a862684 100644 --- a/load.lisp +++ b/load.lisp @@ -56,7 +56,7 @@ #-BUILD (ignore-errors - (main-unprotected :read-conf-file-p t)) + (main :read-conf-file-p t)) ;;(produce-all-docs) diff --git a/src/bindings.lisp b/src/bindings.lisp index ca433a6..04895a5 100644 --- a/src/bindings.lisp +++ b/src/bindings.lisp @@ -124,7 +124,7 @@ (define-main-mouse (3) 'mouse-click-to-focus-and-resize) (define-main-mouse (1 :mod-1) 'mouse-click-to-focus-and-move-window) (define-main-mouse (3 :mod-1) 'mouse-click-to-focus-and-resize-window) - (define-main-mouse (1 :control :mod-1) 'mouse-move-window-over-frame) + (define-main-mouse (1 :control :mod-1) 'mouse-move-child-over-frame) (define-main-mouse (4) 'mouse-select-next-level) (define-main-mouse (5) 'mouse-select-previous-level) (define-main-mouse (4 :mod-1) 'mouse-enter-frame) diff --git a/src/clfswm-internal.lisp b/src/clfswm-internal.lisp index 72ac63f..277867b 100644 --- a/src/clfswm-internal.lisp +++ b/src/clfswm-internal.lisp @@ -815,19 +815,12 @@ For window: set current child to window or its parent according to window-parent (defun remove-child-in-frame (child frame) "Remove the child in frame" (when (frame-p frame) - (setf (frame-child frame) (remove child (frame-child frame) :test #'equal)) - (with-all-frames (child fr) - (unless (find-frame-window (frame-window fr)) - (awhen (frame-gc fr) (xlib:free-gcontext it) (setf it nil)) - (awhen (frame-window fr) (xlib:destroy-window it) (setf it nil)))))) + (setf (frame-child frame) (remove child (frame-child frame) :test #'equal)))) (defun remove-child-in-frames (child root) "Remove child in the frame root and in all its children" (with-all-frames (root frame) - (remove-child-in-frame child frame)) - (when (xlib:window-p child) - (netwm-remove-in-client-list child))) - + (remove-child-in-frame child frame))) (defun remove-child-in-all-frames (child) @@ -839,6 +832,27 @@ For window: set current child to window or its parent according to window-parent (remove-child-in-frames child *root-frame*)) +(defun delete-child-in-frames (child root) + "Delete child in the frame root and in all its children +Warning:frame window and gc are freeed." + (with-all-frames (root frame) + (remove-child-in-frame child frame) + (unless (find-frame-window (frame-window frame)) + (awhen (frame-gc frame) (xlib:free-gcontext it) (setf it nil)) + (awhen (frame-window frame) (xlib:destroy-window it) (setf it nil)))) + (when (xlib:window-p child) + (netwm-remove-in-client-list child))) + + +(defun delete-child-in-all-frames (child) + "Delete child in all frames from *root-frame*" + (when (equal child *current-root*) + (setf *current-root* (find-parent-frame child))) + (when (equal child *current-child*) + (setf *current-child* *current-root*)) + (delete-child-in-frames child *root-frame*)) + + diff --git a/src/clfswm-util.lisp b/src/clfswm-util.lisp index d3528b5..c830e38 100644 --- a/src/clfswm-util.lisp +++ b/src/clfswm-util.lisp @@ -1002,14 +1002,13 @@ For window: set current child to window or its parent according to window-parent -;;; Moving window with the mouse function -(defun mouse-move-window-over-frame (window root-x root-y) - "Move the window under the mouse cursor to another frame" +;;; Moving child with the mouse button +(defun mouse-move-child-over-frame (window root-x root-y) + "Move the child under the mouse cursor to another frame" (declare (ignore window)) (let ((child (find-child-under-mouse root-x root-y))) - (dbg child (frame-child child)) (unless (equal child *current-root*) - (hide-child child) + (hide-all child) (remove-child-in-frame child (find-parent-frame child)) (wait-mouse-button-release 50 51) (multiple-value-bind (x y) @@ -1018,12 +1017,7 @@ For window: set current child to window or its parent according to window-parent (when (xlib:window-p dest) (setf dest (find-parent-frame dest))) (unless (equal child dest) - ;;(move-child-to child dest)))))) - (dbg dest (frame-child dest)) - (pushnew child (frame-child dest)) - (dbg dest (frame-child dest)) - (dbg child (frame-child child)) - ;;(focus-all-children child dest) + (move-child-to child dest) (show-all-children *current-root*)))))) (stop-button-event)) diff --git a/src/clfswm.lisp b/src/clfswm.lisp index 147e3c2..60e310d 100644 --- a/src/clfswm.lisp +++ b/src/clfswm.lisp @@ -111,7 +111,7 @@ (unless (and (not send-event-p) (not (xlib:window-equal window event-window))) (when (find-child window *root-frame*) - (remove-child-in-all-frames window) + (delete-child-in-all-frames window) (show-all-children)))) @@ -120,7 +120,7 @@ (unless (or send-event-p (xlib:window-equal window event-window)) (when (find-child window *root-frame*) - (remove-child-in-all-frames window) + (delete-child-in-all-frames window) (show-all-children)))) -- 2.11.4.GIT