From 206ae17424bc8a5939c7850b78de0bd99548975e Mon Sep 17 00:00:00 2001 From: Philippe Brochard Date: Sun, 9 Dec 2012 21:40:11 +0100 Subject: [PATCH] Move or resize blank window with the mouse --- clfswm-session.desktop | 2 +- clfswm.desktop | 2 +- contrib/blank-window-mode.lisp | 45 ++++++++++++++++++++++++++++++++++++------ 3 files changed, 41 insertions(+), 8 deletions(-) diff --git a/clfswm-session.desktop b/clfswm-session.desktop index cd86f22..34b1d93 100644 --- a/clfswm-session.desktop +++ b/clfswm-session.desktop @@ -1,5 +1,5 @@ [Desktop Entry] -Version=1209.2 +Version=1212 Encoding=UTF-8 Name=clfswm Name[en_US]=clfswm diff --git a/clfswm.desktop b/clfswm.desktop index 4f383c9..61237f2 100644 --- a/clfswm.desktop +++ b/clfswm.desktop @@ -1,5 +1,5 @@ [Desktop Entry] -Version=1209.2 +Version=1212 Encoding=UTF-8 Type=Application Name=clfswm diff --git a/contrib/blank-window-mode.lisp b/contrib/blank-window-mode.lisp index 4f6d77a..3797ebc 100644 --- a/contrib/blank-window-mode.lisp +++ b/contrib/blank-window-mode.lisp @@ -105,8 +105,9 @@ -(defun create-new-blank-window () +(defun create-new-blank-window (&rest args) "Create a new blank window" + (declare (ignore args)) (with-x-pointer (push (xlib:create-window :parent *root* :x (- x 50) :y y @@ -188,12 +189,41 @@ (with-current-blank-window (window) (setf (xlib:drawable-border-width window) (if *blank-window-show-current* 1 0)))) -(defun place-current-blank-window (window root-x root-y) - "Place the current blank window with the mouse" +(defun find-blank-window-under-mouse () + "Return the blank window under the mouse pointer if any" + (with-x-pointer + (dolist (win *blank-window-list*) + (when (in-window win x y) + (with-current-blank-window (window) + (setf (xlib:drawable-border-width window) 0)) + (setf *blank-window-list* (remove win *blank-window-list* :test #'xlib:window-equal)) + (push win *blank-window-list*) + (when *blank-window-show-current* + (with-current-blank-window (window) + (setf (xlib:drawable-border-width window) 1))) + (return-from find-blank-window-under-mouse win))))) + +(defun move-blank-window (window root-x root-y) + "Move blank window with the mouse" + (declare (ignore window)) + (let ((window (find-blank-window-under-mouse))) + (when window + (move-window window root-x root-y)))) + +(defun resize-blank-window (window root-x root-y) + "Resize blank window with the mouse" (declare (ignore window)) + (let ((window (find-blank-window-under-mouse))) + (when window + (resize-window window root-x root-y)))) + +(defun hide-unhide-current-blank-window () + "Hide or unhide the current blank window" (with-current-blank-window (window) - (setf (xlib:drawable-x window) root-x - (xlib:drawable-y window) root-y))) + (if (window-hidden-p window) + (unhide-window window) + (hide-window window)))) + (defun blank-black-window () "Open a black window. ie light of the screen" @@ -241,11 +271,14 @@ (define-blank-window-key ("m") 'blank-window-inc-width -1) (define-blank-window-key ("l") 'blank-window-inc-height -1) (define-blank-window-key ("Delete") 'remove-current-blank-window) + (define-blank-window-key ("t") 'hide-unhide-current-blank-window) (define-blank-window-key ("Control_R") 'banish-pointer) (define-blank-window-key ("b") 'banish-pointer) (define-blank-window-key ("x") 'blank-black-window) - (define-blank-window-mouse (1) 'place-current-blank-window)) + (define-blank-window-mouse (1) 'move-blank-window) + (define-blank-window-mouse (2) 'create-new-blank-window) + (define-blank-window-mouse (3) 'resize-blank-window)) -- 2.11.4.GIT