ecore: remove useless ECORE_HAVE_EET, remove old XCB code and remove BUILD_ECORE_CON checks as ecore_con is always compiled anyway

SVN revision: 80024
This commit is contained in:
Vincent Torri 2012-12-03 08:35:53 +00:00
parent a154c405e1
commit dc0c272d2f
6 changed files with 11 additions and 427 deletions

View File

@ -2372,11 +2372,6 @@ fi
AM_CONDITIONAL([HAVE_CARES], [test "x${have_cares}" = "xyes"]) AM_CONDITIONAL([HAVE_CARES], [test "x${have_cares}" = "xyes"])
# FIXME: to remove
AC_DEFINE(ECORE_HAVE_EET, 1, [Define if Ecore_Con Eet_Connection helper is supported])
AM_CONDITIONAL([ECORE_HAVE_EET], [true])
PKG_CHECK_MODULES([ECORE_CON], [${requirements_pc_deps_ecore_con}]) PKG_CHECK_MODULES([ECORE_CON], [${requirements_pc_deps_ecore_con}])
case "$host_os" in case "$host_os" in
@ -2574,9 +2569,6 @@ if ! test "x${have_atfile_source}" = "xno" ; then
]) ])
fi fi
# FIXME: remove that
AC_DEFINE([BUILD_ECORE_CON], [1], [Ecore_Con is supported])
### Checks for programs ### Checks for programs
### Checks for libraries ### Checks for libraries

View File

@ -6,14 +6,10 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#ifdef BUILD_ECORE_CON
# include "Ecore_Con.h" # include "Ecore_Con.h"
#endif
#include "ecore_file_private.h" #include "ecore_file_private.h"
#ifdef BUILD_ECORE_CON
#define ECORE_MAGIC_FILE_DOWNLOAD_JOB 0xf7427cb8 #define ECORE_MAGIC_FILE_DOWNLOAD_JOB 0xf7427cb8
#define ECORE_FILE_DOWNLOAD_TIMEOUT 30 #define ECORE_FILE_DOWNLOAD_TIMEOUT 30
@ -47,12 +43,9 @@ static Eina_List *_job_list;
static int download_init = 0; static int download_init = 0;
#endif /* BUILD_ECORE_CON */
int int
ecore_file_download_init(void) ecore_file_download_init(void)
{ {
#ifdef BUILD_ECORE_CON
download_init++; download_init++;
if (download_init > 1) return 1; if (download_init > 1) return 1;
if (!ecore_con_init()) return 0; if (!ecore_con_init()) return 0;
@ -61,18 +54,16 @@ ecore_file_download_init(void)
ecore_con_shutdown(); ecore_con_shutdown();
return 0; return 0;
} }
# ifdef HAVE_CURL #ifdef HAVE_CURL
_url_complete_handler = ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE, _ecore_file_download_url_complete_cb, NULL); _url_complete_handler = ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE, _ecore_file_download_url_complete_cb, NULL);
_url_progress_download = ecore_event_handler_add(ECORE_CON_EVENT_URL_PROGRESS, _ecore_file_download_url_progress_cb, NULL); _url_progress_download = ecore_event_handler_add(ECORE_CON_EVENT_URL_PROGRESS, _ecore_file_download_url_progress_cb, NULL);
# endif #endif
#endif /* BUILD_ECORE_CON */
return 1; return 1;
} }
void void
ecore_file_download_shutdown(void) ecore_file_download_shutdown(void)
{ {
#ifdef BUILD_ECORE_CON
download_init--; download_init--;
if (download_init > 0) return; if (download_init > 0) return;
if (_url_complete_handler) if (_url_complete_handler)
@ -84,10 +75,8 @@ ecore_file_download_shutdown(void)
ecore_file_download_abort_all(); ecore_file_download_abort_all();
ecore_con_url_shutdown(); ecore_con_url_shutdown();
ecore_con_shutdown(); ecore_con_shutdown();
#endif /* BUILD_ECORE_CON */
} }
#ifdef BUILD_ECORE_CON
# ifdef HAVE_CURL # ifdef HAVE_CURL
static Eina_Bool static Eina_Bool
_ecore_file_download_headers_foreach_cb(const Eina_Hash *hash EINA_UNUSED, const void *key, void *data, void *fdata) _ecore_file_download_headers_foreach_cb(const Eina_Hash *hash EINA_UNUSED, const void *key, void *data, void *fdata)
@ -98,7 +87,6 @@ _ecore_file_download_headers_foreach_cb(const Eina_Hash *hash EINA_UNUSED, const
return EINA_TRUE; return EINA_TRUE;
} }
# endif # endif
#endif
static Eina_Bool static Eina_Bool
_ecore_file_download(const char *url, _ecore_file_download(const char *url,
@ -109,7 +97,6 @@ _ecore_file_download(const char *url,
Ecore_File_Download_Job **job_ret, Ecore_File_Download_Job **job_ret,
Eina_Hash *headers) Eina_Hash *headers)
{ {
#ifdef BUILD_ECORE_CON
if (!url) if (!url)
{ {
CRIT("Download URL is null"); CRIT("Download URL is null");
@ -142,7 +129,7 @@ _ecore_file_download(const char *url,
url = strchr(url, '/'); url = strchr(url, '/');
return ecore_file_cp(url, dst); return ecore_file_cp(url, dst);
} }
# ifdef HAVE_CURL #ifdef HAVE_CURL
else if ((!strncmp(url, "http://", 7)) || (!strncmp(url, "https://", 8)) || else if ((!strncmp(url, "http://", 7)) || (!strncmp(url, "https://", 8)) ||
(!strncmp(url, "ftp://", 6))) (!strncmp(url, "ftp://", 6)))
{ {
@ -160,7 +147,7 @@ _ecore_file_download(const char *url,
} }
return job ? EINA_TRUE : EINA_FALSE; return job ? EINA_TRUE : EINA_FALSE;
} }
# else #else
else if ((!strncmp(url, "http://", 7)) || (!strncmp(url, "https://", 8)) || else if ((!strncmp(url, "http://", 7)) || (!strncmp(url, "https://", 8)) ||
(!strncmp(url, "ftp://", 6))) (!strncmp(url, "ftp://", 6)))
{ {
@ -171,21 +158,11 @@ _ecore_file_download(const char *url,
(void)headers; (void)headers;
return EINA_FALSE; return EINA_FALSE;
} }
# endif #endif
else else
{ {
return EINA_FALSE; return EINA_FALSE;
} }
#else
(void)url;
(void)dst;
(void)completion_cb;
(void)progress_cb;
(void)data;
(void)job_ret;
(void)headers;
return EINA_FALSE;
#endif /* BUILD_ECORE_CON */
} }
/** /**
@ -272,21 +249,15 @@ ecore_file_download_full(const char *url,
EAPI Eina_Bool EAPI Eina_Bool
ecore_file_download_protocol_available(const char *protocol) ecore_file_download_protocol_available(const char *protocol)
{ {
#ifdef BUILD_ECORE_CON
if (!strncmp(protocol, "file://", 7)) return EINA_TRUE; if (!strncmp(protocol, "file://", 7)) return EINA_TRUE;
# ifdef HAVE_CURL #ifdef HAVE_CURL
else if (!strncmp(protocol, "http://", 7)) return EINA_TRUE; else if (!strncmp(protocol, "http://", 7)) return EINA_TRUE;
else if (!strncmp(protocol, "ftp://", 6)) return EINA_TRUE; else if (!strncmp(protocol, "ftp://", 6)) return EINA_TRUE;
# endif #endif
#else
(void)protocol;
#endif /* BUILD_ECORE_CON */
return EINA_FALSE; return EINA_FALSE;
} }
#ifdef BUILD_ECORE_CON
# ifdef HAVE_CURL # ifdef HAVE_CURL
static int static int
_ecore_file_download_url_compare_job(const void *data1, const void *data2) _ecore_file_download_url_compare_job(const void *data1, const void *data2)
@ -397,7 +368,6 @@ _ecore_file_download_curl(const char *url, const char *dst,
return job; return job;
} }
# endif
#endif #endif
/** /**
@ -418,17 +388,15 @@ ecore_file_download_abort(Ecore_File_Download_Job *job)
if (!job) if (!job)
return; return;
#ifdef BUILD_ECORE_CON
if (job->completion_cb) if (job->completion_cb)
job->completion_cb(ecore_con_url_data_get(job->url_con), job->dst, 1); job->completion_cb(ecore_con_url_data_get(job->url_con), job->dst, 1);
# ifdef HAVE_CURL #ifdef HAVE_CURL
ecore_con_url_free(job->url_con); ecore_con_url_free(job->url_con);
# endif #endif
_job_list = eina_list_remove(_job_list, job); _job_list = eina_list_remove(_job_list, job);
fclose(job->file); fclose(job->file);
free(job->dst); free(job->dst);
free(job); free(job);
#endif /* BUILD_ECORE_CON */
} }
/** /**
@ -442,12 +410,10 @@ ecore_file_download_abort(Ecore_File_Download_Job *job)
EAPI void EAPI void
ecore_file_download_abort_all(void) ecore_file_download_abort_all(void)
{ {
#ifdef BUILD_ECORE_CON
Ecore_File_Download_Job *job; Ecore_File_Download_Job *job;
EINA_LIST_FREE(_job_list, job) EINA_LIST_FREE(_job_list, job)
ecore_file_download_abort(job); ecore_file_download_abort(job);
#endif /* BUILD_ECORE_CON */
} }
/** /**

View File

@ -83,17 +83,10 @@ _ecore_xcb_error_handle(xcb_generic_error_t *err)
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)
WRN("\tBad Value: %d", ((xcb_value_error_t *)err)->bad_value);
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) if (err->error_code == XCB_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_WINDOW) else if (err->error_code == XCB_WINDOW)
WRN("\tBad Window: %d", ((xcb_window_error_t *)err)->bad_value); 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

@ -294,22 +294,6 @@ _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;
else if (err->error_code == XCB_EVENT_ERROR_BAD_MATCH)
{
if ((err->major_code == XCB_SET_INPUT_FOCUS) ||
(err->major_code == XCB_CONFIGURE_WINDOW))
return;
}
else if (err->error_code == XCB_EVENT_ERROR_BAD_VALUE)
{
if ((err->major_code == XCB_KILL_CLIENT) ||
(err->major_code == XCB_GRAB_BUTTON) ||
(err->major_code == XCB_UNGRAB_BUTTON))
return;
}
#else
if (err->error_code == XCB_WINDOW) return; if (err->error_code == XCB_WINDOW) return;
else if (err->error_code == XCB_MATCH) else if (err->error_code == XCB_MATCH)
{ {
@ -324,7 +308,6 @@ _ecore_xcb_events_handle(xcb_generic_event_t *ev)
(err->major_code == XCB_UNGRAB_BUTTON)) (err->major_code == XCB_UNGRAB_BUTTON))
return; 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);
@ -1679,13 +1662,8 @@ _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) &&
(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) && else if ((ev->type == ECORE_X_ATOM_WM_CHANGE_STATE) && (ev->format == 32) &&
(ev->data.data32[0] == XCB_ICCCM_WM_STATE_ICONIC)) (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

@ -166,11 +166,7 @@ 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;
#else
xcb_icccm_get_text_property_reply_t prop; xcb_icccm_get_text_property_reply_t prop;
#endif
uint8_t ret = 0; uint8_t ret = 0;
char *title = NULL; char *title = NULL;
@ -178,31 +174,18 @@ ecore_x_icccm_title_get(Ecore_X_Window win)
CHECK_XCB_CONN; CHECK_XCB_CONN;
if (!win) return NULL; 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); cookie = xcb_icccm_get_wm_name_unchecked(_ecore_xcb_conn, win);
ret = xcb_icccm_get_wm_name_reply(_ecore_xcb_conn, cookie, &prop, NULL); 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);
#else
xcb_icccm_get_text_property_reply_wipe(&prop); 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);
#else
xcb_icccm_get_text_property_reply_wipe(&prop); 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);
@ -232,11 +215,7 @@ ecore_x_icccm_title_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); xcb_icccm_get_text_property_reply_wipe(&prop);
#endif
return title; return title;
} }
@ -266,23 +245,13 @@ ecore_x_icccm_title_set(Ecore_X_Window win,
if (ret) if (ret)
{ {
#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, xcb_icccm_set_wm_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING, 8,
strlen(prop.value), prop.value); 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_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, xcb_icccm_set_wm_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING, 8,
strlen(title), title); strlen(title), title);
#endif
free(list[0]); free(list[0]);
} }
@ -300,11 +269,7 @@ ecore_x_icccm_name_class_get(Ecore_X_Window win,
char **class) 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;
#else
xcb_icccm_get_wm_class_reply_t prop; 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__);
@ -313,23 +278,14 @@ ecore_x_icccm_name_class_get(Ecore_X_Window win,
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);
ret = xcb_get_wm_class_reply(_ecore_xcb_conn, cookie, &prop, NULL);
#else
cookie = xcb_icccm_get_wm_class_unchecked(_ecore_xcb_conn, win); cookie = xcb_icccm_get_wm_class_unchecked(_ecore_xcb_conn, win);
ret = xcb_icccm_get_wm_class_reply(_ecore_xcb_conn, cookie, &prop, NULL); 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);
#else
xcb_icccm_get_wm_class_reply_wipe(&prop); xcb_icccm_get_wm_class_reply_wipe(&prop);
#endif
} }
/** /**
@ -420,13 +376,8 @@ ecore_x_icccm_transient_for_get(Ecore_X_Window win)
LOGFN(__FILE__, __LINE__, __FUNCTION__); LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN; CHECK_XCB_CONN;
#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); 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); xcb_icccm_get_wm_transient_for_reply(_ecore_xcb_conn, cookie, &forwin, NULL);
#endif
return forwin; return forwin;
} }
@ -519,25 +470,6 @@ 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])
{
case XCB_WM_STATE_WITHDRAWN:
hint = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
break;
case XCB_WM_STATE_NORMAL:
hint = ECORE_X_WINDOW_STATE_HINT_NORMAL;
break;
case XCB_WM_STATE_ICONIC:
hint = ECORE_X_WINDOW_STATE_HINT_ICONIC;
break;
default:
break;
}
#else
switch (prop[0]) switch (prop[0])
{ {
case XCB_ICCCM_WM_STATE_WITHDRAWN: case XCB_ICCCM_WM_STATE_WITHDRAWN:
@ -555,7 +487,6 @@ ecore_x_icccm_state_get(Ecore_X_Window win)
default: default:
break; break;
} }
#endif
free(reply); free(reply);
return hint; return hint;
@ -565,29 +496,11 @@ EAPI void
ecore_x_icccm_state_set(Ecore_X_Window win, ecore_x_icccm_state_set(Ecore_X_Window win,
Ecore_X_Window_State_Hint state) Ecore_X_Window_State_Hint state)
{ {
#ifdef OLD_XCB_VERSION
xcb_wm_hints_t hints;
#else
xcb_icccm_wm_hints_t hints; xcb_icccm_wm_hints_t hints;
#endif
LOGFN(__FILE__, __LINE__, __FUNCTION__); LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN; CHECK_XCB_CONN;
#ifdef OLD_XCB_VERSION
xcb_wm_hints_set_none(&hints);
hints.flags = XCB_WM_HINT_STATE;
if (state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN)
xcb_wm_hints_set_withdrawn(&hints);
else if (state == ECORE_X_WINDOW_STATE_HINT_NORMAL)
xcb_wm_hints_set_normal(&hints);
else if (state == ECORE_X_WINDOW_STATE_HINT_ICONIC)
xcb_wm_hints_set_iconic(&hints);
xcb_set_wm_hints(_ecore_xcb_conn, win, &hints);
#else
xcb_icccm_wm_hints_set_none(&hints); xcb_icccm_wm_hints_set_none(&hints);
hints.flags = XCB_ICCCM_WM_HINT_STATE; hints.flags = XCB_ICCCM_WM_HINT_STATE;
@ -600,7 +513,6 @@ ecore_x_icccm_state_set(Ecore_X_Window win,
xcb_icccm_wm_hints_set_iconic(&hints); xcb_icccm_wm_hints_set_iconic(&hints);
xcb_icccm_set_wm_hints(_ecore_xcb_conn, win, &hints); xcb_icccm_set_wm_hints(_ecore_xcb_conn, win, &hints);
#endif
} }
EAPI void EAPI void
@ -623,34 +535,11 @@ ecore_x_icccm_hints_set(Ecore_X_Window win,
Ecore_X_Window window_group, Ecore_X_Window window_group,
Eina_Bool is_urgent) Eina_Bool is_urgent)
{ {
#ifdef OLD_XCB_VERSION
xcb_wm_hints_t hints;
#else
xcb_icccm_wm_hints_t hints; xcb_icccm_wm_hints_t hints;
#endif
LOGFN(__FILE__, __LINE__, __FUNCTION__); LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN; CHECK_XCB_CONN;
#ifdef OLD_XCB_VERSION
xcb_wm_hints_set_none(&hints);
xcb_wm_hints_set_input(&hints, accepts_focus);
if (initial_state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN)
xcb_wm_hints_set_withdrawn(&hints);
else if (initial_state == ECORE_X_WINDOW_STATE_HINT_NORMAL)
xcb_wm_hints_set_normal(&hints);
else if (initial_state == ECORE_X_WINDOW_STATE_HINT_ICONIC)
xcb_wm_hints_set_iconic(&hints);
if (icon_pixmap != 0) xcb_wm_hints_set_icon_pixmap(&hints, icon_pixmap);
if (icon_mask != 0) xcb_wm_hints_set_icon_mask(&hints, icon_mask);
if (icon_window != 0) xcb_wm_hints_set_icon_window(&hints, icon_window);
if (window_group != 0) xcb_wm_hints_set_window_group(&hints, window_group);
if (is_urgent) xcb_wm_hints_set_urgency(&hints);
xcb_set_wm_hints(_ecore_xcb_conn, win, &hints);
#else
xcb_icccm_wm_hints_set_none(&hints); xcb_icccm_wm_hints_set_none(&hints);
xcb_icccm_wm_hints_set_input(&hints, accepts_focus); xcb_icccm_wm_hints_set_input(&hints, accepts_focus);
@ -673,7 +562,6 @@ ecore_x_icccm_hints_set(Ecore_X_Window win,
xcb_icccm_wm_hints_set_urgency(&hints); xcb_icccm_wm_hints_set_urgency(&hints);
xcb_icccm_set_wm_hints(_ecore_xcb_conn, win, &hints); xcb_icccm_set_wm_hints(_ecore_xcb_conn, win, &hints);
#endif
} }
EAPI Eina_Bool EAPI Eina_Bool
@ -687,11 +575,7 @@ ecore_x_icccm_hints_get(Ecore_X_Window win,
Eina_Bool *is_urgent) 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;
#else
xcb_icccm_wm_hints_t hints; xcb_icccm_wm_hints_t hints;
#endif
uint8_t ret = 0; uint8_t ret = 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__); LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -705,22 +589,12 @@ ecore_x_icccm_hints_get(Ecore_X_Window win,
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);
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); xcb_icccm_wm_hints_set_none(&hints);
cookie = xcb_icccm_get_wm_hints_unchecked(_ecore_xcb_conn, win); cookie = xcb_icccm_get_wm_hints_unchecked(_ecore_xcb_conn, win);
ret = xcb_icccm_get_wm_hints_reply(_ecore_xcb_conn, cookie, &hints, NULL); 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))
#else
if ((hints.flags & XCB_ICCCM_WM_HINT_INPUT) && (accepts_focus)) 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;
@ -728,32 +602,6 @@ ecore_x_icccm_hints_get(Ecore_X_Window win,
*accepts_focus = EINA_FALSE; *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)
*initial_state = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
else if (hints.initial_state == XCB_WM_STATE_NORMAL)
*initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL;
else if (hints.initial_state == XCB_WM_STATE_ICONIC)
*initial_state = ECORE_X_WINDOW_STATE_HINT_ICONIC;
}
if ((hints.flags & XCB_WM_HINT_ICON_PIXMAP) && (icon_pixmap))
*icon_pixmap = hints.icon_pixmap;
if ((hints.flags & XCB_WM_HINT_ICON_MASK) && (icon_mask))
*icon_mask = hints.icon_mask;
if ((hints.flags & XCB_WM_HINT_ICON_WINDOW) && (icon_window))
*icon_window = hints.icon_window;
if ((hints.flags & XCB_WM_HINT_WINDOW_GROUP) && (window_group))
*window_group = hints.window_group;
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.flags & XCB_ICCCM_WM_HINT_STATE) && (initial_state))
{ {
if (hints.initial_state == XCB_ICCCM_WM_STATE_WITHDRAWN) if (hints.initial_state == XCB_ICCCM_WM_STATE_WITHDRAWN)
@ -778,7 +626,6 @@ ecore_x_icccm_hints_get(Ecore_X_Window win,
if ((hints.flags & XCB_ICCCM_WM_HINT_X_URGENCY) && (is_urgent)) if ((hints.flags & XCB_ICCCM_WM_HINT_X_URGENCY) && (is_urgent))
*is_urgent = EINA_TRUE; *is_urgent = EINA_TRUE;
#endif
return EINA_TRUE; return EINA_TRUE;
} }
@ -794,11 +641,7 @@ 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;
#else
xcb_icccm_get_text_property_reply_t prop; xcb_icccm_get_text_property_reply_t prop;
#endif
uint8_t ret = 0; uint8_t ret = 0;
char *tmp = NULL; char *tmp = NULL;
@ -807,32 +650,19 @@ 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);
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); 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); 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);
#else
xcb_icccm_get_text_property_reply_wipe(&prop); 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);
#else
xcb_icccm_get_text_property_reply_wipe(&prop); 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);
@ -862,11 +692,7 @@ 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); xcb_icccm_get_text_property_reply_wipe(&prop);
#endif
return tmp; return tmp;
} }
@ -903,23 +729,13 @@ ecore_x_icccm_icon_name_set(Ecore_X_Window win,
if (ret) if (ret)
{ {
#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, xcb_icccm_set_wm_icon_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
8, strlen(prop.value), prop.value); 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,
strlen(name), name);
#else
xcb_icccm_set_wm_icon_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING, xcb_icccm_set_wm_icon_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
8, strlen(name), name); 8, strlen(name), name);
#endif
free(list[0]); free(list[0]);
} }
@ -942,11 +758,7 @@ ecore_x_icccm_iconic_request_send(Ecore_X_Window win,
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;
#else
ev.data.data32[0] = XCB_ICCCM_WM_STATE_ICONIC; 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 |
@ -968,11 +780,7 @@ ecore_x_icccm_protocol_set(Ecore_X_Window win,
{ {
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;
#else
xcb_icccm_get_wm_protocols_reply_t protos; 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__);
@ -980,13 +788,8 @@ ecore_x_icccm_protocol_set(Ecore_X_Window win,
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);
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); 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)) 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;
@ -1012,15 +815,9 @@ ecore_x_icccm_protocol_set(Ecore_X_Window win,
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,
ECORE_X_ATOM_WM_PROTOCOLS,
win, count, atoms);
#else
xcb_icccm_set_wm_protocols(_ecore_xcb_conn, win, xcb_icccm_set_wm_protocols(_ecore_xcb_conn, win,
ECORE_X_ATOM_WM_PROTOCOLS, ECORE_X_ATOM_WM_PROTOCOLS,
count, atoms); count, atoms);
#endif
free(atoms); free(atoms);
} }
} }
@ -1038,15 +835,9 @@ ecore_x_icccm_protocol_set(Ecore_X_Window win,
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,
ECORE_X_ATOM_WM_PROTOCOLS,
win, count - 1, protos.atoms);
#else
xcb_icccm_set_wm_protocols(_ecore_xcb_conn, win, xcb_icccm_set_wm_protocols(_ecore_xcb_conn, win,
ECORE_X_ATOM_WM_PROTOCOLS, ECORE_X_ATOM_WM_PROTOCOLS,
count - 1, protos.atoms); 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);
@ -1056,11 +847,7 @@ ecore_x_icccm_protocol_set(Ecore_X_Window win,
} }
} }
#ifdef OLD_XCB_VERSION
xcb_get_wm_protocols_reply_wipe(&protos);
#else
xcb_icccm_get_wm_protocols_reply_wipe(&protos); xcb_icccm_get_wm_protocols_reply_wipe(&protos);
#endif
} }
/** /**
@ -1076,11 +863,7 @@ ecore_x_icccm_protocol_isset(Ecore_X_Window win,
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;
#else
xcb_icccm_get_wm_protocols_reply_t reply; 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;
@ -1090,13 +873,8 @@ ecore_x_icccm_protocol_isset(Ecore_X_Window win,
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);
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); 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); 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++)
@ -1106,11 +884,7 @@ ecore_x_icccm_protocol_isset(Ecore_X_Window win,
break; break;
} }
#ifdef OLD_XCB_VERSION
xcb_get_wm_protocols_reply_wipe(&reply);
#else
xcb_icccm_get_wm_protocols_reply_wipe(&reply); xcb_icccm_get_wm_protocols_reply_wipe(&reply);
#endif
return ret; return ret;
} }
@ -1130,13 +904,8 @@ ecore_x_icccm_protocol_atoms_set(Ecore_X_Window win,
CHECK_XCB_CONN; CHECK_XCB_CONN;
if (num > 0) if (num > 0)
#ifdef OLD_XCB_VERSION xcb_icccm_set_wm_protocols(_ecore_xcb_conn, win,
xcb_set_wm_protocols(_ecore_xcb_conn, ECORE_X_ATOM_WM_PROTOCOLS,
win, num, protos);
#else
xcb_icccm_set_wm_protocols(_ecore_xcb_conn, win,
ECORE_X_ATOM_WM_PROTOCOLS, num, protos); ECORE_X_ATOM_WM_PROTOCOLS, 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);
} }
@ -1181,51 +950,29 @@ ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win,
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);
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); cookie = xcb_icccm_get_wm_normal_hints_unchecked(_ecore_xcb_conn, win);
ret = xcb_icccm_get_wm_normal_hints_reply(_ecore_xcb_conn, cookie, ret = xcb_icccm_get_wm_normal_hints_reply(_ecore_xcb_conn, cookie,
&hints, NULL); &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) ||
(hints.flags & XCB_SIZE_HINT_P_POSITION))
#else
if ((hints.flags & XCB_ICCCM_SIZE_HINT_US_POSITION) || if ((hints.flags & XCB_ICCCM_SIZE_HINT_US_POSITION) ||
(hints.flags & XCB_ICCCM_SIZE_HINT_P_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)
#else
if (hints.flags & XCB_ICCCM_SIZE_HINT_P_WIN_GRAVITY) 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)
#else
if (hints.flags & XCB_ICCCM_SIZE_HINT_P_MIN_SIZE) 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)
#else
if (hints.flags & XCB_ICCCM_SIZE_HINT_P_MAX_SIZE) 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;
@ -1233,11 +980,7 @@ ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win,
if (maxh < minh) maxh = minh; 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) 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;
@ -1245,11 +988,7 @@ ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win,
if (baseh > minh) minh = baseh; 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) 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;
@ -1257,11 +996,7 @@ ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win,
if (stepy < 1) stepy = 1; 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) 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);
@ -1306,39 +1041,13 @@ ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win,
LOGFN(__FILE__, __LINE__, __FUNCTION__); LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN; CHECK_XCB_CONN;
#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); cookie = xcb_icccm_get_wm_normal_hints_unchecked(_ecore_xcb_conn, win);
ret = xcb_icccm_get_wm_normal_hints_reply(_ecore_xcb_conn, cookie, ret = xcb_icccm_get_wm_normal_hints_reply(_ecore_xcb_conn, cookie,
&hints, NULL); &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)
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))
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))
xcb_size_hints_set_base_size(&hints, base_w, base_h);
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,
(int32_t)(max_aspect * 10000), 10000);
xcb_set_wm_normal_hints(_ecore_xcb_conn, win, &hints);
#else
if (request_pos) if (request_pos)
hints.flags |= XCB_ICCCM_SIZE_HINT_US_POSITION; hints.flags |= XCB_ICCCM_SIZE_HINT_US_POSITION;
@ -1358,7 +1067,6 @@ ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win,
(int32_t)(max_aspect * 10000), 10000); (int32_t)(max_aspect * 10000), 10000);
xcb_icccm_set_wm_normal_hints(_ecore_xcb_conn, win, &hints); xcb_icccm_set_wm_normal_hints(_ecore_xcb_conn, win, &hints);
#endif
} }
EAPI void EAPI void
@ -1404,45 +1112,28 @@ 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;
#else
xcb_icccm_get_text_property_reply_t prop; 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__);
CHECK_XCB_CONN; CHECK_XCB_CONN;
#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); cookie = xcb_icccm_get_wm_client_machine_unchecked(_ecore_xcb_conn, win);
ret = xcb_icccm_get_wm_client_machine_reply(_ecore_xcb_conn, cookie, ret = xcb_icccm_get_wm_client_machine_reply(_ecore_xcb_conn, cookie,
&prop, NULL); &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);
#else
xcb_icccm_get_text_property_reply_wipe(&prop); 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);
#else
xcb_icccm_get_text_property_reply_wipe(&prop); xcb_icccm_get_text_property_reply_wipe(&prop);
#endif
return tmp; return tmp;
} }
@ -1566,4 +1257,3 @@ ecore_x_icccm_colormap_window_unset(Ecore_X_Window win,
} }
if (odata) free(odata); if (odata) free(odata);
} }

View File

@ -560,11 +560,7 @@ ecore_x_window_prop_protocol_isset(Ecore_X_Window win,
{ {
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;
#else
xcb_icccm_get_wm_protocols_reply_t protos; 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;
@ -575,16 +571,10 @@ ecore_x_window_prop_protocol_isset(Ecore_X_Window win,
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,
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, cookie = xcb_icccm_get_wm_protocols_unchecked(_ecore_xcb_conn, win,
ECORE_X_ATOM_WM_PROTOCOLS); ECORE_X_ATOM_WM_PROTOCOLS);
reply = xcb_icccm_get_wm_protocols_reply(_ecore_xcb_conn, cookie, reply = xcb_icccm_get_wm_protocols_reply(_ecore_xcb_conn, cookie,
&protos, NULL); &protos, NULL);
#endif
if (!reply) return EINA_FALSE; if (!reply) return EINA_FALSE;
count = protos.atoms_len; count = protos.atoms_len;
@ -597,11 +587,8 @@ ecore_x_window_prop_protocol_isset(Ecore_X_Window win,
} }
} }
#ifdef OLD_XCB_VERSION
xcb_get_wm_protocols_reply_wipe(&protos);
#else
xcb_icccm_get_wm_protocols_reply_wipe(&protos); xcb_icccm_get_wm_protocols_reply_wipe(&protos);
#endif
return ret; return ret;
} }
@ -609,11 +596,7 @@ EAPI Ecore_X_WM_Protocol *
ecore_x_window_prop_protocol_list_get(Ecore_X_Window win, ecore_x_window_prop_protocol_list_get(Ecore_X_Window win,
int *num_ret) int *num_ret)
{ {
#ifdef OLD_XCB_VERSION
xcb_get_wm_protocols_reply_t protos;
#else
xcb_icccm_get_wm_protocols_reply_t protos; 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;
@ -626,37 +609,23 @@ ecore_x_window_prop_protocol_list_get(Ecore_X_Window win,
*num_ret = 0; *num_ret = 0;
#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, cookie = xcb_icccm_get_wm_protocols_unchecked(_ecore_xcb_conn, win,
ECORE_X_ATOM_WM_PROTOCOLS); ECORE_X_ATOM_WM_PROTOCOLS);
reply = xcb_icccm_get_wm_protocols_reply(_ecore_xcb_conn, cookie, reply = xcb_icccm_get_wm_protocols_reply(_ecore_xcb_conn, cookie,
&protos, NULL); &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);
#else
xcb_icccm_get_wm_protocols_reply_wipe(&protos); 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);
#else
xcb_icccm_get_wm_protocols_reply_wipe(&protos); xcb_icccm_get_wm_protocols_reply_wipe(&protos);
#endif
return NULL; return NULL;
} }
@ -674,11 +643,7 @@ ecore_x_window_prop_protocol_list_get(Ecore_X_Window win,
if (num_ret) *num_ret = count; 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); xcb_icccm_get_wm_protocols_reply_wipe(&protos);
#endif
return prot_ret; return prot_ret;
} }