Re: Focus-under-mouse doesn't work (mostly)

Jim Rees <[email protected]> Thu, 29 Sep 2016 21:01:45 -0400
Newsgroups gmane.comp.window-managers.openbox
Message-ID <[email protected]>
Please try the attached patch. I sent this to the list four years ago but
nothing was done with it. I have not pushed it very hard because I don't
entirely understand this code, and I'm afraid it might break something
else. But I've been using it for years with no problem.

_______________________________________________
openbox mailing list
[email protected]
http://icculus.org/mailman/listinfo/openbox
0001-Fix-undermouse-focus-when-window-obscured-by-menu.patch (text/x-diff, 1.5 KB)
From 4a4a20ced4d2c378b6c0aa9e56546118ab77db04 Mon Sep 17 00:00:00 2001
From: Jim Rees <[email protected]>
Date: Tue, 20 Nov 2012 07:51:36 -0500
Subject: [PATCH 1/5] 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 <[email protected]>
---
 openbox/event.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/openbox/event.c b/openbox/event.c
index 1b3a0e4..29e719c 100644
--- a/openbox/event.c
+++ b/openbox/event.c
@@ -2169,6 +2169,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);
 }
 
-- 
2.2.2