[mutter/meego-1.0: 3/30] Set busy cursor on root window until stage is shown.



commit 9bd11955b53bc10a257ad93a024385072b778c59
Author: Tomas Frydrych <tf linux intel com>
Date:   Tue May 19 13:21:01 2009 +0100

    Set busy cursor on root window until stage is shown.
    
    cherry pick of cdb644df1f5decb09ab80e0ff04e4ea2e1e214d7 and
    db4bea2b77dd36f37b2163c009d7dd2f51f49780.

 src/compositor/compositor.c |    2 +
 src/core/main.c             |   49 ++++++++++++++++++++++++++++++++++++++++++-
 src/core/screen.c           |    2 +-
 3 files changed, 51 insertions(+), 2 deletions(-)
---
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index a84943d..7de1065 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -580,6 +580,8 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
 
   clutter_actor_show (info->overlay_group);
   clutter_actor_show (info->stage);
+
+  meta_screen_set_cursor (screen, META_CURSOR_DEFAULT);
 }
 
 void
diff --git a/src/core/main.c b/src/core/main.c
index 0672a0f..0972372 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -78,6 +78,12 @@
 #include "compositor/mutter-plugin-manager.h"
 #endif
 
+#include <X11/cursorfont.h>
+
+#ifdef HAVE_XCURSOR
+#include <X11/Xcursor/Xcursor.h>
+#endif
+
 /**
  * The exit code we'll return to our parent process when we eventually die.
  */
@@ -621,6 +627,36 @@ main (int argc, char **argv)
    */
   meta_clutter_init (ctx, &argc, &argv);
 
+  {
+    /*
+     * Set busy cursor as soon as we can (at this there is no MetaDisplay or
+     * MetaScreen object, so we have to do this the xlib way.
+     *
+     * Metacity will reset the cursor as soon as it creates the default
+     * MetaScreen object. Plugins might want to further control the cursor
+     * in their constructor.
+     */
+    Display *xdpy = meta_ui_get_display ();
+    Cursor   xc;
+
+#ifdef HAVE_XCURSOR
+    /*
+     * Obviously, this is moblin specific; we want the correct theme
+     * applied from the start, and we cannot query the prefs yet, but the
+     * prefs take a significant amount of time to query, and we do not want
+     * the uggly X watch cursor there at all.
+     */
+    XcursorSetTheme (xdpy, "moblin");
+    XcursorSetDefaultSize (xdpy, 24);
+#endif
+
+    xc = XCreateFontCursor (xdpy, XC_watch);
+
+    XDefineCursor (xdpy, RootWindow (xdpy, 0), xc);
+    XSync (xdpy,False);
+    XFreeCursor (xdpy, xc);
+  }
+
   g_option_context_free (ctx);
 
   /* must be after UI init so we can override GDK handlers */
@@ -628,6 +664,7 @@ main (int argc, char **argv)
 
   /* Load prefs */
   meta_prefs_init ();
+
   meta_prefs_add_listener (prefs_changed_callback, NULL);
 
 
@@ -721,7 +758,17 @@ main (int argc, char **argv)
 
   if (!meta_display_open ())
     meta_exit (META_EXIT_ERROR);
-  
+
+  /*
+   * This seems the first time we can set up the cursor properly. The display
+   * seems to set up the theme at the point it opens, but the cursor size
+   * for individual screens seems wrong unless we update it here.
+   *
+   * TODO -- investigate further to avoid unnecessary X round trips.
+   */
+  meta_display_set_cursor_theme (meta_prefs_get_cursor_theme (),
+                                 meta_prefs_get_cursor_size ());
+
   g_main_loop_run (meta_main_loop);
 
   meta_finalize ();
diff --git a/src/core/screen.c b/src/core/screen.c
index 7ac65d0..b010be7 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -720,7 +720,7 @@ meta_screen_new (MetaDisplay *display,
   
   reload_monitor_infos (screen);
   
-  meta_screen_set_cursor (screen, META_CURSOR_DEFAULT);
+  meta_screen_set_cursor (screen, META_CURSOR_BUSY);
 
   /* Handle creating a no_focus_window for this screen */  
   screen->no_focus_window =



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