ewmh: correctly set _NET_ACTIVE_WINDOW
This commit is contained in:
12
src/ewmh.c
12
src/ewmh.c
@ -30,3 +30,15 @@ void ewmh_update_current_desktop() {
|
||||
atoms[_NET_CURRENT_DESKTOP], CARDINAL, 32, 1,
|
||||
¤t_desktop);
|
||||
}
|
||||
|
||||
/*
|
||||
* Updates _NET_ACTIVE_WINDOW with the currently focused window.
|
||||
*
|
||||
* EWMH: The window ID of the currently active window or None if no window has
|
||||
* the focus.
|
||||
*
|
||||
*/
|
||||
void ewmh_update_active_window(xcb_window_t window) {
|
||||
xcb_change_property(global_conn, XCB_PROP_MODE_REPLACE, root,
|
||||
atoms[_NET_ACTIVE_WINDOW], WINDOW, 32, 1, &window);
|
||||
}
|
||||
|
@ -249,6 +249,7 @@ int main(int argc, char *argv[], char *env[]) {
|
||||
REQUEST_ATOM(WM_STATE);
|
||||
REQUEST_ATOM(WM_CLIENT_LEADER);
|
||||
REQUEST_ATOM(_NET_CURRENT_DESKTOP);
|
||||
REQUEST_ATOM(_NET_ACTIVE_WINDOW);
|
||||
|
||||
/* TODO: this has to be more beautiful somewhen */
|
||||
int major, minor, error;
|
||||
@ -412,6 +413,7 @@ int main(int argc, char *argv[], char *env[]) {
|
||||
GET_ATOM(WM_STATE);
|
||||
GET_ATOM(WM_CLIENT_LEADER);
|
||||
GET_ATOM(_NET_CURRENT_DESKTOP);
|
||||
GET_ATOM(_NET_ACTIVE_WINDOW);
|
||||
|
||||
xcb_property_set_handler(&prophs, atoms[_NET_WM_WINDOW_TYPE], UINT_MAX, handle_window_type, NULL);
|
||||
/* TODO: In order to comply with EWMH, we have to watch _NET_WM_STRUT_PARTIAL */
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "client.h"
|
||||
#include "workspace.h"
|
||||
#include "log.h"
|
||||
#include "ewmh.h"
|
||||
|
||||
/*
|
||||
* Go through all existing windows (if the window manager is restarted) and manage them
|
||||
@ -450,8 +451,10 @@ map:
|
||||
if (map_frame)
|
||||
render_container(conn, new->container);
|
||||
}
|
||||
if (new->container == CUR_CELL || client_is_floating(new))
|
||||
if (new->container == CUR_CELL || client_is_floating(new)) {
|
||||
xcb_set_input_focus(conn, XCB_INPUT_FOCUS_POINTER_ROOT, new->child, XCB_CURRENT_TIME);
|
||||
ewmh_update_active_window(new->child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -247,6 +247,7 @@ void set_focus(xcb_connection_t *conn, Client *client, bool set_anyways) {
|
||||
CLIENT_LOG(client);
|
||||
/* Set focus to the entered window, and flush xcb buffer immediately */
|
||||
xcb_set_input_focus(conn, XCB_INPUT_FOCUS_POINTER_ROOT, client->child, XCB_CURRENT_TIME);
|
||||
ewmh_update_active_window(client->child);
|
||||
//xcb_warp_pointer(conn, XCB_NONE, client->child, 0, 0, 0, 0, 10, 10);
|
||||
|
||||
if (client->container != NULL) {
|
||||
|
Reference in New Issue
Block a user