fix ecore_x_screen_is_composited...
authorCarsten Haitzler <raster@rasterman.com>
Fri, 8 Feb 2013 08:56:00 +0000 (08:56 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Fri, 8 Feb 2013 08:56:00 +0000 (08:56 +0000)
SVN revision: 83767

ChangeLog
NEWS
src/lib/ecore_x/xcb/ecore_xcb_netwm.c
src/lib/ecore_x/xlib/ecore_x_netwm.c

index aaea3f4..8c84505 100644 (file)
--- 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 1b71b71..dcceef2 100644 (file)
--- 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.
index ae801d3..856e27d 100644 (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());
 }
index 3f08af8..90181fc 100644 (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);
 }