Handle enter/leave events with detail=Inferior correctly
There is a client window C. Around this window, awesome adds a frame window F. When the pointer is inside of C and then moves inside of F, we get a LeaveNotify with detail=Inferior, but from our point of view, the pointer is still inside of C, because F is contained in C. Similarly, if the pointer is in F and moves to C, we get an EnterNotify with detail=Inferior that we should ignore. However, for an EnterNotify the pointer can now be inside of a titlebar, so this case has to be handled now. The above explains the enter/leave behavior for clients. Let's now think about titlebars: When the pointer moves from C to F, it cannot be in any titlebar any more, so we must generate a leave event on that titlebar. Similar when the pointer moves from F to C, but in this case we also have to figure out which titlebar now contains the pointer. This patch makes the code handle these events with detail=Inferior correctly. Closes https://github.com/awesomeWM/awesome/pull/461. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
a638310e89
commit
de8fd4ffd4
12
event.c
12
event.c
|
@ -491,7 +491,10 @@ event_handle_leavenotify(xcb_leave_notify_event_t *ev)
|
|||
if(ev->mode != XCB_NOTIFY_MODE_NORMAL)
|
||||
return;
|
||||
|
||||
if((c = client_getbyframewin(ev->event)))
|
||||
/* Ignore leave with detail inferior (we were left for a window contained in
|
||||
* our window, so technically the pointer is still inside of this window).
|
||||
*/
|
||||
if(ev->detail != XCB_NOTIFY_DETAIL_INFERIOR && (c = client_getbyframewin(ev->event)))
|
||||
{
|
||||
luaA_object_push(globalconf.L, c);
|
||||
luaA_object_emit_signal(globalconf.L, -1, "mouse::leave", 0);
|
||||
|
@ -527,7 +530,12 @@ event_handle_enternotify(xcb_enter_notify_event_t *ev)
|
|||
if((c = client_getbyframewin(ev->event)))
|
||||
{
|
||||
luaA_object_push(globalconf.L, c);
|
||||
luaA_object_emit_signal(globalconf.L, -1, "mouse::enter", 0);
|
||||
/* Ignore enter with detail inferior: The pointer was previously inside
|
||||
* of a child window, so technically this isn't a 'real' enter.
|
||||
*/
|
||||
if (ev->detail != XCB_NOTIFY_DETAIL_INFERIOR)
|
||||
luaA_object_emit_signal(globalconf.L, -1, "mouse::enter", 0);
|
||||
|
||||
drawable_t *d = client_get_drawable(c, ev->event_x, ev->event_y);
|
||||
if (d)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue