xembed: make xembed_info_get() asynchronous
This commit is contained in:
parent
193a73c5d9
commit
687dcf1d98
|
@ -74,23 +74,33 @@ xembed_message_send(xcb_connection_t *connection, xcb_window_t towin,
|
||||||
xcb_send_event(connection, false, towin, XCB_EVENT_MASK_NO_EVENT, (char *) &ev);
|
xcb_send_event(connection, false, towin, XCB_EVENT_MASK_NO_EVENT, (char *) &ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get the XEMBED info for a window.
|
/** Deliver a request to get XEMBED info for a window.
|
||||||
* \param connection The X connection.
|
* \param connection The X connection.
|
||||||
* \param win The window.
|
* \param win The window.
|
||||||
|
* \return A cookie.
|
||||||
|
*/
|
||||||
|
xcb_get_property_cookie_t
|
||||||
|
xembed_info_get_unchecked(xcb_connection_t *connection, xcb_window_t win)
|
||||||
|
{
|
||||||
|
return xcb_get_property_unchecked(connection, false, win, _XEMBED_INFO,
|
||||||
|
XCB_GET_PROPERTY_TYPE_ANY, 0L, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Get the XEMBED info for a window.
|
||||||
|
* \param connection The X connection.
|
||||||
|
* \param cookie The cookie of the request.
|
||||||
* \param info The xembed_info_t structure to fill.
|
* \param info The xembed_info_t structure to fill.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
xembed_info_get(xcb_connection_t *connection, xcb_window_t win, xembed_info_t *info)
|
xembed_info_get_reply(xcb_connection_t *connection,
|
||||||
|
xcb_get_property_cookie_t cookie,
|
||||||
|
xembed_info_t *info)
|
||||||
{
|
{
|
||||||
xcb_get_property_cookie_t prop_c;
|
|
||||||
xcb_get_property_reply_t *prop_r;
|
xcb_get_property_reply_t *prop_r;
|
||||||
uint32_t *data;
|
uint32_t *data;
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
|
||||||
prop_c = xcb_get_property_unchecked(connection, false, win, _XEMBED_INFO,
|
prop_r = xcb_get_property_reply(connection, cookie, NULL);
|
||||||
XCB_GET_PROPERTY_TYPE_ANY, 0L, 2);
|
|
||||||
|
|
||||||
prop_r = xcb_get_property_reply(connection, prop_c, NULL);
|
|
||||||
|
|
||||||
if(!prop_r || !prop_r->value_len)
|
if(!prop_r || !prop_r->value_len)
|
||||||
goto bailout;
|
goto bailout;
|
||||||
|
@ -131,7 +141,11 @@ xembed_property_update(xcb_connection_t *connection, xembed_window_t *emwin)
|
||||||
int flags_changed;
|
int flags_changed;
|
||||||
xembed_info_t info = { 0, 0 };
|
xembed_info_t info = { 0, 0 };
|
||||||
|
|
||||||
xembed_info_get(connection, emwin->win, &info);
|
xembed_info_get_reply(connection,
|
||||||
|
xembed_info_get_unchecked(connection,
|
||||||
|
emwin->win),
|
||||||
|
&info);
|
||||||
|
|
||||||
/* test if it changed */
|
/* test if it changed */
|
||||||
if(!(flags_changed = info.flags ^ emwin->info.flags))
|
if(!(flags_changed = info.flags ^ emwin->info.flags))
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -93,7 +93,12 @@ DO_SLIST(xembed_window_t, xembed_window, p_delete)
|
||||||
void xembed_message_send(xcb_connection_t *, xcb_window_t, long, long, long, long);
|
void xembed_message_send(xcb_connection_t *, xcb_window_t, long, long, long, long);
|
||||||
xembed_window_t * xembed_getbywin(xembed_window_t *, xcb_window_t);
|
xembed_window_t * xembed_getbywin(xembed_window_t *, xcb_window_t);
|
||||||
void xembed_property_update(xcb_connection_t *, xembed_window_t *);
|
void xembed_property_update(xcb_connection_t *, xembed_window_t *);
|
||||||
bool xembed_info_get(xcb_connection_t *, xcb_window_t, xembed_info_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,
|
||||||
|
xcb_get_property_cookie_t cookie,
|
||||||
|
xembed_info_t *info);
|
||||||
|
|
||||||
|
|
||||||
/** 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.
|
||||||
|
|
12
systray.c
12
systray.c
|
@ -89,6 +89,7 @@ int
|
||||||
systray_request_handle(xcb_window_t embed_win, int phys_screen, xembed_info_t *info)
|
systray_request_handle(xcb_window_t embed_win, int phys_screen, xembed_info_t *info)
|
||||||
{
|
{
|
||||||
xembed_window_t *em;
|
xembed_window_t *em;
|
||||||
|
xcb_get_property_cookie_t em_cookie;
|
||||||
int i;
|
int i;
|
||||||
const uint32_t select_input_val[] =
|
const uint32_t select_input_val[] =
|
||||||
{
|
{
|
||||||
|
@ -101,6 +102,11 @@ systray_request_handle(xcb_window_t embed_win, int phys_screen, xembed_info_t *i
|
||||||
if((em = xembed_getbywin(globalconf.embedded, embed_win)))
|
if((em = xembed_getbywin(globalconf.embedded, embed_win)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
p_clear(&em_cookie, 1);
|
||||||
|
|
||||||
|
if(!info)
|
||||||
|
em_cookie = xembed_info_get_unchecked(globalconf.connection, embed_win);
|
||||||
|
|
||||||
xcb_change_window_attributes(globalconf.connection, embed_win, XCB_CW_EVENT_MASK,
|
xcb_change_window_attributes(globalconf.connection, embed_win, XCB_CW_EVENT_MASK,
|
||||||
select_input_val);
|
select_input_val);
|
||||||
window_setstate(embed_win, XCB_WM_WITHDRAWN_STATE);
|
window_setstate(embed_win, XCB_WM_WITHDRAWN_STATE);
|
||||||
|
@ -109,12 +115,12 @@ systray_request_handle(xcb_window_t embed_win, int phys_screen, xembed_info_t *i
|
||||||
em->win = embed_win;
|
em->win = embed_win;
|
||||||
em->phys_screen = phys_screen;
|
em->phys_screen = phys_screen;
|
||||||
|
|
||||||
|
xembed_window_list_append(&globalconf.embedded, em);
|
||||||
|
|
||||||
if(info)
|
if(info)
|
||||||
em->info = *info;
|
em->info = *info;
|
||||||
else
|
else
|
||||||
xembed_info_get(globalconf.connection, em->win, &em->info);
|
xembed_info_get_reply(globalconf.connection, em_cookie, &em->info);
|
||||||
|
|
||||||
xembed_window_list_append(&globalconf.embedded, em);
|
|
||||||
|
|
||||||
xembed_embedded_notify(globalconf.connection, em->win,
|
xembed_embedded_notify(globalconf.connection, em->win,
|
||||||
globalconf.screens[phys_screen].systray.window,
|
globalconf.screens[phys_screen].systray.window,
|
||||||
|
|
Loading…
Reference in New Issue