[clutter] cally-actor: Don't assume X11 backend is used when supported



commit 38c4807230ad24fd5fb1a154cdff18493fda9760
Author: Florian Müllner <fmuellner gnome org>
Date:   Sat Mar 21 16:43:09 2015 +0100

    cally-actor: Don't assume X11 backend is used when supported
    
    _cally_actor_get_top_level_origin() uses a compile time check
    without runtime check, which will obviously fail when another
    backend like wayland is used.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=746575

 clutter/cally/cally-actor.c |   81 ++++++++++++++++++++++---------------------
 1 files changed, 41 insertions(+), 40 deletions(-)
---
diff --git a/clutter/cally/cally-actor.c b/clutter/cally/cally-actor.c
index 7783e5f..6c861ad 100644
--- a/clutter/cally/cally-actor.c
+++ b/clutter/cally/cally-actor.c
@@ -74,7 +74,7 @@
 #include <glib.h>
 #include <clutter/clutter.h>
 
-#ifdef HAVE_CLUTTER_GLX
+#ifdef CLUTTER_WINDOWING_X11
 #include <clutter/x11/clutter-x11.h>
 #endif
 
@@ -754,51 +754,52 @@ _cally_actor_get_top_level_origin (ClutterActor *actor,
   gint x = 0;
   gint y = 0;
 
-#ifdef HAVE_CLUTTER_GLX
-  {
-    ClutterActor *stage      = NULL;
-    Display      *display    = NULL;
-    Window        root_window;
-    Window        stage_window;
-    Window        child;
-    gint          return_val = 0;
-
-    stage = clutter_actor_get_stage (actor);
-
-    /* FIXME: what happens if you use another display with
-       clutter_backend_x11_set_display ?*/
-    display = clutter_x11_get_default_display ();
-    root_window = clutter_x11_get_root_window ();
-    stage_window = clutter_x11_get_stage_window (CLUTTER_STAGE (stage));
-
-    return_val = XTranslateCoordinates (display, stage_window, root_window,
-                                        0, 0, &x, &y,
-                                        &child);
-
-    if (!return_val)
-      g_warning ("[x11] We were not able to get proper absolute "
-                 "position of the stage");
-  }
+#ifdef CLUTTER_WINDOWING_X11
+  if (clutter_check_windowing_backend (CLUTTER_WINDOWING_X11))
+    {
+      ClutterActor *stage      = NULL;
+      Display *display    = NULL;
+      Window root_window;
+      Window stage_window;
+      Window child;
+      gint return_val = 0;
+
+      stage = clutter_actor_get_stage (actor);
+
+      /* FIXME: what happens if you use another display with
+         clutter_backend_x11_set_display ?*/
+      display = clutter_x11_get_default_display ();
+      root_window = clutter_x11_get_root_window ();
+      stage_window = clutter_x11_get_stage_window (CLUTTER_STAGE (stage));
+
+      return_val = XTranslateCoordinates (display, stage_window, root_window,
+                                          0, 0, &x, &y,
+                                          &child);
+
+      if (!return_val)
+        g_warning ("[x11] We were not able to get proper absolute "
+                   "position of the stage");
+    }
+  else
 #else
-  {
-    static gboolean yet_warned = FALSE;
-
-    if (!yet_warned)
-      {
-        yet_warned = TRUE;
-
-        g_warning ("Using a clutter backend not supported. "
-                   "atk_component_get_extents using ATK_XY_SCREEN "
-                   "could return a wrong screen position");
-      }
-  }
+    {
+      static gboolean yet_warned = FALSE;
+
+      if (!yet_warned)
+        {
+          yet_warned = TRUE;
+
+          g_warning ("The current Clutter backend does not support using "
+                     "atk_component_get_extents() with ATK_XY_SCREEN.");
+        }
+    }
 #endif
 
   if (xp)
-      *xp = x;
+    *xp = x;
 
   if (yp)
-      *yp = y;
+    *yp = y;
 }
 
 /* AtkAction implementation */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]