patches/gnome-session-04-busy-cursor.diff
author yippi
Mon, 27 Sep 2010 21:07:51 +0000
changeset 20108 51df67ca9307
parent 13113 e0003844f498
permissions -rw-r--r--
I had these modules listed as being owned by me, but they are really owned by wangke, correcting.

--- ../gnome-session-2.23.6/splash/gnome-session-splash.c	2008-08-13 14:45:57.078221713 +0200
+++ gnome-session-2.23.6/splash/gnome-session-splash.c	2008-08-13 14:47:57.199399805 +0200
@@ -271,6 +271,47 @@
         gtk_main_quit ();
 }
 
+/* display a busy cursor in window if it exist and on 
+ * the root window. This is done in plain X and opening a new 
+ * connection each time to avoid keeping the default cursor size
+ * as it is modified by gnome-daemon-settings while gnome-session is running 
+ * (hence the user set cursor size would be lost if only one connection 
+ * was open)*/
+static void 
+set_busy_cursor (GdkWindow *window, gboolean enable)
+{
+  static gboolean busy = FALSE;
+  Cursor cur; 
+  Display *dpy;
+  int scr_num, i;
+
+  dpy = XOpenDisplay (NULL);
+
+  if (enable)
+    {
+      if (busy)
+	return;
+      cur = XCreateFontCursor (dpy, GDK_WATCH);
+      busy = TRUE;
+    }
+  else
+    {
+      cur = XCreateFontCursor (dpy, GDK_LEFT_PTR);
+      busy = FALSE;
+    }
+  
+  scr_num = ScreenCount (dpy);
+
+  for (i = 0; i < scr_num; i++)
+    {
+      XDefineCursor (dpy, RootWindow (dpy, i), cur);
+    }
+
+  if (GDK_IS_WINDOW (window))
+    XDefineCursor (dpy, GDK_WINDOW_XID (window), cur);
+  XSync (dpy, FALSE);
+  XCloseDisplay (dpy);
+}
 int
 main (int argc, char *argv[])
 {
@@ -291,10 +332,14 @@
                           G_CALLBACK (quit),
                           NULL);
 
+	set_busy_cursor (NULL, TRUE);
+
         set_session_running_handler ();
 
         setup_splash_window ();
         gtk_main ();
 
+	set_busy_cursor (NULL, FALSE);
+
         return 0;
 }