Send WM_TAKE_FOCUS to clients when setting focus (fixes java swing problems)

This commit is contained in:
Michael Stapelberg
2011-03-17 22:27:59 +01:00
parent c1a9e1593d
commit 36664c6289
3 changed files with 19 additions and 0 deletions

16
src/x.c
View File

@ -616,6 +616,22 @@ void x_push_changes(Con *con) {
} else {
DLOG("Updating focus (focused: %p / %s)\n", focused, focused->name);
xcb_set_input_focus(conn, XCB_INPUT_FOCUS_POINTER_ROOT, to_focus, XCB_CURRENT_TIME);
/* TODO: check if that client acccepts WM_TAKE_FOCUS at all */
xcb_client_message_event_t ev;
memset(&ev, 0, sizeof(xcb_client_message_event_t));
ev.response_type = XCB_CLIENT_MESSAGE;
ev.window = to_focus;
ev.type = atoms[WM_PROTOCOLS];
ev.format = 32;
ev.data.data32[0] = atoms[WM_TAKE_FOCUS];
ev.data.data32[1] = XCB_CURRENT_TIME;
DLOG("Sending WM_TAKE_FOCUS to the client\n");
xcb_send_event(conn, false, to_focus, XCB_EVENT_MASK_NO_EVENT, (char*)&ev);
ewmh_update_active_window(to_focus);
focused_id = to_focus;
}