[clutter/multi-backend: 5/15] Cosmetic fixes



commit 776f11500f00a2330f276b36cc9be7b6a55a9e88
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Tue Sep 27 13:24:52 2011 +0100

    Cosmetic fixes

 clutter/x11/clutter-backend-x11.c |  143 +++++++++++++++++++------------------
 1 files changed, 72 insertions(+), 71 deletions(-)
---
diff --git a/clutter/x11/clutter-backend-x11.c b/clutter/x11/clutter-backend-x11.c
index 0aa3966..9b58927 100644
--- a/clutter/x11/clutter-backend-x11.c
+++ b/clutter/x11/clutter-backend-x11.c
@@ -339,11 +339,14 @@ _clutter_backend_x11_post_parse (ClutterBackend  *backend,
                                  GError         **error)
 {
   ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend);
+  ClutterSettings *settings;
+  Atom atoms[N_ATOM_NAMES];
+  double dpi;
 
   if (_foreign_dpy)
     backend_x11->xdpy = _foreign_dpy;
-  /*
-   * Only open connection if not already set by prior call to
+
+  /* Only open connection if not already set by prior call to
    * clutter_x11_set_display()
    */
   if (backend_x11->xdpy == NULL)
@@ -376,78 +379,72 @@ _clutter_backend_x11_post_parse (ClutterBackend  *backend,
 
   g_assert (backend_x11->xdpy != NULL);
 
-    {
-      ClutterSettings *settings;
-      Atom atoms[N_ATOM_NAMES];
-      double dpi;
+  CLUTTER_NOTE (BACKEND, "Getting the X screen");
 
-      CLUTTER_NOTE (BACKEND, "Getting the X screen");
+  settings = clutter_settings_get_default ();
 
-      settings = clutter_settings_get_default ();
+  /* Cogl needs to know the Xlib display connection for
+     CoglTexturePixmapX11 */
+  cogl_xlib_set_display (backend_x11->xdpy);
 
-      /* Cogl needs to know the Xlib display connection for
-         CoglTexturePixmapX11 */
-      cogl_xlib_set_display (backend_x11->xdpy);
+  /* add event filter for Cogl events */
+  clutter_x11_add_filter (cogl_xlib_filter, NULL);
 
-      /* add event filter for Cogl events */
-      clutter_x11_add_filter (cogl_xlib_filter, NULL);
+  if (clutter_screen == -1)
+    backend_x11->xscreen = DefaultScreenOfDisplay (backend_x11->xdpy);
+  else
+    backend_x11->xscreen = ScreenOfDisplay (backend_x11->xdpy,
+                                            clutter_screen);
 
-      if (clutter_screen == -1)
-        backend_x11->xscreen = DefaultScreenOfDisplay (backend_x11->xdpy);
-      else
-        backend_x11->xscreen = ScreenOfDisplay (backend_x11->xdpy,
-                                                clutter_screen);
-
-      backend_x11->xscreen_num = XScreenNumberOfScreen (backend_x11->xscreen);
-      backend_x11->xscreen_width = WidthOfScreen (backend_x11->xscreen);
-      backend_x11->xscreen_height = HeightOfScreen (backend_x11->xscreen);
-
-      backend_x11->xwin_root = RootWindow (backend_x11->xdpy,
-                                           backend_x11->xscreen_num);
-
-      backend_x11->display_name = g_strdup (clutter_display_name);
-
-      dpi = (((double) DisplayHeight (backend_x11->xdpy, backend_x11->xscreen_num) * 25.4)
-            / (double) DisplayHeightMM (backend_x11->xdpy, backend_x11->xscreen_num));
-
-      g_object_set (settings, "font-dpi", (int) dpi * 1024, NULL);
-
-      /* create the device manager */
-      clutter_backend_x11_create_device_manager (backend_x11);
-
-      /* register keymap */
-      clutter_backend_x11_create_keymap (backend_x11);
-
-      /* create XSETTINGS client */
-      backend_x11->xsettings =
-        _clutter_xsettings_client_new (backend_x11->xdpy,
-                                       backend_x11->xscreen_num,
-                                       clutter_backend_x11_xsettings_notify,
-                                       NULL,
-                                       backend_x11);
-
-      /* add event filter for XSETTINGS events */
-      clutter_x11_add_filter (xsettings_filter, backend_x11);
-
-      if (clutter_synchronise)
-        XSynchronize (backend_x11->xdpy, True);
-
-      XInternAtoms (backend_x11->xdpy,
-                    (char **) atom_names, N_ATOM_NAMES,
-                    False, atoms);
-
-      backend_x11->atom_NET_WM_PID = atoms[0];
-      backend_x11->atom_NET_WM_PING = atoms[1];
-      backend_x11->atom_NET_WM_STATE = atoms[2];
-      backend_x11->atom_NET_WM_STATE_FULLSCREEN = atoms[3];
-      backend_x11->atom_NET_WM_USER_TIME = atoms[4];
-      backend_x11->atom_WM_PROTOCOLS = atoms[5];
-      backend_x11->atom_WM_DELETE_WINDOW = atoms[6];
-      backend_x11->atom_XEMBED = atoms[7];
-      backend_x11->atom_XEMBED_INFO = atoms[8];
-      backend_x11->atom_NET_WM_NAME = atoms[9];
-      backend_x11->atom_UTF8_STRING = atoms[10];
-    }
+  backend_x11->xscreen_num = XScreenNumberOfScreen (backend_x11->xscreen);
+  backend_x11->xscreen_width = WidthOfScreen (backend_x11->xscreen);
+  backend_x11->xscreen_height = HeightOfScreen (backend_x11->xscreen);
+
+  backend_x11->xwin_root = RootWindow (backend_x11->xdpy,
+                                       backend_x11->xscreen_num);
+
+  backend_x11->display_name = g_strdup (clutter_display_name);
+
+  dpi = (((double) DisplayHeight (backend_x11->xdpy, backend_x11->xscreen_num) * 25.4)
+      / (double) DisplayHeightMM (backend_x11->xdpy, backend_x11->xscreen_num));
+
+  g_object_set (settings, "font-dpi", (int) dpi * 1024, NULL);
+
+  /* create the device manager */
+  clutter_backend_x11_create_device_manager (backend_x11);
+
+  /* register keymap */
+  clutter_backend_x11_create_keymap (backend_x11);
+
+  /* create XSETTINGS client */
+  backend_x11->xsettings =
+    _clutter_xsettings_client_new (backend_x11->xdpy,
+                                   backend_x11->xscreen_num,
+                                   clutter_backend_x11_xsettings_notify,
+                                   NULL,
+                                   backend_x11);
+
+  /* add event filter for XSETTINGS events */
+  clutter_x11_add_filter (xsettings_filter, backend_x11);
+
+  if (clutter_synchronise)
+    XSynchronize (backend_x11->xdpy, True);
+
+  XInternAtoms (backend_x11->xdpy,
+                (char **) atom_names, N_ATOM_NAMES,
+                False, atoms);
+
+  backend_x11->atom_NET_WM_PID = atoms[0];
+  backend_x11->atom_NET_WM_PING = atoms[1];
+  backend_x11->atom_NET_WM_STATE = atoms[2];
+  backend_x11->atom_NET_WM_STATE_FULLSCREEN = atoms[3];
+  backend_x11->atom_NET_WM_USER_TIME = atoms[4];
+  backend_x11->atom_WM_PROTOCOLS = atoms[5];
+  backend_x11->atom_WM_DELETE_WINDOW = atoms[6];
+  backend_x11->atom_XEMBED = atoms[7];
+  backend_x11->atom_XEMBED_INFO = atoms[8];
+  backend_x11->atom_NET_WM_NAME = atoms[9];
+  backend_x11->atom_UTF8_STRING = atoms[10];
 
   g_free (clutter_display_name);
 
@@ -547,7 +544,8 @@ clutter_backend_x11_dispose (GObject *gobject)
 static ClutterFeatureFlags
 clutter_backend_x11_get_features (ClutterBackend *backend)
 {
-  ClutterFeatureFlags flags = CLUTTER_FEATURE_STAGE_USER_RESIZE | CLUTTER_FEATURE_STAGE_CURSOR;
+  ClutterFeatureFlags flags = CLUTTER_FEATURE_STAGE_USER_RESIZE
+                            | CLUTTER_FEATURE_STAGE_CURSOR;
 
   flags |= CLUTTER_BACKEND_CLASS (clutter_backend_x11_parent_class)->get_features (backend);
 
@@ -738,6 +736,7 @@ error:
 
   if (onscreen_template != NULL)
     cogl_object_unref (onscreen_template);
+
   if (swap_chain != NULL)
     cogl_object_unref (swap_chain);
 
@@ -746,6 +745,7 @@ error:
       cogl_object_unref (backend->cogl_renderer);
       backend->cogl_renderer = NULL;
     }
+
   return FALSE;
 }
 
@@ -763,10 +763,11 @@ clutter_backend_x11_create_stage (ClutterBackend  *backend,
 			"wrapper", wrapper,
 			NULL);
 
+  /* the X11 stage does event translation */
   translator = CLUTTER_EVENT_TRANSLATOR (stage);
   _clutter_backend_add_event_translator (backend, translator);
 
-  CLUTTER_NOTE (MISC, "Cogl stage created (display:%p, screen:%d, root:%u)",
+  CLUTTER_NOTE (MISC, "X11 stage created (display:%p, screen:%d, root:%u)",
                 backend_x11->xdpy,
                 backend_x11->xscreen_num,
                 (unsigned int) backend_x11->xwin_root);



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