From c736dd323d8f11907a8a09dafa887bef5d4e5f01 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Fri, 8 Feb 2013 08:56:00 +0000 Subject: [PATCH] fix ecore_x_screen_is_composited... SVN revision: 83767 --- ChangeLog | 5 +++ NEWS | 1 + src/lib/ecore_x/xcb/ecore_xcb_netwm.c | 46 ++++++++++----------------- src/lib/ecore_x/xlib/ecore_x_netwm.c | 22 ++++--------- 4 files changed, 28 insertions(+), 46 deletions(-) diff --git a/ChangeLog b/ChangeLog index aaea3f4a70..8c84505a36 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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. diff --git a/NEWS b/NEWS index 1b71b71648..dcceef2fce 100644 --- a/NEWS +++ b/NEWS @@ -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. diff --git a/src/lib/ecore_x/xcb/ecore_xcb_netwm.c b/src/lib/ecore_x/xcb/ecore_xcb_netwm.c index ae801d3407..856e27d07f 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_netwm.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_netwm.c @@ -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()); } diff --git a/src/lib/ecore_x/xlib/ecore_x_netwm.c b/src/lib/ecore_x/xlib/ecore_x_netwm.c index 3f08af8b9c..90181fc198 100644 --- a/src/lib/ecore_x/xlib/ecore_x_netwm.c +++ b/src/lib/ecore_x/xlib/ecore_x_netwm.c @@ -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); }