From e73e331f35b9da4bbb99c80c5c1eedd2ae99422b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Fri, 15 Jan 2016 12:18:24 +0100 Subject: [PATCH] use XCB_CURRENT_TIME for NET::TakeFocusProtocol The only clients that really seem to rely on it are Java and they're apparently "broken", resp. extremely picky on the tiemstamp and probably happily refuse focus if it's *not* equal to the current server time (ie. anything else happens at this moment) and overmore feel oblieged to act as WM by juggling around VDs at all. BUG: 347153 FIXED-IN: 5.6 REVIEW: 126753 --- client.cpp | 7 +++---- client.h | 3 ++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/client.cpp b/client.cpp index c0bc621f40..20d5f84eb4 100644 --- a/client.cpp +++ b/client.cpp @@ -1047,7 +1047,7 @@ void Client::updateHiddenPreview() } } -void Client::sendClientMessage(xcb_window_t w, xcb_atom_t a, xcb_atom_t protocol, uint32_t data1, uint32_t data2, uint32_t data3) +void Client::sendClientMessage(xcb_window_t w, xcb_atom_t a, xcb_atom_t protocol, uint32_t data1, uint32_t data2, uint32_t data3, xcb_timestamp_t timestamp) { xcb_client_message_event_t ev; memset(&ev, 0, sizeof(ev)); @@ -1056,7 +1056,7 @@ void Client::sendClientMessage(xcb_window_t w, xcb_atom_t a, xcb_atom_t protocol ev.type = a; ev.format = 32; ev.data.data32[0] = protocol; - ev.data.data32[1] = xTime(); + ev.data.data32[1] = timestamp; ev.data.data32[2] = data1; ev.data.data32[3] = data2; ev.data.data32[4] = data3; @@ -1363,8 +1363,7 @@ void Client::takeFocus() else demandAttention(false); // window cannot take input, at least withdraw urgency if (info->supportsProtocol(NET::TakeFocusProtocol)) { - updateXTime(); - sendClientMessage(window(), atoms->wm_protocols, atoms->wm_take_focus); + sendClientMessage(window(), atoms->wm_protocols, atoms->wm_take_focus, 0, 0, 0, XCB_CURRENT_TIME); } workspace()->setShouldGetFocus(this); diff --git a/client.h b/client.h index c5a1b42ae3..697b6418bf 100644 --- a/client.h +++ b/client.h @@ -486,7 +486,8 @@ private: void killProcess(bool ask, xcb_timestamp_t timestamp = XCB_TIME_CURRENT_TIME); void updateUrgency(); static void sendClientMessage(xcb_window_t w, xcb_atom_t a, xcb_atom_t protocol, - uint32_t data1 = 0, uint32_t data2 = 0, uint32_t data3 = 0); + uint32_t data1 = 0, uint32_t data2 = 0, uint32_t data3 = 0, + xcb_timestamp_t timestamp = xTime()); void embedClient(xcb_window_t w, xcb_visualid_t visualid, xcb_colormap_t colormap, uint8_t depth); void detectNoBorder();