Problem with sawfish and GNOME global menus

Hi all,

I've recently started using
which makes it possible to use a global menu bar for all GTK+/GNOME applications. This works great with metacity and openbox, but not so much with fluxbox and sawfish: with those, opening a menu causes the GNOME panel to get focused, which causes the menus to change.

Because sawfish isn't the only WM that has issues, I had initially reported the problem to the globalmenu folks. The first problem was that fluxbox and sawfish focus the GNOME panel when clicking on it. metacity and openbox make dock type windows unfocusable. I avoided this problem in sawfish locally by changing focus-click-through to never-focus in dock-window-properties. I don't think this is appropriate, so I'm not asking for this to be changed in sawfish.

However, even with that change, it still didn't work: the menus still changed to the desktop's menus. And this does look questionable on sawfish's part: it happens because sawfish takes the grabbing of keyboard input as a normal focus event. In src/events.c, focus_out includes an early return:
    if (ev->xfocus.detail == NotifyPointer
|| ev->xfocus.mode == NotifyGrab || ev->xfocus.mode == NotifyUngrab)
but focus_in's early return is simpler:
    if (ev->xfocus.detail == NotifyPointer)
When I change focus_in to also return on NotifyGrab/Ungrab, things work great.

Could you tell me if that change is correct, or if the problem should be avoided some other way? See attached patch (to 1.7.1, but the relevant code is unchanged in git).

Again, the first hunk of attached patch is not something I am asking to be applied yet -- it depends on how the globalmenu maintainers respond. The second hunk is.

I cannot add this to the wiki right now, but will do so later.

diff --git a/lisp/sawfish/wm/windows.jl b/lisp/sawfish/wm/windows.jl
index 28d7120..1a64a54 100644
--- a/lisp/sawfish/wm/windows.jl
+++ b/lisp/sawfish/wm/windows.jl
@@ -107,7 +107,7 @@
     :group misc)
   (defvar dock-window-properties
-    '(window-list-skip cycle-skip fixed-position focus-click-through
+    '(window-list-skip cycle-skip fixed-position never-focus
 		       avoid no-history never-iconify never-maximize sticky
 		       sticky-viewport placed)
     "List of properties set (to true) on windows when they are marked as docks.")
diff --git a/src/events.c b/src/events.c
index 9b6a1db..f9a5c82 100644
--- a/src/events.c
+++ b/src/events.c
@@ -1029,7 +1029,8 @@ static void
 focus_in (XEvent *ev)
     Lisp_Window *w = find_window_by_id (ev->xfocus.window);
-    if (ev->xfocus.detail == NotifyPointer)
+    if (ev->xfocus.detail == NotifyPointer
+        || ev->xfocus.mode == NotifyGrab || ev->xfocus.mode == NotifyUngrab)
     if (w != 0 && w->visible)

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