Ecore_Xcb: Allow ecore_xcb to support unstable/development version(s) of xcb.

(based on patch from Boris Faure)

NB: This is untested/unsupported code. Ymmv, but using/compiling
ecore_x with versions of xcb > 0.3.6 is not supported yet (until such
time that standard distros support 0.3.8 out of the box).



SVN revision: 61971
This commit is contained in:
Christopher Michael 2011-08-02 01:32:10 +00:00
parent 39e04f7f4c
commit e339ae020a
5 changed files with 399 additions and 10 deletions

View File

@ -783,11 +783,18 @@ if test "x$want_ecore_x_xcb" = "xyes" ; then
fi fi
fi fi
## x11-xcb PKG_CHECK_MODULES(XCB, x11-xcb xcb xcb-shm xcb-event xcb-icccm >= 0.3.8 xcb-util >= 0.3.8 xcb-image xcb-keysyms,
PKG_CHECK_MODULES(XCB, x11-xcb xcb xcb-shm xcb-icccm xcb-image xcb-keysyms,
[ have_ecore_x_xcb="yes" [ have_ecore_x_xcb="yes"
requirements_ecore_x="x11-xcb xcb xcb-shm xcb-icccm xcb-image xcb-keysyms ${requirements_ecore_x}" ], requirements_ecore_x="x11-xcb xcb xcb-shm xcb-event xcb-icccm xcb-util xcb-image xcb-keysyms ${requirements_ecore_x}"
[ have_ecore_x_xcb="no" ]) ],
[
PKG_CHECK_MODULES(XCB, x11-xcb xcb xcb-event xcb-shm xcb-icccm xcb-image xcb-keysyms,
[ have_ecore_x_xcb="yes"
AC_DEFINE(OLD_XCB_VERSION, 1, [xcb version])
requirements_ecore_x="x11-xcb xcb xcb-event xcb-shm xcb-icccm xcb-image xcb-keysyms ${requirements_ecore_x}" ],
[ have_ecore_x_xcb="no" ])
],
[have_ecore_x_xcb="no" ])
if test "x$have_ecore_x_xcb" = "xyes" ; then if test "x$have_ecore_x_xcb" = "xyes" ; then

View File

@ -67,10 +67,18 @@ _ecore_xcb_error_handle(xcb_generic_error_t *err)
WRN("Got Error:"); WRN("Got Error:");
WRN("\tEvent: %s", xcb_event_get_request_label(err->major_code)); WRN("\tEvent: %s", xcb_event_get_request_label(err->major_code));
WRN("\tError: %s", xcb_event_get_error_label(err->error_code)); WRN("\tError: %s", xcb_event_get_error_label(err->error_code));
#ifdef OLD_XCB_VERSION
if (err->error_code == XCB_EVENT_ERROR_BAD_VALUE) if (err->error_code == XCB_EVENT_ERROR_BAD_VALUE)
WRN("\tBad Value: %d", ((xcb_value_error_t *)err)->bad_value); WRN("\tBad Value: %d", ((xcb_value_error_t *)err)->bad_value);
else if (err->error_code == XCB_EVENT_ERROR_BAD_WINDOW) else if (err->error_code == XCB_EVENT_ERROR_BAD_WINDOW)
WRN("\tBad Window: %d", ((xcb_window_error_t *)err)->bad_value); WRN("\tBad Window: %d", ((xcb_window_error_t *)err)->bad_value);
#else
if (err->error_code == XCB_VALUE)
WRN("\tBad Value: %d", ((xcb_value_error_t *)err)->bad_value);
else if (err->error_code == XCB_WINDOW)
WRN("\tBad Window: %d", ((xcb_window_error_t *)err)->bad_value);
#endif
_error_request_code = err->sequence; _error_request_code = err->sequence;
_error_code = err->error_code; _error_code = err->error_code;

View File

@ -240,6 +240,7 @@ _ecore_xcb_events_handle(xcb_generic_event_t *ev)
* so trap those cases and ignore. We also ignore BadValue from * so trap those cases and ignore. We also ignore BadValue from
* xcb_grab/ungrab_button (happens when we are using any_mod) * xcb_grab/ungrab_button (happens when we are using any_mod)
* and a few others */ * and a few others */
#ifdef OLD_XCB_VERSION
if (err->error_code == XCB_EVENT_ERROR_BAD_WINDOW) return; if (err->error_code == XCB_EVENT_ERROR_BAD_WINDOW) return;
else if (err->error_code == XCB_EVENT_ERROR_BAD_MATCH) else if (err->error_code == XCB_EVENT_ERROR_BAD_MATCH)
{ {
@ -254,7 +255,22 @@ _ecore_xcb_events_handle(xcb_generic_event_t *ev)
(err->major_code == XCB_UNGRAB_BUTTON)) (err->major_code == XCB_UNGRAB_BUTTON))
return; return;
} }
#else
if (err->error_code == XCB_WINDOW) return;
else if (err->error_code == XCB_MATCH)
{
if ((err->major_code == XCB_SET_INPUT_FOCUS) ||
(err->major_code == XCB_CONFIGURE_WINDOW))
return;
}
else if (err->error_code == XCB_VALUE)
{
if ((err->major_code == XCB_KILL_CLIENT) ||
(err->major_code == XCB_GRAB_BUTTON) ||
(err->major_code == XCB_UNGRAB_BUTTON))
return;
}
#endif
/* WRN("Got Event Error:"); */ /* WRN("Got Event Error:"); */
/* WRN("\tMajor Code: %d", err->major_code); */ /* WRN("\tMajor Code: %d", err->major_code); */
/* WRN("\tMinor Code: %d", err->minor_code); */ /* WRN("\tMinor Code: %d", err->minor_code); */
@ -1627,8 +1643,13 @@ _ecore_xcb_event_handle_client_message(xcb_generic_event_t *event)
e->source = ev->data.data32[3]; e->source = ev->data.data32[3];
ecore_event_add(ECORE_X_EVENT_WINDOW_STATE_REQUEST, e, NULL, NULL); ecore_event_add(ECORE_X_EVENT_WINDOW_STATE_REQUEST, e, NULL, NULL);
} }
#ifdef OLD_XCB_VERSION
else if ((ev->type == ECORE_X_ATOM_WM_CHANGE_STATE) && else if ((ev->type == ECORE_X_ATOM_WM_CHANGE_STATE) &&
(ev->format == 32) && (ev->data.data32[0] == XCB_WM_STATE_ICONIC)) (ev->format == 32) && (ev->data.data32[0] == XCB_WM_STATE_ICONIC))
#else
else if ((ev->type == ECORE_X_ATOM_WM_CHANGE_STATE) && (ev->format == 32) &&
(ev->data.data32[0] == XCB_ICCCM_WM_STATE_ICONIC))
#endif
{ {
Ecore_X_Event_Window_State_Request *e; Ecore_X_Event_Window_State_Request *e;

View File

@ -161,26 +161,42 @@ EAPI char *
ecore_x_icccm_title_get(Ecore_X_Window win) ecore_x_icccm_title_get(Ecore_X_Window win)
{ {
xcb_get_property_cookie_t cookie; xcb_get_property_cookie_t cookie;
#ifdef OLD_XCB_VERSION
xcb_get_text_property_reply_t prop; xcb_get_text_property_reply_t prop;
#else
xcb_icccm_get_text_property_reply_t prop;
#endif
uint8_t ret = 0; uint8_t ret = 0;
char *title = NULL; char *title = NULL;
LOGFN(__FILE__, __LINE__, __FUNCTION__); LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!win) return NULL; if (!win) return NULL;
#ifdef OLD_XCB_VERSION
cookie = xcb_get_wm_name_unchecked(_ecore_xcb_conn, win); cookie = xcb_get_wm_name_unchecked(_ecore_xcb_conn, win);
ret = xcb_get_wm_name_reply(_ecore_xcb_conn, cookie, &prop, NULL); ret = xcb_get_wm_name_reply(_ecore_xcb_conn, cookie, &prop, NULL);
#else
cookie = xcb_icccm_get_wm_name_unchecked(_ecore_xcb_conn, win);
ret = xcb_icccm_get_wm_name_reply(_ecore_xcb_conn, cookie, &prop, NULL);
#endif
if (ret == 0) return NULL; if (ret == 0) return NULL;
if (prop.name_len < 1) if (prop.name_len < 1)
{ {
#ifdef OLD_XCB_VERSION
xcb_get_text_property_reply_wipe(&prop); xcb_get_text_property_reply_wipe(&prop);
#else
xcb_icccm_get_text_property_reply_wipe(&prop);
#endif
return NULL; return NULL;
} }
if (!(title = malloc((prop.name_len + 1) * sizeof(char *)))) if (!(title = malloc((prop.name_len + 1) * sizeof(char *))))
{ {
#ifdef OLD_XCB_VERSION
xcb_get_text_property_reply_wipe(&prop); xcb_get_text_property_reply_wipe(&prop);
#else
xcb_icccm_get_text_property_reply_wipe(&prop);
#endif
return NULL; return NULL;
} }
memcpy(title, prop.name, sizeof(char *) * prop.name_len); memcpy(title, prop.name, sizeof(char *) * prop.name_len);
@ -210,7 +226,11 @@ ecore_x_icccm_title_get(Ecore_X_Window win)
} }
} }
#ifdef OLD_XCB_VERSION
xcb_get_text_property_reply_wipe(&prop); xcb_get_text_property_reply_wipe(&prop);
#else
xcb_icccm_get_text_property_reply_wipe(&prop);
#endif
return title; return title;
} }
@ -238,14 +258,23 @@ ecore_x_icccm_title_set(Ecore_X_Window win, const char *title)
if (ret) if (ret)
{ {
#ifdef OLD_XCB_VERSION
xcb_set_wm_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING, xcb_set_wm_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
strlen(prop.value), prop.value); strlen(prop.value), prop.value);
#else
xcb_icccm_set_wm_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING, 8,
strlen(prop.value), prop.value);
#endif
if (prop.value) free(prop.value); if (prop.value) free(prop.value);
} }
else else
xcb_set_wm_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING, #ifdef OLD_XCB_VERSION
strlen(title), title); xcb_set_wm_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
strlen(title), title);
#else
xcb_icccm_set_wm_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING, 8,
strlen(title), title);
#endif
free(list[0]); free(list[0]);
} }
@ -261,7 +290,11 @@ EAPI void
ecore_x_icccm_name_class_get(Ecore_X_Window win, char **name, char **class) ecore_x_icccm_name_class_get(Ecore_X_Window win, char **name, char **class)
{ {
xcb_get_property_cookie_t cookie; xcb_get_property_cookie_t cookie;
#ifdef OLD_XCB_VERSION
xcb_get_wm_class_reply_t prop; xcb_get_wm_class_reply_t prop;
#else
xcb_icccm_get_wm_class_reply_t prop;
#endif
uint8_t ret = 0; uint8_t ret = 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__); LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -269,14 +302,23 @@ ecore_x_icccm_name_class_get(Ecore_X_Window win, char **name, char **class)
if (name) *name = NULL; if (name) *name = NULL;
if (class) *class = NULL; if (class) *class = NULL;
#ifdef OLD_XCB_VERSION
cookie = xcb_get_wm_class_unchecked(_ecore_xcb_conn, win); cookie = xcb_get_wm_class_unchecked(_ecore_xcb_conn, win);
ret = xcb_get_wm_class_reply(_ecore_xcb_conn, cookie, &prop, NULL); ret = xcb_get_wm_class_reply(_ecore_xcb_conn, cookie, &prop, NULL);
#else
cookie = xcb_icccm_get_wm_class_unchecked(_ecore_xcb_conn, win);
ret = xcb_icccm_get_wm_class_reply(_ecore_xcb_conn, cookie, &prop, NULL);
#endif
if (ret == 0) return; if (ret == 0) return;
if (name) *name = strdup(prop.instance_name); if (name) *name = strdup(prop.instance_name);
if (class) *class = strdup(prop.class_name); if (class) *class = strdup(prop.class_name);
#ifdef OLD_XCB_VERSION
xcb_get_wm_class_reply_wipe(&prop); xcb_get_wm_class_reply_wipe(&prop);
#else
xcb_icccm_get_wm_class_reply_wipe(&prop);
#endif
} }
/** /**
@ -361,8 +403,13 @@ ecore_x_icccm_transient_for_get(Ecore_X_Window win)
LOGFN(__FILE__, __LINE__, __FUNCTION__); LOGFN(__FILE__, __LINE__, __FUNCTION__);
#ifdef OLD_XCB_VERSION
cookie = xcb_get_wm_transient_for_unchecked(_ecore_xcb_conn, win); cookie = xcb_get_wm_transient_for_unchecked(_ecore_xcb_conn, win);
xcb_get_wm_transient_for_reply(_ecore_xcb_conn, cookie, &forwin, NULL); xcb_get_wm_transient_for_reply(_ecore_xcb_conn, cookie, &forwin, NULL);
#else
cookie = xcb_icccm_get_wm_transient_for_unchecked(_ecore_xcb_conn, win);
xcb_icccm_get_wm_transient_for_reply(_ecore_xcb_conn, cookie, &forwin, NULL);
#endif
return forwin; return forwin;
} }
@ -452,6 +499,7 @@ ecore_x_icccm_state_get(Ecore_X_Window win)
} }
prop = (uint8_t *)xcb_get_property_value(reply); prop = (uint8_t *)xcb_get_property_value(reply);
#ifdef OLD_XCB_VERSION
switch (prop[0]) switch (prop[0])
{ {
case XCB_WM_STATE_WITHDRAWN: case XCB_WM_STATE_WITHDRAWN:
@ -466,6 +514,22 @@ ecore_x_icccm_state_get(Ecore_X_Window win)
default: default:
break; break;
} }
#else
switch (prop[0])
{
case XCB_ICCCM_WM_STATE_WITHDRAWN:
hint = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
break;
case XCB_ICCCM_WM_STATE_NORMAL:
hint = ECORE_X_WINDOW_STATE_HINT_NORMAL;
break;
case XCB_ICCCM_WM_STATE_ICONIC:
hint = ECORE_X_WINDOW_STATE_HINT_ICONIC;
break;
default:
break;
}
#endif
free(reply); free(reply);
return hint; return hint;
@ -474,10 +538,15 @@ ecore_x_icccm_state_get(Ecore_X_Window win)
EAPI void EAPI void
ecore_x_icccm_state_set(Ecore_X_Window win, Ecore_X_Window_State_Hint state) ecore_x_icccm_state_set(Ecore_X_Window win, Ecore_X_Window_State_Hint state)
{ {
#ifdef OLD_XCB_VERSION
xcb_wm_hints_t hints; xcb_wm_hints_t hints;
#else
xcb_icccm_wm_hints_t hints;
#endif
LOGFN(__FILE__, __LINE__, __FUNCTION__); LOGFN(__FILE__, __LINE__, __FUNCTION__);
#ifdef OLD_XCB_VERSION
xcb_wm_hints_set_none(&hints); xcb_wm_hints_set_none(&hints);
hints.flags = XCB_WM_HINT_STATE; hints.flags = XCB_WM_HINT_STATE;
@ -490,6 +559,21 @@ ecore_x_icccm_state_set(Ecore_X_Window win, Ecore_X_Window_State_Hint state)
xcb_wm_hints_set_iconic(&hints); xcb_wm_hints_set_iconic(&hints);
xcb_set_wm_hints(_ecore_xcb_conn, win, &hints); xcb_set_wm_hints(_ecore_xcb_conn, win, &hints);
#else
xcb_icccm_wm_hints_set_none(&hints);
hints.flags = XCB_ICCCM_WM_HINT_STATE;
if (state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN)
xcb_icccm_wm_hints_set_withdrawn(&hints);
else if (state == ECORE_X_WINDOW_STATE_HINT_NORMAL)
xcb_icccm_wm_hints_set_normal(&hints);
else if (state == ECORE_X_WINDOW_STATE_HINT_ICONIC)
xcb_icccm_wm_hints_set_iconic(&hints);
xcb_icccm_set_wm_hints(_ecore_xcb_conn, win, &hints);
#endif
} }
EAPI void EAPI void
@ -504,10 +588,15 @@ ecore_x_icccm_delete_window_send(Ecore_X_Window win, Ecore_X_Time t)
EAPI void EAPI void
ecore_x_icccm_hints_set(Ecore_X_Window win, Eina_Bool accepts_focus, Ecore_X_Window_State_Hint initial_state, Ecore_X_Pixmap icon_pixmap, Ecore_X_Pixmap icon_mask, Ecore_X_Window icon_window, Ecore_X_Window window_group, Eina_Bool is_urgent) ecore_x_icccm_hints_set(Ecore_X_Window win, Eina_Bool accepts_focus, Ecore_X_Window_State_Hint initial_state, Ecore_X_Pixmap icon_pixmap, Ecore_X_Pixmap icon_mask, Ecore_X_Window icon_window, Ecore_X_Window window_group, Eina_Bool is_urgent)
{ {
#ifdef OLD_XCB_VERSION
xcb_wm_hints_t hints; xcb_wm_hints_t hints;
#else
xcb_icccm_wm_hints_t hints;
#endif
LOGFN(__FILE__, __LINE__, __FUNCTION__); LOGFN(__FILE__, __LINE__, __FUNCTION__);
#ifdef OLD_XCB_VERSION
xcb_wm_hints_set_none(&hints); xcb_wm_hints_set_none(&hints);
xcb_wm_hints_set_input(&hints, accepts_focus); xcb_wm_hints_set_input(&hints, accepts_focus);
@ -525,13 +614,41 @@ ecore_x_icccm_hints_set(Ecore_X_Window win, Eina_Bool accepts_focus, Ecore_X_Win
if (is_urgent) xcb_wm_hints_set_urgency(&hints); if (is_urgent) xcb_wm_hints_set_urgency(&hints);
xcb_set_wm_hints(_ecore_xcb_conn, win, &hints); xcb_set_wm_hints(_ecore_xcb_conn, win, &hints);
#else
xcb_icccm_wm_hints_set_none(&hints);
xcb_icccm_wm_hints_set_input(&hints, accepts_focus);
if (initial_state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN)
xcb_icccm_wm_hints_set_withdrawn(&hints);
else if (initial_state == ECORE_X_WINDOW_STATE_HINT_NORMAL)
xcb_icccm_wm_hints_set_normal(&hints);
else if (initial_state == ECORE_X_WINDOW_STATE_HINT_ICONIC)
xcb_icccm_wm_hints_set_iconic(&hints);
if (icon_pixmap != 0)
xcb_icccm_wm_hints_set_icon_pixmap(&hints, icon_pixmap);
if (icon_mask != 0)
xcb_icccm_wm_hints_set_icon_mask(&hints, icon_mask);
if (icon_window != 0)
xcb_icccm_wm_hints_set_icon_window(&hints, icon_window);
if (window_group != 0)
xcb_icccm_wm_hints_set_window_group(&hints, window_group);
if (is_urgent)
xcb_icccm_wm_hints_set_urgency(&hints);
xcb_icccm_set_wm_hints(_ecore_xcb_conn, win, &hints);
#endif
} }
EAPI Eina_Bool EAPI Eina_Bool
ecore_x_icccm_hints_get(Ecore_X_Window win, Eina_Bool *accepts_focus, Ecore_X_Window_State_Hint *initial_state, Ecore_X_Pixmap *icon_pixmap, Ecore_X_Pixmap *icon_mask, Ecore_X_Window *icon_window, Ecore_X_Window *window_group, Eina_Bool *is_urgent) ecore_x_icccm_hints_get(Ecore_X_Window win, Eina_Bool *accepts_focus, Ecore_X_Window_State_Hint *initial_state, Ecore_X_Pixmap *icon_pixmap, Ecore_X_Pixmap *icon_mask, Ecore_X_Window *icon_window, Ecore_X_Window *window_group, Eina_Bool *is_urgent)
{ {
xcb_get_property_cookie_t cookie; xcb_get_property_cookie_t cookie;
#ifdef OLD_XCB_VERSION
xcb_wm_hints_t hints; xcb_wm_hints_t hints;
#else
xcb_icccm_wm_hints_t hints;
#endif
uint8_t ret = 0; uint8_t ret = 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__); LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -544,12 +661,22 @@ ecore_x_icccm_hints_get(Ecore_X_Window win, Eina_Bool *accepts_focus, Ecore_X_Wi
if (window_group) *window_group = 0; if (window_group) *window_group = 0;
if (is_urgent) *is_urgent = EINA_FALSE; if (is_urgent) *is_urgent = EINA_FALSE;
#ifdef OLD_XCB_VERSION
xcb_wm_hints_set_none(&hints); xcb_wm_hints_set_none(&hints);
cookie = xcb_get_wm_hints_unchecked(_ecore_xcb_conn, win); cookie = xcb_get_wm_hints_unchecked(_ecore_xcb_conn, win);
ret = xcb_get_wm_hints_reply(_ecore_xcb_conn, cookie, &hints, NULL); ret = xcb_get_wm_hints_reply(_ecore_xcb_conn, cookie, &hints, NULL);
#else
xcb_icccm_wm_hints_set_none(&hints);
cookie = xcb_icccm_get_wm_hints_unchecked(_ecore_xcb_conn, win);
ret = xcb_icccm_get_wm_hints_reply(_ecore_xcb_conn, cookie, &hints, NULL);
#endif
if (!ret) return EINA_FALSE; if (!ret) return EINA_FALSE;
#ifdef OLD_XCB_VERSION
if ((hints.flags & XCB_WM_HINT_INPUT) && (accepts_focus)) if ((hints.flags & XCB_WM_HINT_INPUT) && (accepts_focus))
#else
if ((hints.flags & XCB_ICCCM_WM_HINT_INPUT) && (accepts_focus))
#endif
{ {
if (hints.input) if (hints.input)
*accepts_focus = EINA_TRUE; *accepts_focus = EINA_TRUE;
@ -557,6 +684,7 @@ ecore_x_icccm_hints_get(Ecore_X_Window win, Eina_Bool *accepts_focus, Ecore_X_Wi
*accepts_focus = EINA_FALSE; *accepts_focus = EINA_FALSE;
} }
#ifdef OLD_XCB_VERSION
if ((hints.flags & XCB_WM_HINT_STATE) && (initial_state)) if ((hints.flags & XCB_WM_HINT_STATE) && (initial_state))
{ {
if (hints.initial_state == XCB_WM_STATE_WITHDRAWN) if (hints.initial_state == XCB_WM_STATE_WITHDRAWN)
@ -581,6 +709,32 @@ ecore_x_icccm_hints_get(Ecore_X_Window win, Eina_Bool *accepts_focus, Ecore_X_Wi
if ((hints.flags & XCB_WM_HINT_X_URGENCY) && (is_urgent)) if ((hints.flags & XCB_WM_HINT_X_URGENCY) && (is_urgent))
*is_urgent = EINA_TRUE; *is_urgent = EINA_TRUE;
#else
if ((hints.flags & XCB_ICCCM_WM_HINT_STATE) && (initial_state))
{
if (hints.initial_state == XCB_ICCCM_WM_STATE_WITHDRAWN)
*initial_state = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
else if (hints.initial_state == XCB_ICCCM_WM_STATE_NORMAL)
*initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL;
else if (hints.initial_state == XCB_ICCCM_WM_STATE_ICONIC)
*initial_state = ECORE_X_WINDOW_STATE_HINT_ICONIC;
}
if ((hints.flags & XCB_ICCCM_WM_HINT_ICON_PIXMAP) && (icon_pixmap))
*icon_pixmap = hints.icon_pixmap;
if ((hints.flags & XCB_ICCCM_WM_HINT_ICON_MASK) && (icon_mask))
*icon_mask = hints.icon_mask;
if ((hints.flags & XCB_ICCCM_WM_HINT_ICON_WINDOW) && (icon_window))
*icon_window = hints.icon_window;
if ((hints.flags & XCB_ICCCM_WM_HINT_WINDOW_GROUP) && (window_group))
*window_group = hints.window_group;
if ((hints.flags & XCB_ICCCM_WM_HINT_X_URGENCY) && (is_urgent))
*is_urgent = EINA_TRUE;
#endif
return EINA_TRUE; return EINA_TRUE;
} }
@ -596,7 +750,11 @@ EAPI char *
ecore_x_icccm_icon_name_get(Ecore_X_Window win) ecore_x_icccm_icon_name_get(Ecore_X_Window win)
{ {
xcb_get_property_cookie_t cookie; xcb_get_property_cookie_t cookie;
#ifdef OLD_XCB_VERSION
xcb_get_text_property_reply_t prop; xcb_get_text_property_reply_t prop;
#else
xcb_icccm_get_text_property_reply_t prop;
#endif
uint8_t ret = 0; uint8_t ret = 0;
char *tmp = NULL; char *tmp = NULL;
@ -604,19 +762,32 @@ ecore_x_icccm_icon_name_get(Ecore_X_Window win)
if (!win) return NULL; if (!win) return NULL;
#ifdef OLD_XCB_VERSION
cookie = xcb_get_wm_icon_name_unchecked(_ecore_xcb_conn, win); cookie = xcb_get_wm_icon_name_unchecked(_ecore_xcb_conn, win);
ret = xcb_get_wm_icon_name_reply(_ecore_xcb_conn, cookie, &prop, NULL); ret = xcb_get_wm_icon_name_reply(_ecore_xcb_conn, cookie, &prop, NULL);
#else
cookie = xcb_icccm_get_wm_icon_name_unchecked(_ecore_xcb_conn, win);
ret = xcb_icccm_get_wm_icon_name_reply(_ecore_xcb_conn, cookie, &prop, NULL);
#endif
if (ret == 0) return NULL; if (ret == 0) return NULL;
if (prop.name_len < 1) if (prop.name_len < 1)
{ {
#ifdef OLD_XCB_VERSION
xcb_get_text_property_reply_wipe(&prop); xcb_get_text_property_reply_wipe(&prop);
#else
xcb_icccm_get_text_property_reply_wipe(&prop);
#endif
return NULL; return NULL;
} }
if (!(tmp = malloc((prop.name_len + 1) * sizeof(char *)))) if (!(tmp = malloc((prop.name_len + 1) * sizeof(char *))))
{ {
#ifdef OLD_XCB_VERSION
xcb_get_text_property_reply_wipe(&prop); xcb_get_text_property_reply_wipe(&prop);
#else
xcb_icccm_get_text_property_reply_wipe(&prop);
#endif
return NULL; return NULL;
} }
memcpy(tmp, prop.name, sizeof(char *) * prop.name_len); memcpy(tmp, prop.name, sizeof(char *) * prop.name_len);
@ -646,7 +817,11 @@ ecore_x_icccm_icon_name_get(Ecore_X_Window win)
} }
} }
#ifdef OLD_XCB_VERSION
xcb_get_text_property_reply_wipe(&prop); xcb_get_text_property_reply_wipe(&prop);
#else
xcb_icccm_get_text_property_reply_wipe(&prop);
#endif
return tmp; return tmp;
} }
@ -681,14 +856,23 @@ ecore_x_icccm_icon_name_set(Ecore_X_Window win, const char *name)
if (ret) if (ret)
{ {
#ifdef OLD_XCB_VERSION
xcb_set_wm_icon_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING, xcb_set_wm_icon_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
strlen(prop.value), prop.value); strlen(prop.value), prop.value);
#else
xcb_icccm_set_wm_icon_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
8, strlen(prop.value), prop.value);
#endif
if (prop.value) free(prop.value); if (prop.value) free(prop.value);
} }
else else
#ifdef OLD_XCB_VERSION
xcb_set_wm_icon_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING, xcb_set_wm_icon_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
strlen(name), name); strlen(name), name);
#else
xcb_icccm_set_wm_icon_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
8, strlen(name), name);
#endif
free(list[0]); free(list[0]);
} }
@ -709,7 +893,11 @@ ecore_x_icccm_iconic_request_send(Ecore_X_Window win, Ecore_X_Window root)
ev.format = 32; ev.format = 32;
ev.window = win; ev.window = win;
ev.type = ECORE_X_ATOM_WM_CHANGE_STATE; ev.type = ECORE_X_ATOM_WM_CHANGE_STATE;
#ifdef OLD_XCB_VERSION
ev.data.data32[0] = XCB_WM_STATE_ICONIC; ev.data.data32[0] = XCB_WM_STATE_ICONIC;
#else
ev.data.data32[0] = XCB_ICCCM_WM_STATE_ICONIC;
#endif
xcb_send_event(_ecore_xcb_conn, 0, root, xcb_send_event(_ecore_xcb_conn, 0, root,
(XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | (XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY |
@ -728,15 +916,24 @@ ecore_x_icccm_protocol_set(Ecore_X_Window win, Ecore_X_WM_Protocol protocol, Ein
{ {
Ecore_X_Atom proto; Ecore_X_Atom proto;
xcb_get_property_cookie_t cookie; xcb_get_property_cookie_t cookie;
#ifdef OLD_XCB_VERSION
xcb_get_wm_protocols_reply_t protos; xcb_get_wm_protocols_reply_t protos;
#else
xcb_icccm_get_wm_protocols_reply_t protos;
#endif
int i = 0, count = 0, set = 0; int i = 0, count = 0, set = 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__); LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (protocol >= ECORE_X_WM_PROTOCOL_NUM) return; if (protocol >= ECORE_X_WM_PROTOCOL_NUM) return;
proto = _ecore_xcb_atoms_wm_protocol[protocol]; proto = _ecore_xcb_atoms_wm_protocol[protocol];
#ifdef OLD_XCB_VERSION
cookie = xcb_get_wm_protocols_unchecked(_ecore_xcb_conn, win, proto); cookie = xcb_get_wm_protocols_unchecked(_ecore_xcb_conn, win, proto);
if (!xcb_get_wm_protocols_reply(_ecore_xcb_conn, cookie, &protos, NULL)) if (!xcb_get_wm_protocols_reply(_ecore_xcb_conn, cookie, &protos, NULL))
#else
cookie = xcb_icccm_get_wm_protocols_unchecked(_ecore_xcb_conn, win, proto);
if (!xcb_icccm_get_wm_protocols_reply(_ecore_xcb_conn, cookie, &protos, NULL))
#endif
count = 0; count = 0;
else else
count = protos.atoms_len; count = protos.atoms_len;
@ -762,9 +959,15 @@ ecore_x_icccm_protocol_set(Ecore_X_Window win, Ecore_X_WM_Protocol protocol, Ein
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
atoms[i] = protos.atoms[i]; atoms[i] = protos.atoms[i];
atoms[count] = proto; atoms[count] = proto;
#ifdef OLD_XCB_VERSION
xcb_set_wm_protocols(_ecore_xcb_conn, xcb_set_wm_protocols(_ecore_xcb_conn,
ECORE_X_ATOM_WM_PROTOCOLS, ECORE_X_ATOM_WM_PROTOCOLS,
win, count, atoms); win, count, atoms);
#else
xcb_icccm_set_wm_protocols(_ecore_xcb_conn,
ECORE_X_ATOM_WM_PROTOCOLS,
win, count, atoms);
#endif
free(atoms); free(atoms);
} }
} }
@ -782,9 +985,16 @@ ecore_x_icccm_protocol_set(Ecore_X_Window win, Ecore_X_WM_Protocol protocol, Ein
for (j = (i + 1); j < count; j++) for (j = (i + 1); j < count; j++)
protos.atoms[j - 1] = protos.atoms[j]; protos.atoms[j - 1] = protos.atoms[j];
if (count > 1) if (count > 1)
#ifdef OLD_XCB_VERSION
xcb_set_wm_protocols(_ecore_xcb_conn, xcb_set_wm_protocols(_ecore_xcb_conn,
ECORE_X_ATOM_WM_PROTOCOLS, ECORE_X_ATOM_WM_PROTOCOLS,
win, count - 1, protos.atoms); win, count - 1, protos.atoms);
#else
xcb_icccm_set_wm_protocols(_ecore_xcb_conn,
ECORE_X_ATOM_WM_PROTOCOLS,
win, count - 1,
protos.atoms);
#endif
else else
ecore_x_window_prop_property_del(win, ecore_x_window_prop_property_del(win,
ECORE_X_ATOM_WM_PROTOCOLS); ECORE_X_ATOM_WM_PROTOCOLS);
@ -794,7 +1004,11 @@ ecore_x_icccm_protocol_set(Ecore_X_Window win, Ecore_X_WM_Protocol protocol, Ein
} }
} }
#ifdef OLD_XCB_VERSION
xcb_get_wm_protocols_reply_wipe(&protos); xcb_get_wm_protocols_reply_wipe(&protos);
#else
xcb_icccm_get_wm_protocols_reply_wipe(&protos);
#endif
} }
/** /**
@ -809,7 +1023,11 @@ ecore_x_icccm_protocol_isset(Ecore_X_Window win, Ecore_X_WM_Protocol protocol)
Ecore_X_Atom proto; Ecore_X_Atom proto;
Eina_Bool ret = EINA_FALSE; Eina_Bool ret = EINA_FALSE;
xcb_get_property_cookie_t cookie; xcb_get_property_cookie_t cookie;
#ifdef OLD_XCB_VERSION
xcb_get_wm_protocols_reply_t reply; xcb_get_wm_protocols_reply_t reply;
#else
xcb_icccm_get_wm_protocols_reply_t reply;
#endif
uint8_t val = 0; uint8_t val = 0;
unsigned int i = 0; unsigned int i = 0;
@ -818,8 +1036,13 @@ ecore_x_icccm_protocol_isset(Ecore_X_Window win, Ecore_X_WM_Protocol protocol)
if (protocol >= ECORE_X_WM_PROTOCOL_NUM) return EINA_FALSE; if (protocol >= ECORE_X_WM_PROTOCOL_NUM) return EINA_FALSE;
proto = _ecore_xcb_atoms_wm_protocol[protocol]; proto = _ecore_xcb_atoms_wm_protocol[protocol];
#ifdef OLD_XCB_VERSION
cookie = xcb_get_wm_protocols_unchecked(_ecore_xcb_conn, win, proto); cookie = xcb_get_wm_protocols_unchecked(_ecore_xcb_conn, win, proto);
val = xcb_get_wm_protocols_reply(_ecore_xcb_conn, cookie, &reply, NULL); val = xcb_get_wm_protocols_reply(_ecore_xcb_conn, cookie, &reply, NULL);
#else
cookie = xcb_icccm_get_wm_protocols_unchecked(_ecore_xcb_conn, win, proto);
val = xcb_icccm_get_wm_protocols_reply(_ecore_xcb_conn, cookie, &reply, NULL);
#endif
if (!val) return EINA_FALSE; if (!val) return EINA_FALSE;
for (i = 0; i < reply.atoms_len; i++) for (i = 0; i < reply.atoms_len; i++)
@ -829,7 +1052,12 @@ ecore_x_icccm_protocol_isset(Ecore_X_Window win, Ecore_X_WM_Protocol protocol)
break; break;
} }
#ifdef OLD_XCB_VERSION
xcb_get_wm_protocols_reply_wipe(&reply); xcb_get_wm_protocols_reply_wipe(&reply);
#else
xcb_icccm_get_wm_protocols_reply_wipe(&reply);
#endif
return ret; return ret;
} }
@ -845,8 +1073,13 @@ ecore_x_icccm_protocol_atoms_set(Ecore_X_Window win, Ecore_X_Atom *protos, int n
LOGFN(__FILE__, __LINE__, __FUNCTION__); LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (num > 0) if (num > 0)
#ifdef OLD_XCB_VERSION
xcb_set_wm_protocols(_ecore_xcb_conn, ECORE_X_ATOM_WM_PROTOCOLS, xcb_set_wm_protocols(_ecore_xcb_conn, ECORE_X_ATOM_WM_PROTOCOLS,
win, num, protos); win, num, protos);
#else
xcb_icccm_set_wm_protocols(_ecore_xcb_conn, ECORE_X_ATOM_WM_PROTOCOLS,
win, num, protos);
#endif
else else
ecore_x_window_prop_property_del(win, ECORE_X_ATOM_WM_PROTOCOLS); ecore_x_window_prop_property_del(win, ECORE_X_ATOM_WM_PROTOCOLS);
@ -879,28 +1112,51 @@ ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win, Eina_Bool *request_pos, Eco
if (min_aspect) *min_aspect = mina; if (min_aspect) *min_aspect = mina;
if (max_aspect) *max_aspect = maxa; if (max_aspect) *max_aspect = maxa;
#ifdef OLD_XCB_VERSION
cookie = xcb_get_wm_normal_hints_unchecked(_ecore_xcb_conn, win); cookie = xcb_get_wm_normal_hints_unchecked(_ecore_xcb_conn, win);
ret = xcb_get_wm_normal_hints_reply(_ecore_xcb_conn, cookie, &hints, NULL); ret = xcb_get_wm_normal_hints_reply(_ecore_xcb_conn, cookie, &hints, NULL);
#else
cookie = xcb_icccm_get_wm_normal_hints_unchecked(_ecore_xcb_conn, win);
ret = xcb_icccm_get_wm_normal_hints_reply(_ecore_xcb_conn, cookie,
&hints, NULL);
#endif
if (!ret) return EINA_FALSE; if (!ret) return EINA_FALSE;
#ifdef OLD_XCB_VERSION
if ((hints.flags & XCB_SIZE_HINT_US_POSITION) || if ((hints.flags & XCB_SIZE_HINT_US_POSITION) ||
(hints.flags & XCB_SIZE_HINT_P_POSITION)) (hints.flags & XCB_SIZE_HINT_P_POSITION))
#else
if ((hints.flags & XCB_ICCCM_SIZE_HINT_US_POSITION) ||
(hints.flags & XCB_ICCCM_SIZE_HINT_P_POSITION))
#endif
{ {
if (request_pos) *request_pos = EINA_TRUE; if (request_pos) *request_pos = EINA_TRUE;
} }
#ifdef OLD_XCB_VERSION
if (hints.flags & XCB_SIZE_HINT_P_WIN_GRAVITY) if (hints.flags & XCB_SIZE_HINT_P_WIN_GRAVITY)
#else
if (hints.flags & XCB_ICCCM_SIZE_HINT_P_WIN_GRAVITY)
#endif
{ {
if (gravity) *gravity = hints.win_gravity; if (gravity) *gravity = hints.win_gravity;
} }
#ifdef OLD_XCB_VERSION
if (hints.flags & XCB_SIZE_HINT_P_MIN_SIZE) if (hints.flags & XCB_SIZE_HINT_P_MIN_SIZE)
#else
if (hints.flags & XCB_ICCCM_SIZE_HINT_P_MIN_SIZE)
#endif
{ {
minw = hints.min_width; minw = hints.min_width;
minh = hints.min_height; minh = hints.min_height;
} }
#ifdef OLD_XCB_VERSION
if (hints.flags & XCB_SIZE_HINT_P_MAX_SIZE) if (hints.flags & XCB_SIZE_HINT_P_MAX_SIZE)
#else
if (hints.flags & XCB_ICCCM_SIZE_HINT_P_MAX_SIZE)
#endif
{ {
maxw = hints.max_width; maxw = hints.max_width;
maxh = hints.max_height; maxh = hints.max_height;
@ -908,7 +1164,11 @@ ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win, Eina_Bool *request_pos, Eco
if (maxh < minh) maxh = minh; if (maxh < minh) maxh = minh;
} }
#ifdef OLD_XCB_VERSION
if (hints.flags & XCB_SIZE_HINT_BASE_SIZE) if (hints.flags & XCB_SIZE_HINT_BASE_SIZE)
#else
if (hints.flags & XCB_ICCCM_SIZE_HINT_BASE_SIZE)
#endif
{ {
basew = hints.base_width; basew = hints.base_width;
baseh = hints.base_height; baseh = hints.base_height;
@ -916,7 +1176,11 @@ ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win, Eina_Bool *request_pos, Eco
if (baseh > minh) minh = baseh; if (baseh > minh) minh = baseh;
} }
#ifdef OLD_XCB_VERSION
if (hints.flags & XCB_SIZE_HINT_P_RESIZE_INC) if (hints.flags & XCB_SIZE_HINT_P_RESIZE_INC)
#else
if (hints.flags & XCB_ICCCM_SIZE_HINT_P_RESIZE_INC)
#endif
{ {
stepx = hints.width_inc; stepx = hints.width_inc;
stepy = hints.height_inc; stepy = hints.height_inc;
@ -924,7 +1188,11 @@ ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win, Eina_Bool *request_pos, Eco
if (stepy < 1) stepy = 1; if (stepy < 1) stepy = 1;
} }
#ifdef OLD_XCB_VERSION
if (hints.flags & XCB_SIZE_HINT_P_ASPECT) if (hints.flags & XCB_SIZE_HINT_P_ASPECT)
#else
if (hints.flags & XCB_ICCCM_SIZE_HINT_P_ASPECT)
#endif
{ {
if (hints.min_aspect_den > 0) if (hints.min_aspect_den > 0)
mina = ((double)hints.min_aspect_num) / ((double)hints.min_aspect_den); mina = ((double)hints.min_aspect_num) / ((double)hints.min_aspect_den);
@ -956,11 +1224,19 @@ ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win, Eina_Bool request_pos, Ecor
LOGFN(__FILE__, __LINE__, __FUNCTION__); LOGFN(__FILE__, __LINE__, __FUNCTION__);
#ifdef OLD_XCB_VERSION
cookie = xcb_get_wm_normal_hints_unchecked(_ecore_xcb_conn, win); cookie = xcb_get_wm_normal_hints_unchecked(_ecore_xcb_conn, win);
ret = xcb_get_wm_normal_hints_reply(_ecore_xcb_conn, cookie, &hints, NULL); ret = xcb_get_wm_normal_hints_reply(_ecore_xcb_conn, cookie, &hints, NULL);
#else
cookie = xcb_icccm_get_wm_normal_hints_unchecked(_ecore_xcb_conn, win);
ret = xcb_icccm_get_wm_normal_hints_reply(_ecore_xcb_conn, cookie,
&hints, NULL);
#endif
if (!ret) memset(&hints, 0, sizeof(xcb_size_hints_t)); if (!ret) memset(&hints, 0, sizeof(xcb_size_hints_t));
hints.flags = 0; hints.flags = 0;
#ifdef OLD_XCB_VERSION
if (request_pos) if (request_pos)
hints.flags |= XCB_SIZE_HINT_US_POSITION; hints.flags |= XCB_SIZE_HINT_US_POSITION;
@ -980,6 +1256,27 @@ ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win, Eina_Bool request_pos, Ecor
(int32_t)(max_aspect * 10000), 10000); (int32_t)(max_aspect * 10000), 10000);
xcb_set_wm_normal_hints(_ecore_xcb_conn, win, &hints); xcb_set_wm_normal_hints(_ecore_xcb_conn, win, &hints);
#else
if (request_pos)
hints.flags |= XCB_ICCCM_SIZE_HINT_US_POSITION;
if (gravity != ECORE_X_GRAVITY_NW)
xcb_icccm_size_hints_set_win_gravity(&hints, gravity);
if ((min_w > 0) || (min_h > 0))
xcb_icccm_size_hints_set_min_size(&hints, min_w, min_h);
if ((max_w > 0) || (max_h > 0))
xcb_icccm_size_hints_set_max_size(&hints, max_w, max_h);
if ((base_w > 0) || (base_h > 0))
xcb_icccm_size_hints_set_base_size(&hints, base_w, base_h);
if ((step_x > 1) || (step_y > 1))
xcb_icccm_size_hints_set_resize_inc(&hints, step_x, step_y);
if ((min_aspect > 0.0) || (max_aspect > 0.0))
xcb_icccm_size_hints_set_aspect(&hints,
(int32_t)(min_aspect * 10000), 10000,
(int32_t)(max_aspect * 10000), 10000);
xcb_icccm_set_wm_normal_hints(_ecore_xcb_conn, win, &hints);
#endif
} }
EAPI void EAPI void
@ -1019,26 +1316,44 @@ EAPI char *
ecore_x_icccm_client_machine_get(Ecore_X_Window win) ecore_x_icccm_client_machine_get(Ecore_X_Window win)
{ {
xcb_get_property_cookie_t cookie; xcb_get_property_cookie_t cookie;
#ifdef OLD_XCB_VERSION
xcb_get_text_property_reply_t prop; xcb_get_text_property_reply_t prop;
#else
xcb_icccm_get_text_property_reply_t prop;
#endif
uint8_t ret = 0; uint8_t ret = 0;
char *tmp = NULL; char *tmp = NULL;
LOGFN(__FILE__, __LINE__, __FUNCTION__); LOGFN(__FILE__, __LINE__, __FUNCTION__);
#ifdef OLD_XCB_VERSION
cookie = xcb_get_wm_client_machine_unchecked(_ecore_xcb_conn, win); cookie = xcb_get_wm_client_machine_unchecked(_ecore_xcb_conn, win);
ret = xcb_get_wm_client_machine_reply(_ecore_xcb_conn, cookie, &prop, NULL); ret = xcb_get_wm_client_machine_reply(_ecore_xcb_conn, cookie, &prop, NULL);
#else
cookie = xcb_icccm_get_wm_client_machine_unchecked(_ecore_xcb_conn, win);
ret = xcb_icccm_get_wm_client_machine_reply(_ecore_xcb_conn, cookie,
&prop, NULL);
#endif
if (ret == 0) return NULL; if (ret == 0) return NULL;
tmp = malloc((prop.name_len + 1) * sizeof(char *)); tmp = malloc((prop.name_len + 1) * sizeof(char *));
if (!tmp) if (!tmp)
{ {
#ifdef OLD_XCB_VERSION
xcb_get_text_property_reply_wipe(&prop); xcb_get_text_property_reply_wipe(&prop);
#else
xcb_icccm_get_text_property_reply_wipe(&prop);
#endif
return NULL; return NULL;
} }
memcpy(tmp, prop.name, sizeof(char *) * prop.name_len); memcpy(tmp, prop.name, sizeof(char *) * prop.name_len);
tmp[prop.name_len] = '\0'; tmp[prop.name_len] = '\0';
#ifdef OLD_XCB_VERSION
xcb_get_text_property_reply_wipe(&prop); xcb_get_text_property_reply_wipe(&prop);
#else
xcb_icccm_get_text_property_reply_wipe(&prop);
#endif
return tmp; return tmp;
} }

View File

@ -507,7 +507,11 @@ ecore_x_window_prop_protocol_isset(Ecore_X_Window win, Ecore_X_WM_Protocol proto
{ {
Eina_Bool ret = EINA_FALSE; Eina_Bool ret = EINA_FALSE;
Ecore_X_Atom proto; Ecore_X_Atom proto;
#ifdef OLD_XCB_VERSION
xcb_get_wm_protocols_reply_t protos; xcb_get_wm_protocols_reply_t protos;
#else
xcb_icccm_get_wm_protocols_reply_t protos;
#endif
xcb_get_property_cookie_t cookie; xcb_get_property_cookie_t cookie;
uint8_t reply; uint8_t reply;
uint32_t count = 0, i = 0; uint32_t count = 0, i = 0;
@ -517,9 +521,16 @@ ecore_x_window_prop_protocol_isset(Ecore_X_Window win, Ecore_X_WM_Protocol proto
if (protocol >= ECORE_X_WM_PROTOCOL_NUM) return EINA_FALSE; if (protocol >= ECORE_X_WM_PROTOCOL_NUM) return EINA_FALSE;
proto = _ecore_xcb_atoms_wm_protocol[protocol]; proto = _ecore_xcb_atoms_wm_protocol[protocol];
#ifdef OLD_XCB_VERSION
cookie = xcb_get_wm_protocols_unchecked(_ecore_xcb_conn, win, cookie = xcb_get_wm_protocols_unchecked(_ecore_xcb_conn, win,
ECORE_X_ATOM_WM_PROTOCOLS); ECORE_X_ATOM_WM_PROTOCOLS);
reply = xcb_get_wm_protocols_reply(_ecore_xcb_conn, cookie, &protos, NULL); reply = xcb_get_wm_protocols_reply(_ecore_xcb_conn, cookie, &protos, NULL);
#else
cookie = xcb_icccm_get_wm_protocols_unchecked(_ecore_xcb_conn, win,
ECORE_X_ATOM_WM_PROTOCOLS);
reply = xcb_icccm_get_wm_protocols_reply(_ecore_xcb_conn, cookie,
&protos, NULL);
#endif
if (!reply) return EINA_FALSE; if (!reply) return EINA_FALSE;
count = protos.atoms_len; count = protos.atoms_len;
@ -532,14 +543,22 @@ ecore_x_window_prop_protocol_isset(Ecore_X_Window win, Ecore_X_WM_Protocol proto
} }
} }
#ifdef OLD_XCB_VERSION
xcb_get_wm_protocols_reply_wipe(&protos); xcb_get_wm_protocols_reply_wipe(&protos);
#else
xcb_icccm_get_wm_protocols_reply_wipe(&protos);
#endif
return ret; return ret;
} }
EAPI Ecore_X_WM_Protocol * EAPI Ecore_X_WM_Protocol *
ecore_x_window_prop_protocol_list_get(Ecore_X_Window win, int *num_ret) ecore_x_window_prop_protocol_list_get(Ecore_X_Window win, int *num_ret)
{ {
#ifdef OLD_XCB_VERSION
xcb_get_wm_protocols_reply_t protos; xcb_get_wm_protocols_reply_t protos;
#else
xcb_icccm_get_wm_protocols_reply_t protos;
#endif
xcb_get_property_cookie_t cookie; xcb_get_property_cookie_t cookie;
uint8_t reply; uint8_t reply;
uint32_t count = 0, i = 0; uint32_t count = 0, i = 0;
@ -551,22 +570,37 @@ ecore_x_window_prop_protocol_list_get(Ecore_X_Window win, int *num_ret)
*num_ret = 0; *num_ret = 0;
#ifdef OLD_XCB_VERSION
cookie = xcb_get_wm_protocols_unchecked(_ecore_xcb_conn, win, cookie = xcb_get_wm_protocols_unchecked(_ecore_xcb_conn, win,
ECORE_X_ATOM_WM_PROTOCOLS); ECORE_X_ATOM_WM_PROTOCOLS);
reply = xcb_get_wm_protocols_reply(_ecore_xcb_conn, cookie, &protos, NULL); reply = xcb_get_wm_protocols_reply(_ecore_xcb_conn, cookie, &protos, NULL);
#else
cookie = xcb_icccm_get_wm_protocols_unchecked(_ecore_xcb_conn, win,
ECORE_X_ATOM_WM_PROTOCOLS);
reply = xcb_icccm_get_wm_protocols_reply(_ecore_xcb_conn, cookie,
&protos, NULL);
#endif
if (!reply) return NULL; if (!reply) return NULL;
count = protos.atoms_len; count = protos.atoms_len;
if (count <= 0) if (count <= 0)
{ {
#ifdef OLD_XCB_VERSION
xcb_get_wm_protocols_reply_wipe(&protos); xcb_get_wm_protocols_reply_wipe(&protos);
#else
xcb_icccm_get_wm_protocols_reply_wipe(&protos);
#endif
return NULL; return NULL;
} }
prot_ret = calloc(1, count * sizeof(Ecore_X_WM_Protocol)); prot_ret = calloc(1, count * sizeof(Ecore_X_WM_Protocol));
if (!prot_ret) if (!prot_ret)
{ {
#ifdef OLD_XCB_VERSION
xcb_get_wm_protocols_reply_wipe(&protos); xcb_get_wm_protocols_reply_wipe(&protos);
#else
xcb_icccm_get_wm_protocols_reply_wipe(&protos);
#endif
return NULL; return NULL;
} }
@ -584,7 +618,11 @@ ecore_x_window_prop_protocol_list_get(Ecore_X_Window win, int *num_ret)
if (num_ret) *num_ret = count; if (num_ret) *num_ret = count;
#ifdef OLD_XCB_VERSION
xcb_get_wm_protocols_reply_wipe(&protos); xcb_get_wm_protocols_reply_wipe(&protos);
#else
xcb_icccm_get_wm_protocols_reply_wipe(&protos);
#endif
return prot_ret; return prot_ret;
} }