Leave titlebars early

When a client is unmanaged, we know emit mouse::leave on its titlebar before the
client object is invalidated, so that Lua can still work with it. Before, this
event was emitted only when we got a LeaveNotify from the X11 server.

Fixes: #620
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2016-01-10 19:27:55 +01:00
parent 720cd879f3
commit 430f4fab15
3 changed files with 10 additions and 2 deletions

View File

@ -426,7 +426,7 @@ event_handle_destroynotify(xcb_destroy_notify_event_t *ev)
/** Record that the given drawable contains the pointer. /** Record that the given drawable contains the pointer.
*/ */
static void void
event_drawable_under_mouse(lua_State *L, int ud) event_drawable_under_mouse(lua_State *L, int ud)
{ {
void *d; void *d;

View File

@ -48,7 +48,8 @@ awesome_refresh(void)
return xcb_flush(globalconf.connection); return xcb_flush(globalconf.connection);
} }
void event_handle(xcb_generic_event_t *event); void event_handle(xcb_generic_event_t *);
void event_drawable_under_mouse(lua_State *, int);
#endif #endif
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -1335,6 +1335,13 @@ client_unmanage(client_t *c, bool window_valid)
if (c->titlebar[bar].drawable == NULL) if (c->titlebar[bar].drawable == NULL)
continue; continue;
if (globalconf.drawable_under_mouse == c->titlebar[bar].drawable) {
/* Leave drawable before we invalidate the client */
lua_pushnil(L);
event_drawable_under_mouse(L, -1);
lua_pop(L, 1);
}
/* Forget about the drawable */ /* Forget about the drawable */
luaA_object_push(L, c); luaA_object_push(L, c);
luaA_object_unref_item(L, -1, c->titlebar[bar].drawable); luaA_object_unref_item(L, -1, c->titlebar[bar].drawable);