[openbox] Losing focus

Jim Rees rees at umich.edu
Tue Nov 20 08:00:50 EST 2012


I did fix the focus bug where a window obscured by a menu doesn't get focus
when the menu goes away. Guess I forgot about it. Here is the patch. I don't
have a lot of confidence in it. It fixes the problem for me. It may or may
not fix the problem you're seeing, and it may have unwanted side effects.

I think the first hunk of the patch is for something else but it shouldn't
hurt anything.

>From da85a64c0c5a1be0371d3647afdba0bf9fd00072 Mon Sep 17 00:00:00 2001
From: Jim Rees <rees at umich.edu>
Date: Tue, 20 Nov 2012 07:51:36 -0500
Subject: [PATCH] Fix undermouse focus when window obscured by menu

I've had this annoying problem for some time.  I've got the following
settings:

    <focusNew>no</focusNew>
    <followMouse>yes</followMouse>
    <underMouse>yes</underMouse>

Now I do this:

1. Click on desktop just above a window to bring up a menu. All windows lose
focus, as the menu now has focus.

2. Move mouse down to a menu item that covers part of the window, and select
it.

3. Menu goes away, mouse is now over the window.

4. The window should have focus, but it does not.

The following patch fixes it, but I'm not sure what unintended side effects
it might have.

Signed-off-by: Jim Rees <rees at umich.edu>
---
 openbox/event.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/openbox/event.c b/openbox/event.c
index ccbb56e..0b2fbdd 100644
--- a/openbox/event.c
+++ b/openbox/event.c
@@ -475,6 +475,11 @@ static void event_process(const XEvent *ec, gpointer data)
             client = WINDOW_AS_CLIENT(obwin);
             /* events on clients can be events on prompt windows too */
             prompt = client->prompt;
+            /* pretend all desktop events were intended for root window */
+            if (client->type == OB_CLIENT_TYPE_DESKTOP) {
+                printf("got one!\n");
+                window = obt_root(ob_screen);
+            }
             break;
         case OB_WINDOW_CLASS_MENUFRAME:
             menu = WINDOW_AS_MENUFRAME(obwin);
@@ -2169,6 +2174,8 @@ void event_end_ignore_all_enters(gulong start)
        movement will be ignored until we create some further network traffic.
        Instead ignore up to NextRequest-1, then when we increment the serial,
        we will be *past* the range of ignored serials */
+    if (config_focus_under_mouse)
+        return;
     event_ignore_enter_range(start, NextRequest(obt_display)-1);
 }
 
-- 
1.7.9.5


More information about the openbox mailing list