patches/gnome-session-04-logout-effect.diff
author dcarbery
Fri, 24 Nov 2006 16:37:59 +0000
branch217update
changeset 19096 d542fc2c823e
parent 8396 3047112e1ba8
child 9044 73d6c6a85a19
permissions -rw-r--r--
Merged trunk changes r9797:9829 into 217update branch.

diff -urN gnome-session-2.16.1/gnome-session/gnome-session.schemas.in gnome-session-2.16.1-hacked/gnome-session/gnome-session.schemas.in
--- gnome-session-2.16.1/gnome-session/gnome-session.schemas.in	2006-10-23 09:48:08.593764000 +1300
+++ gnome-session-2.16.1-hacked/gnome-session/gnome-session.schemas.in	2006-10-23 09:49:02.779135000 +1300
@@ -67,5 +67,16 @@
             <long>This is the option that will be selected in the logout dialog, valid values are "logout" for logging out, "shutdown" for halting the system and "restart" for restarting the system.</long>
          </locale>
       </schema>
+      <schema>
+         <key>/schemas/apps/gnome-session/options/logout_effect</key>
+         <applyto>/apps/gnome-session/options/logout_effect</applyto>
+         <owner>gnome</owner>
+         <type>string</type>
+         <default>default</default>
+         <locale name="C">
+            <short>Logout effect</short>
+            <long>Preferred "Iris" effect when logging out</long>
+         </locale>
+      </schema>
    </schemalist>
 </gconfschemafile>
diff -urN gnome-session-2.16.1/gnome-session/logout.c gnome-session-2.16.1-hacked/gnome-session/logout.c
--- gnome-session-2.16.1/gnome-session/logout.c	2006-04-15 20:56:06.000000000 +1200
+++ gnome-session-2.16.1-hacked/gnome-session/logout.c	2006-10-23 09:49:02.780167000 +1300
@@ -177,6 +177,86 @@
   
   return TRUE;
 }
+
+static void
+stipple_screen (GdkScreen *screen,
+		int 	  monitor)
+{
+	static char stipple_bits [4][4] = {{0x0A, 0x05, 0x0A, 0x05},
+	                                   {0x0A, 0x00, 0x0A, 0x00},
+	                                   {0x08, 0x00, 0x02, 0x00},
+	                                   {0x08, 0x00, 0x00, 0x00} };
+	GdkGCValues	values;
+	GdkGC		*gc = NULL;
+	GdkWindow 	*parent = NULL;
+	int i = 0;
+
+	parent = gdk_screen_get_root_window (screen);
+
+	for (i=3; i>=0; i--) {
+		values.stipple = gdk_bitmap_create_from_data (parent, stipple_bits[i], 4, 4);
+		values.fill = GDK_STIPPLED;
+		values.subwindow_mode = GDK_INCLUDE_INFERIORS;
+
+		gc = gdk_gc_new_with_values (parent, &values,
+				GDK_GC_FILL | GDK_GC_STIPPLE | GDK_GC_SUBWINDOW);
+
+		gdk_draw_rectangle (parent,
+				gc, TRUE, 0, 0,
+				gsm_screen_get_width (screen, monitor),
+				gsm_screen_get_height (screen, monitor));
+		gdk_flush ();
+		usleep (250);
+	}
+}
+
+static void
+blank_screen_tiny_clients (GdkScreen *screen,
+                           int        monitor)
+{
+          GdkGCValues values;
+           GdkGC*gc = NULL;
+           GdkWindow *parent = NULL;
+
+           parent = gdk_screen_get_root_window (screen);
+
+           values.fill = GDK_SOLID;
+           values.subwindow_mode = GDK_INCLUDE_INFERIORS;
+
+           gc = gdk_gc_new_with_values (parent, &values, GDK_GC_FILL | GDK_GC_SUBWINDOW);
+
+           gdk_draw_rectangle (parent, gc, TRUE, 0, 0,
+                               gsm_screen_get_width (screen, monitor),
+                               gsm_screen_get_height (screen, monitor));
+           gdk_flush ();
+}
+
+static void
+refresh_screen (GdkScreen *screen,
+		int	  monitor)
+{
+	GdkWindowAttr attributes;
+	GdkWindow *window;
+	GdkWindow *parent;
+
+	attributes.x = 0;
+	attributes.y = 0;
+	attributes.width = gsm_screen_get_width (screen, monitor);
+	attributes.height = gsm_screen_get_height (screen, monitor);
+	attributes.window_type = GDK_WINDOW_TOPLEVEL;
+	attributes.wclass = GDK_INPUT_OUTPUT;
+	attributes.override_redirect = TRUE;
+	attributes.event_mask = 0;
+
+	parent = gdk_screen_get_root_window (screen);
+
+	window = gdk_window_new (parent, &attributes,
+				 GDK_WA_X | GDK_WA_Y | GDK_WA_NOREDIR);
+
+	gdk_window_show (window);
+	gdk_flush ();
+	gdk_window_hide (window);
+}
   
 static void
 fadeout_screen (GdkScreen *screen,
@@ -487,8 +567,17 @@
    */
   if (!a11y_enabled)
     {
+      GConfClient *gconf_client;
+      gchar * effect;
+      gconf_client = gsm_get_conf_client ();
+      effect = gconf_client_get_string (gconf_client, "/apps/gnome-session/options/logout_effect", NULL);
       XGrabServer (GDK_DISPLAY ());
-      gsm_foreach_screen (fadeout_screen);
+      if (effect && !g_strncasecmp("black", effect, 4)) {
+           gsm_foreach_screen (blank_screen_tiny_clients);
+           g_free (effect);
+      } else {
+           gsm_foreach_screen (stipple_screen);
+      }
     }
 
   gtk_widget_show_all (box);
@@ -528,7 +617,7 @@
 
   if (!a11y_enabled)
     {
-      hide_fadeout_windows ();
+      gsm_foreach_screen (refresh_screen);
       XUngrabServer (GDK_DISPLAY ());
 
       gdk_pointer_ungrab (GDK_CURRENT_TIME);