xembed: Stop using XCB_CURRENT_TIME
This changes the xembed code so that the caller passes in a timestamp that should be used instead of XCB_CURRENT_TIME. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
5d83eee16f
commit
148dc269a8
|
@ -37,7 +37,7 @@ void luaA_systray_invalidate(void);
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
xembed_message_send(xcb_connection_t *connection, xcb_window_t towin,
|
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;
|
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.response_type = XCB_CLIENT_MESSAGE;
|
||||||
ev.window = towin;
|
ev.window = towin;
|
||||||
ev.format = 32;
|
ev.format = 32;
|
||||||
ev.data.data32[0] = XCB_CURRENT_TIME;
|
ev.data.data32[0] = timestamp;
|
||||||
ev.data.data32[1] = message;
|
ev.data.data32[1] = message;
|
||||||
ev.data.data32[2] = d1;
|
ev.data.data32[2] = d1;
|
||||||
ev.data.data32[3] = d2;
|
ev.data.data32[3] = d2;
|
||||||
|
@ -116,10 +116,12 @@ xembed_getbywin(xembed_window_array_t *list, xcb_window_t win)
|
||||||
/** Update embedded window properties.
|
/** Update embedded window properties.
|
||||||
* \param connection The X connection.
|
* \param connection The X connection.
|
||||||
* \param emwin The embedded window.
|
* \param emwin The embedded window.
|
||||||
|
* \param timestamp The timestamp.
|
||||||
|
* \param reply The property reply to handle.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
xembed_property_update(xcb_connection_t *connection, xembed_window_t *emwin,
|
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;
|
int flags_changed;
|
||||||
xembed_info_t info = { 0, 0 };
|
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)
|
if(info.flags & XEMBED_MAPPED)
|
||||||
{
|
{
|
||||||
xcb_map_window(connection, emwin->win);
|
xcb_map_window(connection, emwin->win);
|
||||||
xembed_window_activate(connection, emwin->win);
|
xembed_window_activate(connection, emwin->win, timestamp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xcb_unmap_window(connection, emwin->win);
|
xcb_unmap_window(connection, emwin->win);
|
||||||
xembed_window_deactivate(connection, emwin->win);
|
xembed_window_deactivate(connection, emwin->win, timestamp);
|
||||||
xembed_focus_out(connection, emwin->win);
|
xembed_focus_out(connection, emwin->win, timestamp);
|
||||||
}
|
}
|
||||||
luaA_systray_invalidate();
|
luaA_systray_invalidate();
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,9 +87,9 @@ DO_ARRAY(xembed_window_t, xembed_window, DO_NOTHING)
|
||||||
#define XEMBED_ACCELERATOR_OVERLOADED (1 << 0)
|
#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);
|
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_get_property_cookie_t xembed_info_get_unchecked(xcb_connection_t *,
|
||||||
xcb_window_t);
|
xcb_window_t);
|
||||||
bool xembed_info_get_reply(xcb_connection_t *connection,
|
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.
|
/** Indicate to an embedded window that it has focus.
|
||||||
* \param c The X connection.
|
* \param c The X connection.
|
||||||
* \param client The client.
|
* \param client The client.
|
||||||
|
* \param timestamp The timestamp.
|
||||||
* \param focus_type The type of focus.
|
* \param focus_type The type of focus.
|
||||||
*/
|
*/
|
||||||
static inline void
|
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.
|
/** Notify a window that it has become active.
|
||||||
* \param c The X connection.
|
* \param c The X connection.
|
||||||
* \param client The window to notify.
|
* \param client The window to notify.
|
||||||
|
* \param timestamp The timestamp.
|
||||||
*/
|
*/
|
||||||
static inline void
|
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.
|
/** Notify a window that it has become inactive.
|
||||||
* \param c The X connection.
|
* \param c The X connection.
|
||||||
* \param client The window to notify.
|
* \param client The window to notify.
|
||||||
|
* \param timestamp The timestamp.
|
||||||
*/
|
*/
|
||||||
static inline
|
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.
|
/** Notify a window that its embed request has been received and accepted.
|
||||||
* \param c The X connection.
|
* \param c The X connection.
|
||||||
* \param client The client to send message to.
|
* \param client The client to send message to.
|
||||||
|
* \param timestamp The timestamp.
|
||||||
* \param embedder The embedder window.
|
* \param embedder The embedder window.
|
||||||
* \param version The version.
|
* \param version The version.
|
||||||
*/
|
*/
|
||||||
static inline void
|
static inline void
|
||||||
xembed_embedded_notify(xcb_connection_t *c,
|
xembed_embedded_notify(xcb_connection_t *c,
|
||||||
xcb_window_t client, xcb_window_t embedder,
|
xcb_window_t client, xcb_timestamp_t timestamp,
|
||||||
long version)
|
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.
|
/** 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.
|
/** Indicate to an embedded window that it has lost focus.
|
||||||
* \param c The X connection.
|
* \param c The X connection.
|
||||||
* \param client The client to send message to.
|
* \param client The client to send message to.
|
||||||
|
* \param timestamp The timestamp.
|
||||||
*/
|
*/
|
||||||
static inline void
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
2
event.c
2
event.c
|
@ -751,7 +751,7 @@ event_handle_maprequest(xcb_map_request_event_t *ev)
|
||||||
if((em = xembed_getbywin(&globalconf.embedded, ev->window)))
|
if((em = xembed_getbywin(&globalconf.embedded, ev->window)))
|
||||||
{
|
{
|
||||||
xcb_map_window(globalconf.connection, 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
|
/* The correct way to set this is via the _XEMBED_INFO property. Neither
|
||||||
* of the XEMBED not the systray spec talk about mapping windows.
|
* of the XEMBED not the systray spec talk about mapping windows.
|
||||||
* Apparently, Qt doesn't care and does not set an _XEMBED_INFO
|
* Apparently, Qt doesn't care and does not set an _XEMBED_INFO
|
||||||
|
|
|
@ -341,7 +341,8 @@ property_handle_xembed_info(uint8_t state,
|
||||||
XCB_GET_PROPERTY_TYPE_ANY, 0, 3);
|
XCB_GET_PROPERTY_TYPE_ANY, 0, 3);
|
||||||
xcb_get_property_reply_t *propr =
|
xcb_get_property_reply_t *propr =
|
||||||
xcb_get_property_reply(globalconf.connection, cookie, 0);
|
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);
|
p_delete(&propr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,7 @@ systray_request_handle(xcb_window_t embed_win)
|
||||||
}
|
}
|
||||||
|
|
||||||
xembed_embedded_notify(globalconf.connection, em.win,
|
xembed_embedded_notify(globalconf.connection, em.win,
|
||||||
globalconf.systray.window,
|
globalconf.timestamp, globalconf.systray.window,
|
||||||
MIN(XEMBED_VERSION, em.info.version));
|
MIN(XEMBED_VERSION, em.info.version));
|
||||||
|
|
||||||
xembed_window_array_append(&globalconf.embedded, em);
|
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])
|
switch(ev->data.data32[1])
|
||||||
{
|
{
|
||||||
case XEMBED_REQUEST_FOCUS:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue