[Xfce4-commits] [apps/xfce4-screenshooter] 03/05: enable delay in region mode

noreply at xfce.org noreply at xfce.org
Mon Nov 30 22:04:34 CET 2015


This is an automated email from the git hooks/post-receive script.

landry pushed a commit to branch master
in repository apps/xfce4-screenshooter.

commit 6cacb545cd814f766f4946de1f23da7115778ab5
Author: Matias Wilkman <matias.wilkman at gmail.com>
Date:   Tue Nov 24 05:13:23 2015 +0200

    enable delay in region mode
---
 lib/screenshooter-capture.c |   25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/lib/screenshooter-capture.c b/lib/screenshooter-capture.c
index b5649fe..c435bab 100644
--- a/lib/screenshooter-capture.c
+++ b/lib/screenshooter-capture.c
@@ -67,7 +67,7 @@ static GdkPixbuf       *get_window_screenshot               (GdkWindow      *win
 static GdkFilterReturn  region_filter_func                  (GdkXEvent      *xevent,
                                                              GdkEvent       *event,
                                                              RbData         *rbdata);
-static GdkPixbuf       *get_rectangle_screenshot            (void);
+static GdkPixbuf       *get_rectangle_screenshot            (gint delay);
 static gboolean         cb_key_pressed                      (GtkWidget      *widget,
                                                              GdkEventKey    *event,
                                                              gboolean       *cancelled);
@@ -83,7 +83,7 @@ static gboolean         cb_button_released                  (GtkWidget      *wid
 static gboolean         cb_motion_notify                    (GtkWidget      *widget,
                                                              GdkEventMotion *event,
                                                              RubberBandData *rbdata);
-static GdkPixbuf       *get_rectangle_screenshot_composited (void);
+static GdkPixbuf       *get_rectangle_screenshot_composited (gint delay);
 
 
 
@@ -683,7 +683,7 @@ static gboolean cb_motion_notify (GtkWidget *widget,
 
 
 static GdkPixbuf
-*get_rectangle_screenshot_composited (void)
+*get_rectangle_screenshot_composited (gint delay)
 {
   GtkWidget *window;
   RubberBandData rbdata;
@@ -761,6 +761,9 @@ static GdkPixbuf
 
   /* Grab the screenshot on the main window */
   root = gdk_get_default_root_window ();
+
+  sleep(delay);
+
   gdk_pixbuf_get_from_drawable (screenshot, root, NULL,
                                 rbdata.rectangle_root.x,
                                 rbdata.rectangle_root.y,
@@ -916,7 +919,7 @@ region_filter_func (GdkXEvent *xevent, GdkEvent *event, RbData *rbdata)
 
 
 static GdkPixbuf
-*get_rectangle_screenshot (void)
+*get_rectangle_screenshot (gint delay)
 {
   GdkPixbuf *screenshot = NULL;
   GdkWindow *root_window;
@@ -999,6 +1002,8 @@ static GdkPixbuf
     {
       TRACE ("Get the pixbuf for the screenshot");
 
+      sleep(delay);
+
       screenshot =
         gdk_pixbuf_get_from_drawable (NULL, root_window, NULL,
                                       rbdata.rectangle.x,
@@ -1031,10 +1036,10 @@ static GdkPixbuf
  *
  * Takes a screenshot with the given options. If @region is FULLSCREEN,
  * the screenshot is taken after @delay seconds. If @region is
- * ACTIVE_WINDOW, a delay of @delay seconds ellapses, then the active
- * window is detected and captured. If @region is SELECT, @delay will
- * be ignored and the user will have to select a portion of the screen
- * with the mouse.
+ * ACTIVE_WINDOW, a delay of @delay seconds elapses, then the active
+ * window is detected and captured. If @region is SELECT, the user will 
+ * have to select a portion of the screen with the mouse. Then a delay of
+ * @delay seconds elapses, and a screenshot is taken.
  *
  * @show_mouse is only taken into account when @region is FULLSCREEN
  * or ACTIVE_WINDOW.
@@ -1100,9 +1105,9 @@ GdkPixbuf *screenshooter_take_screenshot (gint     region,
     {
       TRACE ("Let the user select the region to screenshot");
       if (!gdk_screen_is_composited (screen))
-        screenshot = get_rectangle_screenshot ();
+        screenshot = get_rectangle_screenshot (delay);
       else
-        screenshot = get_rectangle_screenshot_composited ();
+        screenshot = get_rectangle_screenshot_composited (delay);
     }
 
   return screenshot;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list