Fandom

Sawfish

Focus grabs aren't focus changes

773pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Browse all patches

Author Edit

Harald van Dijk

Synopsis Edit

When a window grabs focus, sawfish doesn't treat it as a "focus out" of the old window, but does treat it as a "focus in" of the new one. This causes problems with Global Menu Bar for GNOME: when opening a menu, the menu grabs keyboard input. In sawfish, as a result, the GNOME top panel (or wherever you have placed the menu) becomes focused, and the menu bar is updated to reflect that no application window has focus. In short, the menu bar is completely unusable. The patch made focus_in ignore the same events that focus_out already ignores, but was updated after comments on the mailing list to only affect the _NET_ACTIVE_WINDOW property so that all other focus-related functions (including updating the window frame) get called, and to update mode_to_sym to handle NotifyWhileGrabbed events.

Note that even with this patch, it is necessary to force the GNOME panel to "never focus". The panel is focusable in sawfish and fluxbox, which causes the same problem even without opening menus, but that is not a bug in the window manager, and easily worked around using for example Window Rules from the Sawfish Configurator.

Patch testing Edit

  1. Copy/paste the patch listed below into some file, eg. TEST.diff.
  2. If you don't have sawfish sources yet, have one, as described get it from GIT repo.
  3. Go into the directory where sawfish sources reside, eg. cd sawfish
  4. Test if the patch applies cleanly with this command:
    patch -p1 --ignore-whitespace --dry-run < TEST.diff
    in case of problems try also: -p0 or -p2
  5. If it applies cleanly, then remove the --dry-run from above command and run it again, otherwise ask on the mailing list.
  6. Compile sawfish: ./autogen.sh && make
  7. Install it for testing, but it depends on your linux distribution.
    1. It is always better to install sawfish as your distribution package, but it is different for each distribution.
    2. So you may try make install, which will install sawifish in /usr/local/share/sawfish/ (if you have write access). But then make sure that you run the correct version and delete it from that directory afterwards, to avoid any conflicts.
  8. Se also

PS: edit this template if you feel that those instructions can be improved.

Patch Edit

diff --git a/lisp/sawfish/wm/state/wm-spec.jl b/lisp/sawfish/wm/state/wm-spec.jl
index 674cd9e..7402969 100644
--- a/lisp/sawfish/wm/state/wm-spec.jl
+++ b/lisp/sawfish/wm/state/wm-spec.jl
@@ -264,9 +264,9 @@
 
   (define last-focus nil)
 
-  (define (update-focus-state)
+  (define (update-focus-state w mode)
     (let ((focus (input-focus)))
-      (unless (eq last-focus focus)
+      (unless (or (eq mode 'grab) (eq mode 'ungrab) (eq last-focus focus))
 	(setq last-focus focus)
 	(set-x-property 'root '_NET_ACTIVE_WINDOW
 			(vector (if focus (window-id focus) 0)) 'WINDOW 32))))
diff --git a/src/events.c b/src/events.c
index 9b6a1db..a84f8d7 100644
--- a/src/events.c
+++ b/src/events.c
@@ -124,6 +124,7 @@ DEFSYM(dimensions, "dimensions");
 DEFSYM(normal, "normal");
 DEFSYM(grab, "grab");
 DEFSYM(ungrab, "ungrab");
+DEFSYM(whilegrabbed, "whilegrabbed");
 
 repv Fsynthetic_configure_mutex (repv);
 
@@ -917,7 +918,9 @@ mode_to_sym (int mode)
 {
     return (mode == NotifyNormal ? Qnormal
 	    : mode == NotifyGrab ? Qgrab
-	    : Qungrab);
+	    : mode == NotifyUngrab ? Qungrab
+	    : mode == NotifyWhileGrabbed ? Qwhilegrabbed
+	    : Qnil);
 }
 
 static void

Community's reasons for inclusion or rejection Edit

Patch submitters, please vote also! Yes, obviously your vote will be positive, but it's the place to give your explanation why this patch is good for all Sawfish users, and why it is correct - good reasons for inclusion.

When voting anonymously please write your name, so that it can be associated with your posts on the mailing list. If you are logged in you can sign yourself by typing four tilda characters: ~~~~.

Yes vote: yes.A newer version of this patch was commited to 1.8.0 Flashrider [Christopher Bratusek] 20:32, January 30, 2011 (UTC)

  • Please vote with: , No vote: no., Try vote: let's try in experimental., Wtf vote: pondering. or Suspend wait for next release.

Also on Fandom

Random Wiki