[sawfish: 5/6] Ignore grab-induced enter-notify events.



commit c10c8c032606b30e704be61837b2a69293f054cf
Author: Timo Korvola <tkorvola iki fi>
Date:   Sun Sep 30 16:59:22 2007 +0300

    Ignore grab-induced enter-notify events.
    
    Turns out the focus modes were already ignoring grab-induced leave-notify
    events.  Ignoring enter-notify events is a bit of a double-edged sword.
    
    The problem that this solves is when you press Alt F2 in KDE, the Run
    Command popup appears and gets focused because you have configured it so,
    you start typing, the completion list pops up and takes focus, then you
    type a bit further and the completion list disappears.  Focus used to
    revert to the window the pointer was in, which usually was not the Run
    Command popup.  transient-unmap-window tried hard to get it right, then
    the grab-induced enter-notify brought focus to the wrong window anyway.
    
    The problem that this causes is when you open the KDE main menu by
    clicking the K icon in the panel, move the mouse into some application
    window and click to dismiss the open menu, focus reverts to the panel.
    You have to move the pointer out of the application window and back in
    to get it focused.
    
    I am talking about the enter-exit and enter-only focus modes of course.
    The click focus mode ignores enter-notify events anyway.

 lisp/sawfish/wm/focus.jl |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/lisp/sawfish/wm/focus.jl b/lisp/sawfish/wm/focus.jl
index 4ee1732..16399a7 100644
--- a/lisp/sawfish/wm/focus.jl
+++ b/lisp/sawfish/wm/focus.jl
@@ -138,7 +138,9 @@ EVENT-NAME)', where EVENT-NAME may be one of the following symbols:
     (lambda (w action . args)
       (case action
 	((pointer-in)
-	 (when (window-really-wants-input-p w)
+	 (when (and (window-really-wants-input-p w)
+                    ;; ignore grab/ungrab enter events
+                    (eq (car args) 'normal))
 	   (set-input-focus w)))
 	((pointer-out)
 	 ;; ignore grab/ungrab leave events
@@ -152,10 +154,12 @@ EVENT-NAME)', where EVENT-NAME may be one of the following symbols:
 	   (warp-cursor-to-window w))))))
 
   (define-focus-mode 'enter-only
-    (lambda (w action)
+    (lambda (w action . args)
       (case action
 	((pointer-in)
-	 (when (window-really-wants-input-p w)
+	 (when (and (window-really-wants-input-p w)
+                    ;; ignore grab/ungrab enter events
+                    (eq (car args) 'normal))
 	   (set-input-focus w)))
 	((warp-if-necessary)
 	 (let ((current (query-pointer-window)))



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