On Mon, Aug 1, 2011 at 21:59, Christopher Michael
<cpmicha...@comcast.net> wrote:
>> On Mon, Aug 1, 2011 at 5:01 AM, Boris Faure<bill...@gmail.com> wrote:
>>> I'll rewrite the patch to make ecore_xcb work with both xcb< 1.7 and
>>> xcb>= 1.7 so that it's fine for everyone.
>
> New patch sounds good :) as long as it will build for both .. until such
> time that distros across the spectrum are all updated to development
> xcb. When that happens then we can stop supporting current stable xcb
> (0.3.6) and remove the legacy code :)
>
> When you get your new patch(s) ready, send them out to the mailing list
> and I'll gladly have a look :)
Patch is attached. Tell me if it works fine for you and I'll gladly commit it.
I've done a few things other than just use the new API:
- removed an unused var in ecore_x_icccm_size_pos_hints_get() and
added __UNUSED__ on win,
- changed LONG_MAX into UINT32_MAX in ecore_x_window_prop_property_get().
I think UINT32_MAX should be used instead of hard-coding 0x7fffffff or
1000000L when calling xcb_get_property_unchecked().
--
Boris Faure
diff --git a/ecore/configure.ac b/ecore/configure.ac
index fa7ab9d..6d3bb13 100644
--- a/ecore/configure.ac
+++ b/ecore/configure.ac
@@ -784,10 +784,22 @@ if test "x$want_ecore_x_xcb" = "xyes" ; then
fi
## x11-xcb
+ PKG_CHECK_MODULES(XCB,
+ x11-xcb
+ xcb
+ xcb-shm
+ xcb-icccm >= 0.3.8
+ xcb-util >= 0.3.8
+ xcb-image
+ xcb-keysyms,
+ [ have_ecore_x_xcb="yes"
+ requirements_ecore_x="x11-xcb xcb xcb-shm xcb-icccm xcb-image xcb-keysyms ${requirements_ecore_x}" ],
+ [
PKG_CHECK_MODULES(XCB, x11-xcb xcb 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-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
diff --git a/ecore/src/lib/ecore_x/xcb/ecore_xcb_error.c b/ecore/src/lib/ecore_x/xcb/ecore_xcb_error.c
index c58c13c..5c8556f 100644
--- a/ecore/src/lib/ecore_x/xcb/ecore_xcb_error.c
+++ b/ecore/src/lib/ecore_x/xcb/ecore_xcb_error.c
@@ -67,10 +67,17 @@ _ecore_xcb_error_handle(xcb_generic_error_t *err)
WRN("Got Error:");
WRN("\tEvent: %s", xcb_event_get_request_label(err->major_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)
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);
+#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_code = err->error_code;
diff --git a/ecore/src/lib/ecore_x/xcb/ecore_xcb_events.c b/ecore/src/lib/ecore_x/xcb/ecore_xcb_events.c
index eb2c959..f241e7f 100644
--- a/ecore/src/lib/ecore_x/xcb/ecore_xcb_events.c
+++ b/ecore/src/lib/ecore_x/xcb/ecore_xcb_events.c
@@ -240,6 +240,7 @@ _ecore_xcb_events_handle(xcb_generic_event_t *ev)
* so trap those cases and ignore. We also ignore BadValue from
* xcb_grab/ungrab_button (happens when we are using any_mod)
* and a few others */
+#ifdef OLD_XCB_VERSION
if (err->error_code == XCB_EVENT_ERROR_BAD_WINDOW) return;
else if (err->error_code == XCB_EVENT_ERROR_BAD_MATCH)
{
@@ -254,6 +255,22 @@ _ecore_xcb_events_handle(xcb_generic_event_t *ev)
(err->major_code == XCB_UNGRAB_BUTTON))
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("\tMajor Code: %d", err->major_code); */
@@ -1627,8 +1644,14 @@ _ecore_xcb_event_handle_client_message(xcb_generic_event_t *event)
e->source = ev->data.data32[3];
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) &&
(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;
diff --git a/ecore/src/lib/ecore_x/xcb/ecore_xcb_icccm.c b/ecore/src/lib/ecore_x/xcb/ecore_xcb_icccm.c
index 6c86686..140e28f 100644
--- a/ecore/src/lib/ecore_x/xcb/ecore_xcb_icccm.c
+++ b/ecore/src/lib/ecore_x/xcb/ecore_xcb_icccm.c
@@ -161,7 +161,11 @@ EAPI char *
ecore_x_icccm_title_get(Ecore_X_Window win)
{
xcb_get_property_cookie_t cookie;
+#ifdef OLD_XCB_VERSION
xcb_get_text_property_reply_t prop;
+#else
+ xcb_icccm_get_text_property_reply_t prop;
+#endif
uint8_t ret = 0;
char *title = NULL;
@@ -169,18 +173,31 @@ ecore_x_icccm_title_get(Ecore_X_Window win)
if (!win) return NULL;
+#ifdef OLD_XCB_VERSION
cookie = xcb_get_wm_name_unchecked(_ecore_xcb_conn, win);
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 (prop.name_len < 1)
{
+#ifdef OLD_XCB_VERSION
xcb_get_text_property_reply_wipe(&prop);
+#else
+ xcb_icccm_get_text_property_reply_wipe(&prop);
+#endif
return NULL;
}
if (!(title = malloc((prop.name_len + 1) * sizeof(char *))))
- {
+ {
+#ifdef OLD_XCB_VERSION
xcb_get_text_property_reply_wipe(&prop);
+#else
+ xcb_icccm_get_text_property_reply_wipe(&prop);
+#endif
return NULL;
}
memcpy(title, prop.name, sizeof(char *) * prop.name_len);
@@ -210,7 +227,11 @@ ecore_x_icccm_title_get(Ecore_X_Window win)
}
}
- xcb_get_text_property_reply_wipe(&prop);
+#ifdef OLD_XCB_VERSION
+ xcb_get_text_property_reply_wipe(&prop);
+#else
+ xcb_icccm_get_text_property_reply_wipe(&prop);
+#endif
return title;
}
@@ -238,14 +259,26 @@ ecore_x_icccm_title_set(Ecore_X_Window win, const char *title)
if (ret)
{
- xcb_set_wm_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
+#ifdef OLD_XCB_VERSION
+ xcb_set_wm_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
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);
}
- else
- xcb_set_wm_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
- strlen(title), title);
+ else
+ {
+#ifdef OLD_XCB_VERSION
+ 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]);
}
@@ -261,7 +294,11 @@ EAPI void
ecore_x_icccm_name_class_get(Ecore_X_Window win, char **name, char **class)
{
xcb_get_property_cookie_t cookie;
+#ifdef OLD_XCB_VERSION
xcb_get_wm_class_reply_t prop;
+#else
+ xcb_icccm_get_wm_class_reply_t prop;
+#endif
uint8_t ret = 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@@ -269,14 +306,23 @@ ecore_x_icccm_name_class_get(Ecore_X_Window win, char **name, char **class)
if (name) *name = NULL;
if (class) *class = NULL;
+#ifdef OLD_XCB_VERSION
cookie = xcb_get_wm_class_unchecked(_ecore_xcb_conn, win);
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 (name) *name = strdup(prop.instance_name);
if (class) *class = strdup(prop.class_name);
+#ifdef OLD_XCB_VERSION
xcb_get_wm_class_reply_wipe(&prop);
+#else
+ xcb_icccm_get_wm_class_reply_wipe(&prop);
+#endif
}
/**
@@ -361,8 +407,13 @@ ecore_x_icccm_transient_for_get(Ecore_X_Window win)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
+#ifdef OLD_XCB_VERSION
cookie = xcb_get_wm_transient_for_unchecked(_ecore_xcb_conn, win);
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;
}
@@ -452,7 +503,8 @@ ecore_x_icccm_state_get(Ecore_X_Window win)
}
prop = (uint8_t *)xcb_get_property_value(reply);
- switch (prop[0])
+#ifdef OLD_XCB_VERSION
+ switch (prop[0])
{
case XCB_WM_STATE_WITHDRAWN:
hint = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
@@ -466,6 +518,22 @@ ecore_x_icccm_state_get(Ecore_X_Window win)
default:
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);
return hint;
@@ -474,6 +542,7 @@ ecore_x_icccm_state_get(Ecore_X_Window win)
EAPI void
ecore_x_icccm_state_set(Ecore_X_Window win, Ecore_X_Window_State_Hint state)
{
+#ifdef OLD_XCB_VERSION
xcb_wm_hints_t hints;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@@ -490,6 +559,24 @@ ecore_x_icccm_state_set(Ecore_X_Window win, Ecore_X_Window_State_Hint state)
xcb_wm_hints_set_iconic(&hints);
xcb_set_wm_hints(_ecore_xcb_conn, win, &hints);
+#else
+ xcb_icccm_wm_hints_t hints;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ 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
@@ -504,6 +591,7 @@ ecore_x_icccm_delete_window_send(Ecore_X_Window win, Ecore_X_Time t)
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)
{
+#ifdef OLD_XCB_VERSION
xcb_wm_hints_t hints;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@@ -525,14 +613,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);
xcb_set_wm_hints(_ecore_xcb_conn, win, &hints);
+#else
+ xcb_icccm_wm_hints_t hints;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ 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
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_wm_hints_t hints;
uint8_t ret = 0;
+#ifdef OLD_XCB_VERSION
+ xcb_wm_hints_t hints;
+#else
+ xcb_icccm_wm_hints_t hints;
+#endif
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@@ -544,12 +659,22 @@ ecore_x_icccm_hints_get(Ecore_X_Window win, Eina_Bool *accepts_focus, Ecore_X_Wi
if (window_group) *window_group = 0;
if (is_urgent) *is_urgent = EINA_FALSE;
+#ifdef OLD_XCB_VERSION
xcb_wm_hints_set_none(&hints);
cookie = xcb_get_wm_hints_unchecked(_ecore_xcb_conn, win);
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;
+#ifdef OLD_XCB_VERSION
if ((hints.flags & XCB_WM_HINT_INPUT) && (accepts_focus))
+#else
+ if ((hints.flags & XCB_ICCCM_WM_HINT_INPUT) && (accepts_focus))
+#endif
{
if (hints.input)
*accepts_focus = EINA_TRUE;
@@ -557,6 +682,7 @@ ecore_x_icccm_hints_get(Ecore_X_Window win, Eina_Bool *accepts_focus, Ecore_X_Wi
*accepts_focus = EINA_FALSE;
}
+#ifdef OLD_XCB_VERSION
if ((hints.flags & XCB_WM_HINT_STATE) && (initial_state))
{
if (hints.initial_state == XCB_WM_STATE_WITHDRAWN)
@@ -581,6 +707,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))
*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;
}
@@ -596,7 +748,11 @@ EAPI char *
ecore_x_icccm_icon_name_get(Ecore_X_Window win)
{
xcb_get_property_cookie_t cookie;
+#ifdef OLD_XCB_VERSION
xcb_get_text_property_reply_t prop;
+#else
+ xcb_icccm_get_text_property_reply_t prop;
+#endif
uint8_t ret = 0;
char *tmp = NULL;
@@ -604,19 +760,32 @@ ecore_x_icccm_icon_name_get(Ecore_X_Window win)
if (!win) return NULL;
+#ifdef OLD_XCB_VERSION
cookie = xcb_get_wm_icon_name_unchecked(_ecore_xcb_conn, win);
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 (prop.name_len < 1)
{
+#ifdef OLD_XCB_VERSION
xcb_get_text_property_reply_wipe(&prop);
+#else
+ xcb_icccm_get_text_property_reply_wipe(&prop);
+#endif
return NULL;
}
if (!(tmp = malloc((prop.name_len + 1) * sizeof(char *))))
{
+#ifdef OLD_XCB_VERSION
xcb_get_text_property_reply_wipe(&prop);
+#else
+ xcb_icccm_get_text_property_reply_wipe(&prop);
+#endif
return NULL;
}
memcpy(tmp, prop.name, sizeof(char *) * prop.name_len);
@@ -646,7 +815,11 @@ ecore_x_icccm_icon_name_get(Ecore_X_Window win)
}
}
+#ifdef OLD_XCB_VERSION
xcb_get_text_property_reply_wipe(&prop);
+#else
+ xcb_icccm_get_text_property_reply_wipe(&prop);
+#endif
return tmp;
}
@@ -681,14 +854,24 @@ ecore_x_icccm_icon_name_set(Ecore_X_Window win, const char *name)
if (ret)
{
- xcb_set_wm_icon_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
+#ifdef OLD_XCB_VERSION
+ xcb_set_wm_icon_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
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);
}
- else
- xcb_set_wm_icon_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
+ else
+#ifdef OLD_XCB_VERSION
+ xcb_set_wm_icon_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
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]);
}
@@ -709,7 +892,11 @@ ecore_x_icccm_iconic_request_send(Ecore_X_Window win, Ecore_X_Window root)
ev.format = 32;
ev.window = win;
ev.type = ECORE_X_ATOM_WM_CHANGE_STATE;
+#ifdef OLD_XCB_VERSION
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_EVENT_MASK_SUBSTRUCTURE_NOTIFY |
@@ -728,15 +915,24 @@ ecore_x_icccm_protocol_set(Ecore_X_Window win, Ecore_X_WM_Protocol protocol, Ein
{
Ecore_X_Atom proto;
xcb_get_property_cookie_t cookie;
+#ifdef OLD_XCB_VERSION
xcb_get_wm_protocols_reply_t protos;
+#else
+ xcb_icccm_get_wm_protocols_reply_t protos;
+#endif
int i = 0, count = 0, set = 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (protocol >= ECORE_X_WM_PROTOCOL_NUM) return;
proto = _ecore_xcb_atoms_wm_protocol[protocol];
+#ifdef OLD_XCB_VERSION
cookie = xcb_get_wm_protocols_unchecked(_ecore_xcb_conn, win, proto);
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;
else
count = protos.atoms_len;
@@ -762,9 +958,15 @@ ecore_x_icccm_protocol_set(Ecore_X_Window win, Ecore_X_WM_Protocol protocol, Ein
for (i = 0; i < count; i++)
atoms[i] = protos.atoms[i];
atoms[count] = proto;
- xcb_set_wm_protocols(_ecore_xcb_conn,
- ECORE_X_ATOM_WM_PROTOCOLS,
+#ifdef OLD_XCB_VERSION
+ xcb_set_wm_protocols(_ecore_xcb_conn,
+ ECORE_X_ATOM_WM_PROTOCOLS,
win, count, atoms);
+#else
+ xcb_icccm_set_wm_protocols(_ecore_xcb_conn,
+ ECORE_X_ATOM_WM_PROTOCOLS,
+ win, count, atoms);
+#endif
free(atoms);
}
}
@@ -782,9 +984,16 @@ ecore_x_icccm_protocol_set(Ecore_X_Window win, Ecore_X_WM_Protocol protocol, Ein
for (j = (i + 1); j < count; j++)
protos.atoms[j - 1] = protos.atoms[j];
if (count > 1)
- xcb_set_wm_protocols(_ecore_xcb_conn,
- ECORE_X_ATOM_WM_PROTOCOLS,
+#ifdef OLD_XCB_VERSION
+ xcb_set_wm_protocols(_ecore_xcb_conn,
+ ECORE_X_ATOM_WM_PROTOCOLS,
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
ecore_x_window_prop_property_del(win,
ECORE_X_ATOM_WM_PROTOCOLS);
@@ -794,7 +1003,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);
+#else
+ xcb_icccm_get_wm_protocols_reply_wipe(&protos);
+#endif
}
/**
@@ -809,7 +1022,11 @@ ecore_x_icccm_protocol_isset(Ecore_X_Window win, Ecore_X_WM_Protocol protocol)
Ecore_X_Atom proto;
Eina_Bool ret = EINA_FALSE;
xcb_get_property_cookie_t cookie;
+#ifdef OLD_XCB_VERSION
xcb_get_wm_protocols_reply_t reply;
+#else
+ xcb_icccm_get_wm_protocols_reply_t reply;
+#endif
uint8_t val = 0;
unsigned int i = 0;
@@ -818,8 +1035,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;
proto = _ecore_xcb_atoms_wm_protocol[protocol];
+#if OLD_XCB_VERSION
cookie = xcb_get_wm_protocols_unchecked(_ecore_xcb_conn, win, proto);
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;
for (i = 0; i < reply.atoms_len; i++)
@@ -829,7 +1051,11 @@ ecore_x_icccm_protocol_isset(Ecore_X_Window win, Ecore_X_WM_Protocol protocol)
break;
}
+#ifdef OLD_XCB_VERSION
xcb_get_wm_protocols_reply_wipe(&reply);
+#else
+ xcb_icccm_get_wm_protocols_reply_wipe(&reply);
+#endif
return ret;
}
@@ -845,18 +1071,22 @@ ecore_x_icccm_protocol_atoms_set(Ecore_X_Window win, Ecore_X_Atom *protos, int n
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (num > 0)
- xcb_set_wm_protocols(_ecore_xcb_conn, ECORE_X_ATOM_WM_PROTOCOLS,
+#ifdef OLD_XCB_VERSION
+ xcb_set_wm_protocols(_ecore_xcb_conn, ECORE_X_ATOM_WM_PROTOCOLS,
win, num, protos);
+#else
+ xcb_icccm_set_wm_protocols(_ecore_xcb_conn, ECORE_X_ATOM_WM_PROTOCOLS,
+ win, num, protos);
+#endif
else
ecore_x_window_prop_property_del(win, ECORE_X_ATOM_WM_PROTOCOLS);
}
EAPI Eina_Bool
-ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win, Eina_Bool *request_pos, Ecore_X_Gravity *gravity, int *min_w, int *min_h, int *max_w, int *max_h, int *base_w, int *base_h, int *step_x, int *step_y, double *min_aspect, double *max_aspect)
+ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win __UNUSED__, Eina_Bool *request_pos, Ecore_X_Gravity *gravity, int *min_w, int *min_h, int *max_w, int *max_h, int *base_w, int *base_h, int *step_x, int *step_y, double *min_aspect, double *max_aspect)
{
xcb_size_hints_t hints;
- xcb_get_property_cookie_t cookie;
uint8_t ret = 0;
int32_t minw = 0, minh = 0;
int32_t maxw = 32767, maxh = 32767;
@@ -879,28 +1109,48 @@ ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win, Eina_Bool *request_pos, Eco
if (min_aspect) *min_aspect = mina;
if (max_aspect) *max_aspect = maxa;
+#ifdef OLD_XCB_VERSION
cookie = xcb_get_wm_normal_hints_unchecked(_ecore_xcb_conn, win);
ret = xcb_get_wm_normal_hints_reply(_ecore_xcb_conn, cookie, &hints, NULL);
+#else
+#endif
if (!ret) return EINA_FALSE;
- if ((hints.flags & XCB_SIZE_HINT_US_POSITION) ||
- (hints.flags & XCB_SIZE_HINT_P_POSITION))
+#ifdef OLD_XCB_VERSION
+ if ((hints.flags & XCB_SIZE_HINT_US_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;
}
+#ifdef OLD_XCB_VERSION
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;
}
+#ifdef OLD_XCB_VERSION
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;
minh = hints.min_height;
}
+#ifdef OLD_XCB_VERSION
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;
maxh = hints.max_height;
@@ -908,7 +1158,11 @@ ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win, Eina_Bool *request_pos, Eco
if (maxh < minh) maxh = minh;
}
+#ifdef OLD_XCB_VERSION
if (hints.flags & XCB_SIZE_HINT_BASE_SIZE)
+#else
+ if (hints.flags & XCB_ICCCM_SIZE_HINT_BASE_SIZE)
+#endif
{
basew = hints.base_width;
baseh = hints.base_height;
@@ -916,7 +1170,11 @@ ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win, Eina_Bool *request_pos, Eco
if (baseh > minh) minh = baseh;
}
+#ifdef OLD_XCB_VERSION
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;
stepy = hints.height_inc;
@@ -924,7 +1182,11 @@ ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win, Eina_Bool *request_pos, Eco
if (stepy < 1) stepy = 1;
}
+#ifdef OLD_XCB_VERSION
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)
mina = ((double)hints.min_aspect_num) / ((double)hints.min_aspect_den);
@@ -956,30 +1218,58 @@ ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win, Eina_Bool request_pos, Ecor
LOGFN(__FILE__, __LINE__, __FUNCTION__);
+#ifdef OLD_XCB_VERSION
cookie = xcb_get_wm_normal_hints_unchecked(_ecore_xcb_conn, win);
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));
hints.flags = 0;
- if (request_pos)
+#ifdef OLD_XCB_VERSION
+ if (request_pos)
hints.flags |= XCB_SIZE_HINT_US_POSITION;
if (gravity != ECORE_X_GRAVITY_NW)
xcb_size_hints_set_win_gravity(&hints, gravity);
- if ((min_w > 0) || (min_h > 0))
+ if ((min_w > 0) || (min_h > 0))
xcb_size_hints_set_min_size(&hints, min_w, min_h);
if ((max_w > 0) || (max_h > 0))
xcb_size_hints_set_max_size(&hints, max_w, max_h);
- if ((base_w > 0) || (base_h > 0))
+ if ((base_w > 0) || (base_h > 0))
xcb_size_hints_set_base_size(&hints, base_w, base_h);
- if ((step_x > 1) || (step_y > 1))
+ if ((step_x > 1) || (step_y > 1))
xcb_size_hints_set_resize_inc(&hints, step_x, step_y);
- if ((min_aspect > 0.0) || (max_aspect > 0.0))
- xcb_size_hints_set_aspect(&hints,
- (int32_t)(min_aspect * 10000), 10000,
+ if ((min_aspect > 0.0) || (max_aspect > 0.0))
+ xcb_size_hints_set_aspect(&hints,
+ (int32_t)(min_aspect * 10000), 10000,
(int32_t)(max_aspect * 10000), 10000);
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
@@ -1019,26 +1309,43 @@ EAPI char *
ecore_x_icccm_client_machine_get(Ecore_X_Window win)
{
xcb_get_property_cookie_t cookie;
+#ifdef OLD_XCB_VERSION
xcb_get_text_property_reply_t prop;
+#else
+ xcb_icccm_get_text_property_reply_t prop;
+#endif
uint8_t ret = 0;
char *tmp = NULL;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
+#ifdef OLD_XCB_VERSION
cookie = xcb_get_wm_client_machine_unchecked(_ecore_xcb_conn, win);
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;
tmp = malloc((prop.name_len + 1) * sizeof(char *));
if (!tmp)
- {
+ {
+#ifdef OLD_XCB_VERSION
xcb_get_text_property_reply_wipe(&prop);
+#else
+ xcb_icccm_get_text_property_reply_wipe(&prop);
+#endif
return NULL;
}
memcpy(tmp, prop.name, sizeof(char *) * prop.name_len);
tmp[prop.name_len] = '\0';
+#ifdef OLD_XCB_VERSION
xcb_get_text_property_reply_wipe(&prop);
+#else
+ xcb_icccm_get_text_property_reply_wipe(&prop);
+#endif
return tmp;
}
diff --git a/ecore/src/lib/ecore_x/xcb/ecore_xcb_window_prop.c b/ecore/src/lib/ecore_x/xcb/ecore_xcb_window_prop.c
index 9961d45..79a5e65 100644
--- a/ecore/src/lib/ecore_x/xcb/ecore_xcb_window_prop.c
+++ b/ecore/src/lib/ecore_x/xcb/ecore_xcb_window_prop.c
@@ -339,9 +339,9 @@ ecore_x_window_prop_property_get(Ecore_X_Window win, Ecore_X_Atom property, Ecor
if (win == 0)
win = ((xcb_screen_t *)_ecore_xcb_screen)->root;
- cookie =
- xcb_get_property_unchecked(_ecore_xcb_conn, 0, win,
- property, type, 0, LONG_MAX);
+ cookie =
+ xcb_get_property_unchecked(_ecore_xcb_conn, 0, win,
+ property, type, 0, UINT32_MAX);
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
if (!reply) return 0;
if ((reply->format != size) || (reply->value_len == 0))
@@ -507,7 +507,11 @@ ecore_x_window_prop_protocol_isset(Ecore_X_Window win, Ecore_X_WM_Protocol proto
{
Eina_Bool ret = EINA_FALSE;
Ecore_X_Atom proto;
+#ifdef OLD_XCB_VERSION
xcb_get_wm_protocols_reply_t protos;
+#else
+ xcb_icccm_get_wm_protocols_reply_t protos;
+#endif
xcb_get_property_cookie_t cookie;
uint8_t reply;
uint32_t count = 0, i = 0;
@@ -517,9 +521,15 @@ 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;
proto = _ecore_xcb_atoms_wm_protocol[protocol];
- cookie = xcb_get_wm_protocols_unchecked(_ecore_xcb_conn, win,
+#ifdef OLD_XCB_VERSION
+ cookie = xcb_get_wm_protocols_unchecked(_ecore_xcb_conn, win,
ECORE_X_ATOM_WM_PROTOCOLS);
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;
count = protos.atoms_len;
@@ -532,14 +542,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);
+#else
+ xcb_icccm_get_wm_protocols_reply_wipe(&protos);
+#endif
return ret;
}
EAPI Ecore_X_WM_Protocol *
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;
+#else
+ xcb_icccm_get_wm_protocols_reply_t protos;
+#endif
xcb_get_property_cookie_t cookie;
uint8_t reply;
uint32_t count = 0, i = 0;
@@ -551,22 +569,36 @@ ecore_x_window_prop_protocol_list_get(Ecore_X_Window win, int *num_ret)
*num_ret = 0;
- cookie = xcb_get_wm_protocols_unchecked(_ecore_xcb_conn, win,
+#ifdef OLD_XCB_VERSION
+ cookie = xcb_get_wm_protocols_unchecked(_ecore_xcb_conn, win,
ECORE_X_ATOM_WM_PROTOCOLS);
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;
count = protos.atoms_len;
if (count <= 0)
{
+#ifdef OLD_XCB_VERSION
xcb_get_wm_protocols_reply_wipe(&protos);
+#else
+ xcb_icccm_get_wm_protocols_reply_wipe(&protos);
+#endif
return NULL;
}
prot_ret = calloc(1, count * sizeof(Ecore_X_WM_Protocol));
if (!prot_ret)
{
+#ifdef OLD_XCB_VERSION
xcb_get_wm_protocols_reply_wipe(&protos);
+#else
+ xcb_icccm_get_wm_protocols_reply_wipe(&protos);
+#endif
return NULL;
}
@@ -584,7 +616,11 @@ ecore_x_window_prop_protocol_list_get(Ecore_X_Window win, int *num_ret)
if (num_ret) *num_ret = count;
+#ifdef OLD_XCB_VERSION
xcb_get_wm_protocols_reply_wipe(&protos);
+#else
+ xcb_icccm_get_wm_protocols_reply_wipe(&protos);
+#endif
return prot_ret;
}
------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts.
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel