Is there a way to release the pointer via function?
- From: Christopher Roy Bratusek <nano tuxfamily org>
- To: General discussion about sawfish wm <sawfish-list gnome org>
- Subject: Is there a way to release the pointer via function?
- Date: Mon, 28 Feb 2011 19:10:10 +0100
Hmm... I thought about whether it could be usefull to have HotSpots also, when
while-moving a window. It took some time but today I found about some window-
manipulation could be done then, eg: move window to top-edge => maximize
I first tried some quick "HotMove" hack (attached) with the following bit of
code in sawfishrc:
( defvar-setq top-edge-move-function
( lambda () ( maximize-window ( input-focus ) ) )
( defvar-setq top-bottom-edge-move-action 'none/hot-move )
Now try it (without opaque as animator): you'll see, window looks maximized,
but once you now release the pointer it gets shrunk again (but still has
maximized flag set) [You'll have to try to acutally understand I guess].
So what I would need is
(let ((window (current-event-window)))
(function-to-release-pointer)
(all other stuff))
Is there some function to release the pointer (atleast I haven't found one)?
Chris
diff --git a/lisp/sawfish/wm/edge/actions.jl b/lisp/sawfish/wm/edge/actions.jl
index 2649054..48e7a0e 100644
--- a/lisp/sawfish/wm/edge/actions.jl
+++ b/lisp/sawfish/wm/edge/actions.jl
@@ -39,20 +39,20 @@
:group edge-actions
:type (choice none/hot-spot viewport-drag flip-workspace flip-viewport))
- (defcustom left-right-edge-move-action 'none
+ (defcustom left-right-edge-move-action 'none/hot-move
"Action for the left and right screen-edge while moving a window."
:group edge-actions
- :type (choice none viewport-drag flip-workspace flip-viewport))
+ :type (choice none/hot-move viewport-drag flip-workspace flip-viewport))
(defcustom top-bottom-edge-action 'none/hot-spot
"Action for the top and bottom screen-edge."
:group edge-actions
:type (choice none/hot-spot viewport-drag flip-workspace flip-viewport))
- (defcustom top-bottom-edge-move-action 'none
+ (defcustom top-bottom-edge-move-action 'none/hot-move
"Action for the top and bottom screen-edge while moving a window."
:group edge-actions
- :type (choice none viewport-drag flip-workspace flip-viewport))
+ :type (choice none/hot-move viewport-drag flip-workspace flip-viewport))
(define (edge-action-call func edge)
(case func
@@ -64,6 +64,8 @@
(edge-flip-invoke edge 'viewport))
((none/hot-spot)
(hot-spot-invoke edge))
+ ((none/hot-move)
+ (hot-move-invoke edge))
(t nil)))
;; Entry point without dragging
diff --git a/lisp/sawfish/wm/edge/hot-spots.jl b/lisp/sawfish/wm/edge/hot-spots.jl
index ba9a192..85edb85 100644
--- a/lisp/sawfish/wm/edge/hot-spots.jl
+++ b/lisp/sawfish/wm/edge/hot-spots.jl
@@ -20,7 +20,8 @@
(define-structure sawfish.wm.edge.hot-spots
- (export hot-spot-invoke)
+ (export hot-spot-invoke
+ hot-move-invoke)
(open rep
rep.system
@@ -89,4 +90,56 @@
(when func
;; non-nil, but not a function?
(error "In hot-spot, you configuration of `%s' is wrong; it should be a function." spot))
+ )))
+
+ (defvar left-edge-move-function nil
+ "The function launched when hitting the left-edge.")
+
+ (defvar top-left-corner-move-function nil
+ "The function launched when hitting the top-left-corner.")
+
+ (defvar top-edge-move-function nil
+ "The function launched when hitting the top-edge.")
+
+ (defvar top-right-corner-move-function nil
+ "The function launched when hitting the top-right-corner.")
+
+ (defvar right-edge-move-function nil
+ "The function launched when hitting the right-edge.")
+
+ (defvar bottom-right-corner-move-function nil
+ "The function launched when hitting the bottom-right-corner.")
+
+ (defvar bottom-edge-move-function nil
+ "The function launched when hitting the bottom-edge.")
+
+ (defvar bottom-left-corner-move-function nil
+ "The function launched when hitting the bottom-left-corner.")
+
+ (define (hot-move-invoke spot)
+ (let ((func (case spot
+ ((top-left)
+ top-left-corner-move-function)
+ ((top-right)
+ top-right-corner-move-function)
+ ((bottom-right)
+ bottom-right-corner-move-function)
+ ((bottom-left)
+ bottom-left-corner-move-function)
+ ((left)
+ left-edge-move-function)
+ ((top)
+ top-edge-move-function)
+ ((right)
+ right-edge-move-function)
+ ((bottom)
+ bottom-edge-move-function))))
+ (if (functionp func)
+ (make-timer (lambda ()
+ (funcall func))
+ (quotient hot-spot-delay 1000)
+ (mod hot-spot-delay 1000))
+ (when func
+ ;; non-nil, but not a function?
+ (error "In hot-spot, you configuration of `%s' is wrong; it should be a function." spot))
))))
[
Date Prev][
Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]