gksu-devel
[Top][All Lists]
Advanced

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

Disable fadeout effect [Patch]


From: lowfi
Subject: Disable fadeout effect [Patch]
Date: Sun, 12 Nov 2006 18:58:27 +0100
User-agent: Thunderbird 1.5.0.7 (X11/20060918)

Hi,

Would it be possible to add a configuration option to disable the fadeout 
effect?
I'm using a compositing manager and fadein/out is very choppy and slow. I 
removed the code
myself for some time now, but this gets annoying, so i thought maybe this patch 
can go upstream.

I saw the new composite/branch which will solve the problem,
but I think it would still be a good feature to have.

Greetings,
Gerd Kohlberger
Index: libgksu.c
===================================================================
--- libgksu.c   (Revision 754)
+++ libgksu.c   (Arbeitskopie)
@@ -469,6 +469,18 @@
 
 /* End of 'stolen' code */
 
+gboolean
+get_fadeout_preference (void)
+{
+  GConfClient *gconf_client;
+  gboolean fadeout;
+  
+  gconf_client = gconf_client_get_default ();
+  fadeout = gconf_client_get_bool (gconf_client, BASE_PATH"fadeout-effect", 
NULL);
+  g_object_unref (gconf_client);  
+  return fadeout;
+}
+
 #define GRAB_TRIES     16
 #define GRAB_WAIT      250 /* milliseconds */
 
@@ -530,7 +542,8 @@
   GdkGrabStatus status;
   gint grab_tries = 0;
   gint lock = -1;
-
+  gboolean fadeout;
+  
   gchar *fname = g_strdup_printf ("%s/.gksu.lock", getenv ("HOME"));
   pid_t pid = test_lock (fname);
 
@@ -544,8 +557,10 @@
   if( lock < 0)
     g_warning ("Unable to create lock file.");
   g_free (fname);
-
-  fadeout_screen (gdk_screen_get_default (), 0);
+  
+  fadeout = get_fadeout_preference ();
+  if (fadeout)
+    fadeout_screen (gdk_screen_get_default (), 0);
   gtk_widget_show_all (dialog);
 
   /* reset cursor */
@@ -561,9 +576,12 @@
       if (++grab_tries > GRAB_TRIES)
        {
          gtk_widget_hide (dialog);
-         g_get_current_time (&fade_data->start_time);
-         while (fadein_callback (fade_data) != FALSE);
-         report_failed_grab (FAILED_GRAB_MOUSE);
+         if (fadeout)
+           {
+             g_get_current_time (&fade_data->start_time);        
+             while (fadein_callback (fade_data) != FALSE);
+           }
+         report_failed_grab (FAILED_GRAB_MOUSE);         
          exit (1);
          break;
        }
@@ -581,8 +599,11 @@
       if (++grab_tries > GRAB_TRIES)
        {
          gtk_widget_hide (dialog);
-         g_get_current_time (&fade_data->start_time);
-         while (fadein_callback (fade_data) != FALSE);
+         if (fadeout)
+           {
+             g_get_current_time (&fade_data->start_time);
+             while (fadein_callback (fade_data) != FALSE);
+           }
          report_failed_grab (FAILED_GRAB_KEYBOARD);
          exit (1);
          break;
@@ -607,11 +628,12 @@
   /* Ungrab */
   gdk_pointer_ungrab(GDK_CURRENT_TIME);
   gdk_keyboard_ungrab(GDK_CURRENT_TIME);
-  gdk_flush();
-
-  g_get_current_time (&fade_data->start_time);
-  while (fadein_callback (fade_data) != FALSE);
-
+  gdk_flush();  
+  if (get_fadeout_preference ())
+    {
+      g_get_current_time (&fade_data->start_time);
+      while (fadein_callback (fade_data) != FALSE);
+    }
   close(lock);
 }
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]