ewmh: use client signals to update NET_ACTIVE_WINDOW
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
f4876b5275
commit
61430f860d
39
ewmh.c
39
ewmh.c
|
@ -111,6 +111,25 @@ ewmh_update_desktop_geometry(int phys_screen)
|
|||
_NET_DESKTOP_GEOMETRY, CARDINAL, 32, countof(sizes), sizes);
|
||||
}
|
||||
|
||||
static int
|
||||
ewmh_update_net_active_window(lua_State *L)
|
||||
{
|
||||
client_t *c = luaA_checkudata(L, 1, &client_class);
|
||||
xcb_window_t win;
|
||||
|
||||
if(globalconf.screen_focus->client_focus
|
||||
&& globalconf.screen_focus->client_focus->phys_screen == c->phys_screen)
|
||||
win = globalconf.screen_focus->client_focus->window;
|
||||
else
|
||||
win = XCB_NONE;
|
||||
|
||||
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
|
||||
xutil_screen_get(globalconf.connection, c->phys_screen)->root,
|
||||
_NET_ACTIVE_WINDOW, WINDOW, 32, 1, &win);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
ewmh_init(int phys_screen)
|
||||
{
|
||||
|
@ -196,6 +215,10 @@ ewmh_init(int phys_screen)
|
|||
|
||||
lua_pushcfunction(globalconf.L, ewmh_signal_on_client_new);
|
||||
luaA_class_add_signal(globalconf.L, &client_class, "new", -1);
|
||||
lua_pushcfunction(globalconf.L, ewmh_update_net_active_window);
|
||||
luaA_class_add_signal(globalconf.L, &client_class, "focus", -1);
|
||||
lua_pushcfunction(globalconf.L, ewmh_update_net_active_window);
|
||||
luaA_class_add_signal(globalconf.L, &client_class, "unfocus", -1);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -273,22 +296,6 @@ ewmh_update_net_desktop_names(int phys_screen)
|
|||
buffer_wipe(&buf);
|
||||
}
|
||||
|
||||
void
|
||||
ewmh_update_net_active_window(int phys_screen)
|
||||
{
|
||||
xcb_window_t win;
|
||||
|
||||
if(globalconf.screen_focus->client_focus
|
||||
&& globalconf.screen_focus->client_focus->phys_screen == phys_screen)
|
||||
win = globalconf.screen_focus->client_focus->window;
|
||||
else
|
||||
win = XCB_NONE;
|
||||
|
||||
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
|
||||
xutil_screen_get(globalconf.connection, phys_screen)->root,
|
||||
_NET_ACTIVE_WINDOW, WINDOW, 32, 1, &win);
|
||||
}
|
||||
|
||||
static void
|
||||
ewmh_process_state_atom(client_t *c, xcb_atom_t state, int set)
|
||||
{
|
||||
|
|
1
ewmh.h
1
ewmh.h
|
@ -30,7 +30,6 @@ void ewmh_update_net_client_list(int);
|
|||
void ewmh_update_net_numbers_of_desktop(int);
|
||||
void ewmh_update_net_current_desktop(int);
|
||||
void ewmh_update_net_desktop_names(int);
|
||||
void ewmh_update_net_active_window(int);
|
||||
int ewmh_process_client_message(xcb_client_message_event_t *);
|
||||
void ewmh_update_net_client_list_stacking(int);
|
||||
void ewmh_client_check_hints(client_t *);
|
||||
|
|
|
@ -240,7 +240,6 @@ void
|
|||
client_unfocus_update(client_t *c)
|
||||
{
|
||||
globalconf.screens.tab[c->phys_screen].client_focus = NULL;
|
||||
ewmh_update_net_active_window(c->phys_screen);
|
||||
|
||||
luaA_object_push(globalconf.L, c);
|
||||
luaA_class_emit_signal(globalconf.L, &client_class, "unfocus", 1);
|
||||
|
@ -380,8 +379,6 @@ client_focus_update(client_t *c)
|
|||
/* according to EWMH, we have to remove the urgent state from a client */
|
||||
client_set_urgent(globalconf.L, -1, false);
|
||||
|
||||
ewmh_update_net_active_window(c->phys_screen);
|
||||
|
||||
luaA_class_emit_signal(globalconf.L, &client_class, "focus", 1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue