diff --git a/common/xembed.c b/common/xembed.c index 3f4c8673..7e854fee 100644 --- a/common/xembed.c +++ b/common/xembed.c @@ -37,7 +37,7 @@ void luaA_systray_invalidate(void); */ void xembed_message_send(xcb_connection_t *connection, xcb_window_t towin, - long message, long d1, long d2, long d3) + xcb_timestamp_t timestamp, uint32_t message, uint32_t d1, uint32_t d2, uint32_t d3) { xcb_client_message_event_t ev; @@ -45,7 +45,7 @@ xembed_message_send(xcb_connection_t *connection, xcb_window_t towin, ev.response_type = XCB_CLIENT_MESSAGE; ev.window = towin; ev.format = 32; - ev.data.data32[0] = XCB_CURRENT_TIME; + ev.data.data32[0] = timestamp; ev.data.data32[1] = message; ev.data.data32[2] = d1; ev.data.data32[3] = d2; @@ -116,10 +116,12 @@ xembed_getbywin(xembed_window_array_t *list, xcb_window_t win) /** Update embedded window properties. * \param connection The X connection. * \param emwin The embedded window. + * \param timestamp The timestamp. + * \param reply The property reply to handle. */ void xembed_property_update(xcb_connection_t *connection, xembed_window_t *emwin, - xcb_get_property_reply_t *reply) + xcb_timestamp_t timestamp, xcb_get_property_reply_t *reply) { int flags_changed; xembed_info_t info = { 0, 0 }; @@ -136,13 +138,13 @@ xembed_property_update(xcb_connection_t *connection, xembed_window_t *emwin, if(info.flags & XEMBED_MAPPED) { xcb_map_window(connection, emwin->win); - xembed_window_activate(connection, emwin->win); + xembed_window_activate(connection, emwin->win, timestamp); } else { xcb_unmap_window(connection, emwin->win); - xembed_window_deactivate(connection, emwin->win); - xembed_focus_out(connection, emwin->win); + xembed_window_deactivate(connection, emwin->win, timestamp); + xembed_focus_out(connection, emwin->win, timestamp); } luaA_systray_invalidate(); } diff --git a/common/xembed.h b/common/xembed.h index 4a9a1622..484f5eb0 100644 --- a/common/xembed.h +++ b/common/xembed.h @@ -87,9 +87,9 @@ DO_ARRAY(xembed_window_t, xembed_window, DO_NOTHING) #define XEMBED_ACCELERATOR_OVERLOADED (1 << 0) -void xembed_message_send(xcb_connection_t *, xcb_window_t, long, long, long, long); +void xembed_message_send(xcb_connection_t *, xcb_window_t, xcb_timestamp_t, uint32_t, uint32_t, uint32_t, uint32_t); xembed_window_t * xembed_getbywin(xembed_window_array_t *, xcb_window_t); -void xembed_property_update(xcb_connection_t *, xembed_window_t *, xcb_get_property_reply_t *); +void xembed_property_update(xcb_connection_t *, xembed_window_t *, xcb_timestamp_t, xcb_get_property_reply_t *); xcb_get_property_cookie_t xembed_info_get_unchecked(xcb_connection_t *, xcb_window_t); bool xembed_info_get_reply(xcb_connection_t *connection, @@ -100,46 +100,50 @@ bool xembed_info_get_reply(xcb_connection_t *connection, /** Indicate to an embedded window that it has focus. * \param c The X connection. * \param client The client. + * \param timestamp The timestamp. * \param focus_type The type of focus. */ static inline void -xembed_focus_in(xcb_connection_t *c, xcb_window_t client, long focus_type) +xembed_focus_in(xcb_connection_t *c, xcb_window_t client, xcb_timestamp_t timestamp, uint32_t focus_type) { - xembed_message_send(c, client, XEMBED_FOCUS_IN, focus_type, 0, 0); + xembed_message_send(c, client, timestamp, XEMBED_FOCUS_IN, focus_type, 0, 0); } /** Notify a window that it has become active. * \param c The X connection. * \param client The window to notify. + * \param timestamp The timestamp. */ static inline void -xembed_window_activate(xcb_connection_t *c, xcb_window_t client) +xembed_window_activate(xcb_connection_t *c, xcb_window_t client, xcb_timestamp_t timestamp) { - xembed_message_send(c, client, XEMBED_WINDOW_ACTIVATE, 0, 0, 0); + xembed_message_send(c, client, timestamp, XEMBED_WINDOW_ACTIVATE, 0, 0, 0); } /** Notify a window that it has become inactive. * \param c The X connection. * \param client The window to notify. + * \param timestamp The timestamp. */ static inline -void xembed_window_deactivate(xcb_connection_t *c, xcb_window_t client) +void xembed_window_deactivate(xcb_connection_t *c, xcb_window_t client, xcb_timestamp_t timestamp) { - xembed_message_send(c, client, XEMBED_WINDOW_DEACTIVATE, 0, 0, 0); + xembed_message_send(c, client, timestamp, XEMBED_WINDOW_DEACTIVATE, 0, 0, 0); } /** Notify a window that its embed request has been received and accepted. * \param c The X connection. * \param client The client to send message to. + * \param timestamp The timestamp. * \param embedder The embedder window. * \param version The version. */ static inline void xembed_embedded_notify(xcb_connection_t *c, - xcb_window_t client, xcb_window_t embedder, - long version) + xcb_window_t client, xcb_timestamp_t timestamp, + xcb_window_t embedder, uint32_t version) { - xembed_message_send(c, client, XEMBED_EMBEDDED_NOTIFY, 0, embedder, version); + xembed_message_send(c, client, timestamp, XEMBED_EMBEDDED_NOTIFY, 0, embedder, version); } /** Have the embedder end XEMBED protocol communication with a child. @@ -156,11 +160,12 @@ xembed_window_unembed(xcb_connection_t *connection, xcb_window_t child, xcb_wind /** Indicate to an embedded window that it has lost focus. * \param c The X connection. * \param client The client to send message to. + * \param timestamp The timestamp. */ static inline void -xembed_focus_out(xcb_connection_t *c, xcb_window_t client) +xembed_focus_out(xcb_connection_t *c, xcb_window_t client, xcb_timestamp_t timestamp) { - xembed_message_send(c, client, XEMBED_FOCUS_OUT, 0, 0, 0); + xembed_message_send(c, client, timestamp, XEMBED_FOCUS_OUT, 0, 0, 0); } diff --git a/event.c b/event.c index 889e1c09..de60131d 100644 --- a/event.c +++ b/event.c @@ -751,7 +751,7 @@ event_handle_maprequest(xcb_map_request_event_t *ev) if((em = xembed_getbywin(&globalconf.embedded, ev->window))) { xcb_map_window(globalconf.connection, ev->window); - xembed_window_activate(globalconf.connection, ev->window); + xembed_window_activate(globalconf.connection, ev->window, globalconf.timestamp); /* The correct way to set this is via the _XEMBED_INFO property. Neither * of the XEMBED not the systray spec talk about mapping windows. * Apparently, Qt doesn't care and does not set an _XEMBED_INFO diff --git a/property.c b/property.c index e57effb4..9453621d 100644 --- a/property.c +++ b/property.c @@ -341,7 +341,8 @@ property_handle_xembed_info(uint8_t state, XCB_GET_PROPERTY_TYPE_ANY, 0, 3); xcb_get_property_reply_t *propr = xcb_get_property_reply(globalconf.connection, cookie, 0); - xembed_property_update(globalconf.connection, emwin, propr); + xembed_property_update(globalconf.connection, emwin, + globalconf.timestamp, propr); p_delete(&propr); } diff --git a/systray.c b/systray.c index 93182f37..cb1f4bec 100644 --- a/systray.c +++ b/systray.c @@ -166,7 +166,7 @@ systray_request_handle(xcb_window_t embed_win) } xembed_embedded_notify(globalconf.connection, em.win, - globalconf.systray.window, + globalconf.timestamp, globalconf.systray.window, MIN(XEMBED_VERSION, em.info.version)); xembed_window_array_append(&globalconf.embedded, em); @@ -241,7 +241,8 @@ xembed_process_client_message(xcb_client_message_event_t *ev) switch(ev->data.data32[1]) { case XEMBED_REQUEST_FOCUS: - xembed_focus_in(globalconf.connection, ev->window, XEMBED_FOCUS_CURRENT); + xembed_focus_in(globalconf.connection, ev->window, + globalconf.timestamp, XEMBED_FOCUS_CURRENT); break; } return 0;