[Xfce4-commits] <xfce4-screenshooter:master> Use 1 as the minimal delay for the interactive screenshots.
Jérôme Guelfucci
noreply at xfce.org
Sat Dec 5 23:22:01 CET 2009
Updating branch refs/heads/master
to 7f64be60c11d12f4f54f4297782c17daf994921a (commit)
from 25273435589aea66893243aa30e6c4ee09679f95 (commit)
commit 7f64be60c11d12f4f54f4297782c17daf994921a
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date: Sat Dec 5 23:18:01 2009 +0100
Use 1 as the minimal delay for the interactive screenshots.
This allows us to avoid a lot of artifacts which occured in some
weird and random cases whithout using ugly hacks. Moreover, it
makes sense as the active window is not really defined 0 seconds
after the dialog is closed (the WM needs some time to focus a new
window).
lib/screenshooter-capture.c | 10 +---------
lib/screenshooter-dialogs.c | 2 +-
lib/screenshooter-utils.c | 6 +++++-
src/main.c | 7 +++++--
4 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/lib/screenshooter-capture.c b/lib/screenshooter-capture.c
index c377bec..edb46a0 100644
--- a/lib/screenshooter-capture.c
+++ b/lib/screenshooter-capture.c
@@ -908,16 +908,8 @@ GdkPixbuf *screenshooter_take_screenshot (gint region,
gdk_window_process_all_updates ();
/* wait for n=delay seconds */
- /* Workaround: sleep at least one second to make sure the
- * WM/X server hast time to select the new active window after
- * the dialog is closed */
if (region != SELECT)
- {
- if (region == ACTIVE_WINDOW && !plugin)
- delay ? sleep (delay): sleep (1);
- else
- sleep (delay);
- }
+ sleep (delay);
/* Get the window/desktop we want to screenshot*/
if (region == FULLSCREEN)
diff --git a/lib/screenshooter-dialogs.c b/lib/screenshooter-dialogs.c
index 4e77a5e..2d040bb 100644
--- a/lib/screenshooter-dialogs.c
+++ b/lib/screenshooter-dialogs.c
@@ -856,7 +856,7 @@ GtkWidget *screenshooter_region_dialog_new (ScreenshotData *sd, gboolean plugin)
delay_spinner_box = gtk_hbox_new (FALSE, 4);
gtk_box_pack_start (GTK_BOX (delay_box), delay_spinner_box, FALSE, FALSE, 0);
- delay_spinner = gtk_spin_button_new_with_range(0.0, 60.0, 1.0);
+ delay_spinner = gtk_spin_button_new_with_range(1.0, 60.0, 1.0);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (delay_spinner), sd->delay);
gtk_widget_set_tooltip_text (delay_spinner,
_("Delay in seconds before the screenshot is taken"));
diff --git a/lib/screenshooter-utils.c b/lib/screenshooter-utils.c
index 9305718..5571253 100644
--- a/lib/screenshooter-utils.c
+++ b/lib/screenshooter-utils.c
@@ -55,7 +55,7 @@ screenshooter_read_rc_file (const gchar *file, ScreenshotData *sd)
const gchar *default_uri = screenshooter_get_xdg_image_dir_uri ();
XfceRc *rc;
- gint delay = 0;
+ gint delay = 1;
gint region = FULLSCREEN;
gint action = SAVE;
gint show_mouse = 1;
@@ -104,6 +104,10 @@ screenshooter_read_rc_file (const gchar *file, ScreenshotData *sd)
/* And set the sd values */
TRACE ("Set the values of the struct");
+ /* Don't accept null delay */
+ if (delay == 0)
+ delay = 1;
+
sd->delay = delay;
sd->region = region;
sd->action = action;
diff --git a/src/main.c b/src/main.c
index d24b347..1563121 100644
--- a/src/main.c
+++ b/src/main.c
@@ -36,7 +36,7 @@ gboolean mouse = FALSE;
gboolean upload = FALSE;
gchar *screenshot_dir;
gchar *application;
-gint delay = 0;
+gint delay = 1;
@@ -247,7 +247,10 @@ int main (int argc, char **argv)
/* Whether to display the mouse pointer on the screenshot */
mouse ? (sd->show_mouse = 1) : (sd->show_mouse = 0);
- sd->delay = delay;
+ if (delay > 0)
+ sd->delay = delay;
+ else
+ delay = 1;
if (application != NULL)
{
More information about the Xfce4-commits
mailing list