Package: libgksu2-0
Version: 2.0.13~pre1-4
Tags: patch

If your desktop is on a remote X display, libgksu's fancy fade-out
becomes more like a few-seconds-long freeze, after which the screen
instantly darkens and the authentication dialog appears. The fade-in
afterwards is similarly clunktastic.

This is a patch I've had kicking around for a while, and would have
submitted to the upstream, if the upstream maintainer hadn't apparently
ceased all work on this project in late 2009.

The patch implements a simple test to check whether the screen is local
or not. The screen_is_local() function might need updating to support
non-X displays; I haven't any experience with those.
Index: libgksu/libgksu.c
===================================================================
--- libgksu/libgksu.c	(revision 876)
+++ libgksu/libgksu.c	(working copy)
@@ -531,10 +531,23 @@
 
 }
 
+static gboolean
+screen_is_local (GdkScreen *screen)
+{
+  GdkDisplay *display;
+  const gchar *display_name;
+
+  display = gdk_screen_get_display (screen);
+  display_name = gdk_display_get_name (display);
+
+  return display_name[0] == ':';
+}
+
 int
 grab_keyboard_and_mouse (GtkWidget *dialog)
 {
   GdkGrabStatus status;
+  GdkScreen *screen;
   gint grab_tries = 0;
   gint lock = -1;
   pid_t pid;
@@ -557,7 +570,12 @@
   g_free (fname);
 
   gdk_threads_enter ();
-  fadeout_screen (gdk_screen_get_default (), 0);
+
+  screen = gdk_screen_get_default ();
+
+  if (screen_is_local (screen))
+    fadeout_screen (screen, 0);
+
   gtk_widget_show_all (dialog);
 
   /* reset cursor */
@@ -621,8 +639,11 @@
   gdk_keyboard_ungrab(GDK_CURRENT_TIME);
   gdk_flush();
 
-  g_get_current_time (&fade_data->start_time);
-  while (fadein_callback (fade_data) != FALSE);
+  if (fade_data != NULL)
+    {
+      g_get_current_time (&fade_data->start_time);
+      while (fadein_callback (fade_data) != FALSE);
+    }
   gdk_threads_leave();
 
   close(lock);

Reply via email to