Re: Learning to program sawfish



On Thu, Sep 4, 2008 at 8:04 PM, Rodrigo Amestica <ramestica nrao edu> wrote:
[quote]

> My thinking was like this: if the mouse is at the edge of the window and the
> next motion will move the window away from it and it also happens that there
> is an other window right below there then my moved window will lose focus. I
> do not want that to happen.

I've a working solution after modifying stop-focus.jl, but it needs a
patch to slide-window.jl and there are still corner cases, for example
when unmapping/destroying windows. Anyway, moving windows with
keyboard should be addressed.

Before giving focus to a window now there's a check if the mouse
pointer has changed position, it's a raw check, not like the motion
estimation used in the other parts of the script, but good enough as a
proof of concept.

The patch to slide-window.jl is necessary because I need an updated
mouse pointer position (after a window has gained focus, the pointer
could have been moved inside it without triggering focus events), so
now it's done before a window slide and when leaving a workspace (the
same probably should be done for viewports).

That or update the pointer position with a timer and an time-out small
enough...  ^__^;


-- 
Andrea
Index: lisp/sawfish/wm/commands/slide-window.jl
===================================================================
--- lisp/sawfish/wm/commands/slide-window.jl	(revision 4276)
+++ lisp/sawfish/wm/commands/slide-window.jl	(working copy)
@@ -41,6 +41,7 @@
     "Number of pixels to move window in `slide-' commands.")
 
   (define (slide-window w right down)
+    (call-window-hook 'before-slide-hook w)
     (unless (window-get w 'fixed-position)
       (let ((coords (window-position w)))
 	(move-window-to w (+ (car coords) right) (+ (cdr coords) down)))))

Attachment: stop-focus.jl
Description: Binary data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]