Handle FocusIn events generated by clients and update decoration accordingly (Thanks mseed)
This commit is contained in:
15
src/x.c
15
src/x.c
@ -5,7 +5,7 @@
|
||||
#include "all.h"
|
||||
|
||||
/* Stores the X11 window ID of the currently focused window */
|
||||
static xcb_window_t focused_id = XCB_NONE;
|
||||
xcb_window_t focused_id = XCB_NONE;
|
||||
|
||||
/*
|
||||
* Describes the X11 state we may modify (map state, position, window stack).
|
||||
@ -693,7 +693,18 @@ void x_push_changes(Con *con) {
|
||||
focused_id = XCB_NONE;
|
||||
} else {
|
||||
DLOG("Updating focus (focused: %p / %s)\n", focused, focused->name);
|
||||
/* We remove XCB_EVENT_MASK_FOCUS_CHANGE from the event mask to get
|
||||
* no focus change events for our own focus changes. We only want
|
||||
* these generated by the clients. */
|
||||
if (focused->window != NULL) {
|
||||
values[0] = CHILD_EVENT_MASK & ~(XCB_EVENT_MASK_FOCUS_CHANGE);
|
||||
xcb_change_window_attributes(conn, focused->window->id, XCB_CW_EVENT_MASK, values);
|
||||
}
|
||||
xcb_set_input_focus(conn, XCB_INPUT_FOCUS_POINTER_ROOT, to_focus, XCB_CURRENT_TIME);
|
||||
if (focused->window != NULL) {
|
||||
values[0] = CHILD_EVENT_MASK;
|
||||
xcb_change_window_attributes(conn, focused->window->id, XCB_CW_EVENT_MASK, values);
|
||||
}
|
||||
|
||||
if (focused->window != NULL &&
|
||||
focused->window->needs_take_focus) {
|
||||
@ -724,6 +735,8 @@ void x_push_changes(Con *con) {
|
||||
CIRCLEQ_FOREACH(state, &old_state_head, old_state) {
|
||||
DLOG("old stack: 0x%08x\n", state->id);
|
||||
}
|
||||
|
||||
xcb_flush(conn);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user