Skip to content
Snippets Groups Projects
Commit d87faade authored by Jerome Guelfucci's avatar Jerome Guelfucci
Browse files

Try to fix bug 4601.

(Old svn revision: 6074)
parent 000afcf0
No related branches found
No related tags found
No related merge requests found
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 2008-11-09 jeromeg
* Post release bump. * Post release bump.
......
...@@ -130,9 +130,9 @@ GdkPixbuf *screenshooter_take_screenshot (gint mode, ...@@ -130,9 +130,9 @@ GdkPixbuf *screenshooter_take_screenshot (gint mode,
gint delay) gint delay)
{ {
GdkPixbuf *screenshot; GdkPixbuf *screenshot;
GdkWindow *window = NULL; GdkWindow *window, *window2;
GdkScreen *screen; GdkScreen *screen;
gint width; gint width;
gint height; gint height;
/* gdk_get_default_root_window (), needs_unref enables us to unref *window /* gdk_get_default_root_window (), needs_unref enables us to unref *window
...@@ -151,32 +151,31 @@ GdkPixbuf *screenshooter_take_screenshot (gint mode, ...@@ -151,32 +151,31 @@ GdkPixbuf *screenshooter_take_screenshot (gint mode,
else if (mode == ACTIVE_WINDOW) else if (mode == ACTIVE_WINDOW)
{ {
window = gdk_screen_get_active_window (screen); window = gdk_screen_get_active_window (screen);
/* If we are supposed to take a screenshot of the active window, and if /* 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.*/ the active window is the desktop background, grab the whole screen.*/
if (window == NULL || if (window == NULL)
gdk_window_get_type_hint (window) == GDK_WINDOW_TYPE_HINT_DESKTOP)
{ {
if (!(window == NULL))
{
g_object_unref (window);
}
window = gdk_get_default_root_window (); window = gdk_get_default_root_window ();
needs_unref = FALSE; 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); 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 */ /* wait for n=delay seconds */
......
...@@ -185,6 +185,7 @@ int main(int argc, char **argv) ...@@ -185,6 +185,7 @@ int main(int argc, char **argv)
{ {
GtkWidget *dialog; GtkWidget *dialog;
gint response; gint response;
GdkDisplay *display = gdk_display_get_default ();
/* Read the preferences */ /* Read the preferences */
screenshooter_read_rc_file (rc_file, sd, FALSE); screenshooter_read_rc_file (rc_file, sd, FALSE);
...@@ -196,8 +197,12 @@ int main(int argc, char **argv) ...@@ -196,8 +197,12 @@ int main(int argc, char **argv)
window mode */ window mode */
response = gtk_dialog_run (GTK_DIALOG (dialog)); 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) if (response == GTK_RESPONSE_OK)
{ {
gchar *screenshot_path = NULL; gchar *screenshot_path = NULL;
...@@ -239,6 +244,8 @@ int main(int argc, char **argv) ...@@ -239,6 +244,8 @@ int main(int argc, char **argv)
/* Save preferences */ /* Save preferences */
screenshooter_write_rc_file (rc_file, sd); screenshooter_write_rc_file (rc_file, sd);
gtk_widget_destroy (dialog);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment