[Goodies-commits] r6074 - in xfce4-screenshooter-plugin/trunk: . lib src

Jerome Guelfucci jeromeg at xfce.org
Wed Nov 12 19:57:54 CET 2008


Author: jeromeg
Date: 2008-11-12 18:57:54 +0000 (Wed, 12 Nov 2008)
New Revision: 6074

Modified:
   xfce4-screenshooter-plugin/trunk/ChangeLog
   xfce4-screenshooter-plugin/trunk/lib/screenshooter-utils.c
   xfce4-screenshooter-plugin/trunk/src/main.c
Log:
Try to fix bug 4601.

Modified: xfce4-screenshooter-plugin/trunk/ChangeLog
===================================================================
--- xfce4-screenshooter-plugin/trunk/ChangeLog	2008-11-12 18:38:50 UTC (rev 6073)
+++ xfce4-screenshooter-plugin/trunk/ChangeLog	2008-11-12 18:57:54 UTC (rev 6074)
@@ -1,3 +1,13 @@
+2008-11-12 jeromeg
+
+  * lib/screenshooter-utils.c: 
+    - (screenshooter_take_screenshot) rework the window grabbing to try to fix
+      bug 4601.
+  * src/main.c (main) try to fix 4601:
+    - hide the dialog instead of destroying it.
+    - sync the display before taking the screenshot.
+    - ugly, wait 1 second before taking the screenshot.
+
 2008-11-09 jeromeg
 
   * Post release bump.

Modified: xfce4-screenshooter-plugin/trunk/lib/screenshooter-utils.c
===================================================================
--- xfce4-screenshooter-plugin/trunk/lib/screenshooter-utils.c	2008-11-12 18:38:50 UTC (rev 6073)
+++ xfce4-screenshooter-plugin/trunk/lib/screenshooter-utils.c	2008-11-12 18:57:54 UTC (rev 6074)
@@ -130,9 +130,9 @@
                                           gint       delay)
 {
   GdkPixbuf *screenshot;
-  GdkWindow *window = NULL;
+  GdkWindow *window, *window2;
   GdkScreen *screen;
-  
+    
   gint width;
   gint height;
   /* gdk_get_default_root_window (), needs_unref enables us to unref *window 
@@ -151,32 +151,31 @@
   else if (mode == ACTIVE_WINDOW)
     {
       window = gdk_screen_get_active_window (screen);
-      
+            
       /* If we are supposed to take a screenshot of the active window, and if 
       the active window is the desktop background, grab the whole screen.*/      
-      if (window == NULL || 
-          gdk_window_get_type_hint (window) == GDK_WINDOW_TYPE_HINT_DESKTOP)
+      if (window == NULL)
         {
-          if (!(window == NULL))
-            {
-              g_object_unref (window);
-            }
-          
           window = gdk_get_default_root_window ();
           needs_unref = FALSE;
         }
-      else
+            
+      if (gdk_window_get_type_hint (window) == GDK_WINDOW_TYPE_HINT_DESKTOP)
         {
-          GdkWindow *window2;
-          
-          window2 = 
-            gdk_window_foreign_new (find_toplevel_window 
-                                    (GDK_WINDOW_XID (window)));
-          
           g_object_unref (window);
-          
-          window = window2;
+                    
+          window = gdk_get_default_root_window ();
+          needs_unref = FALSE;
         }
+      else
+        {
+           window2 = gdk_window_foreign_new (find_toplevel_window 
+                                             (GDK_WINDOW_XID (window)));
+           g_object_unref (window);
+          
+           window = window2;
+        }  
+      
     }
   
   /* wait for n=delay seconds */ 

Modified: xfce4-screenshooter-plugin/trunk/src/main.c
===================================================================
--- xfce4-screenshooter-plugin/trunk/src/main.c	2008-11-12 18:38:50 UTC (rev 6073)
+++ xfce4-screenshooter-plugin/trunk/src/main.c	2008-11-12 18:57:54 UTC (rev 6074)
@@ -185,6 +185,7 @@
     {
       GtkWidget *dialog;
       gint response;
+      GdkDisplay *display = gdk_display_get_default ();
       
       /* Read the preferences */
       screenshooter_read_rc_file (rc_file, sd, FALSE);
@@ -196,8 +197,12 @@
          window mode */
       response = gtk_dialog_run (GTK_DIALOG (dialog));
       
-      gtk_widget_destroy (dialog);
+      gtk_widget_hide_all (dialog);
       
+      gdk_display_sync (display);
+      
+      sleep (1);
+                  
       if (response == GTK_RESPONSE_OK)
         {
           gchar *screenshot_path = NULL;
@@ -239,6 +244,8 @@
           
           /* Save preferences */     
           screenshooter_write_rc_file (rc_file, sd);
+          
+          gtk_widget_destroy (dialog);
         }
     }
   




More information about the Goodies-commits mailing list