fix ecore_x_screen_is_composited...

SVN revision: 83767
This commit is contained in:
Carsten Haitzler 2013-02-08 08:56:00 +00:00
parent 8acf1ebdf2
commit c736dd323d
4 changed files with 28 additions and 46 deletions

View File

@ -1,3 +1,8 @@
2013-02-08 Carsten Haitzler (The Rasterman)
* Fix ecore_x ecore_x_screen_is_composited/set() to work
properly on multihead.
2013-02-07 Christopher Michael (devilhorns)
* Added ecore_x_randr_crtc_info_free function.

1
NEWS
View File

@ -156,3 +156,4 @@ Fixes:
* Prevent denial of service on eina_hash function.
* Fix return type of function ecore_wl_outputs_get().
* Fix memleak in Eina_File.
* Fix ecore_x_screen_is_composited/set() to work on multihead.

View File

@ -585,34 +585,26 @@ ecore_x_screen_is_composited(int screen)
char buff[32];
xcb_get_selection_owner_cookie_t ocookie;
xcb_get_selection_owner_reply_t *oreply;
xcb_intern_atom_cookie_t acookie;
xcb_intern_atom_reply_t *areply;
Ecore_X_Window win;
static Ecore_X_Atom atom = XCB_NONE;
Ecore_X_Atom atom;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
snprintf(buff, sizeof(buff), "_NET_WM_CM_S%i", screen);
if (atom == XCB_NONE)
{
xcb_intern_atom_cookie_t acookie;
xcb_intern_atom_reply_t *areply;
acookie =
xcb_intern_atom_unchecked(_ecore_xcb_conn, 0, strlen(buff), buff);
areply = xcb_intern_atom_reply(_ecore_xcb_conn, acookie, NULL);
if (!areply) return EINA_FALSE;
atom = areply->atom;
free(areply);
}
acookie = xcb_intern_atom_unchecked(_ecore_xcb_conn, 1, strlen(buff), buff);
areply = xcb_intern_atom_reply(_ecore_xcb_conn, acookie, NULL);
if (!areply) return EINA_FALSE;
atom = areply->atom;
free(areply);
if (atom == XCB_NONE) return EINA_FALSE;
ocookie = xcb_get_selection_owner_unchecked(_ecore_xcb_conn, atom);
oreply = xcb_get_selection_owner_reply(_ecore_xcb_conn, ocookie, NULL);
if (!oreply) return EINA_FALSE;
win = oreply->owner;
free(oreply);
return (win != XCB_NONE) ? EINA_TRUE : EINA_FALSE;
}
@ -620,26 +612,20 @@ EAPI void
ecore_x_screen_is_composited_set(int screen,
Ecore_X_Window win)
{
static Ecore_X_Atom atom = XCB_NONE;
Ecore_X_Atom atom;
xcb_intern_atom_cookie_t acookie;
xcb_intern_atom_reply_t *areply;
char buff[32];
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
snprintf(buff, sizeof(buff), "_NET_WM_CM_S%i", screen);
if (atom == XCB_NONE)
{
xcb_intern_atom_cookie_t acookie;
xcb_intern_atom_reply_t *areply;
acookie =
xcb_intern_atom_unchecked(_ecore_xcb_conn, 0, strlen(buff), buff);
areply = xcb_intern_atom_reply(_ecore_xcb_conn, acookie, NULL);
if (!areply) return;
atom = areply->atom;
free(areply);
}
if (atom == XCB_NONE) return;
acookie = xcb_intern_atom_unchecked(_ecore_xcb_conn, 0, strlen(buff), buff);
areply = xcb_intern_atom_reply(_ecore_xcb_conn, acookie, NULL);
if (!areply) return;
atom = areply->atom;
free(areply);
xcb_set_selection_owner(_ecore_xcb_conn, win, atom,
_ecore_xcb_events_last_time_get());
}

View File

@ -2047,19 +2047,13 @@ EAPI Eina_Bool
ecore_x_screen_is_composited(int screen)
{
Ecore_X_Window win;
static Ecore_X_Atom atom = None;
Ecore_X_Atom atom;
char buf[32];
LOGFN(__FILE__, __LINE__, __FUNCTION__);
snprintf(buf, sizeof(buf), "_NET_WM_CM_S%i", screen);
if (atom == None)
atom = XInternAtom(_ecore_x_disp, buf, False);
if (atom == None)
return EINA_FALSE;
atom = XInternAtom(_ecore_x_disp, buf, True);
if (atom == None) return EINA_FALSE;
win = XGetSelectionOwner(_ecore_x_disp, atom);
return (win != None) ? EINA_TRUE : EINA_FALSE;
}
@ -2067,17 +2061,13 @@ EAPI void
ecore_x_screen_is_composited_set(int screen,
Ecore_X_Window win)
{
static Ecore_X_Atom atom = None;
Ecore_X_Atom atom;
char buf[32];
LOGFN(__FILE__, __LINE__, __FUNCTION__);
snprintf(buf, sizeof(buf), "_NET_WM_CM_S%i", screen);
if (atom == None)
atom = XInternAtom(_ecore_x_disp, buf, False);
if (atom == None)
return;
atom = XInternAtom(_ecore_x_disp, buf, False);
if (atom == None) return;
XSetSelectionOwner(_ecore_x_disp, atom, win, _ecore_x_event_last_time);
}