From 8f49d77221d86aa26df35304289e6eb4822823f8 Mon Sep 17 00:00:00 2001
From: Matias Wilkman <matias.wilkman@gmail.com>
Date: Sun, 15 Nov 2015 11:30:39 +0200
Subject: [PATCH 1/4] activate delay spinner for region mode Made at meatspace
 coordinates Latitude:  61.4460115 Longitude:  23.8460739

---
 lib/screenshooter-dialogs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/screenshooter-dialogs.c b/lib/screenshooter-dialogs.c
index f3c2535..673b32a 100644
--- a/lib/screenshooter-dialogs.c
+++ b/lib/screenshooter-dialogs.c
@@ -867,11 +867,11 @@ GtkWidget *screenshooter_region_dialog_new (ScreenshotData *sd, gboolean plugin)
                     G_CALLBACK (cb_delay_spinner_changed), sd);
 
   /* Set the delay box as inactive when we capture rectangles */
-  g_signal_connect (G_OBJECT (rectangle_button), "toggled",
-                    G_CALLBACK (cb_toggle_set_insensi), delay_box);
+//  g_signal_connect (G_OBJECT (rectangle_button), "toggled",
+//  whyyyy?           G_CALLBACK (cb_toggle_set_insensi), delay_box);
 
   /* Set the default state */
-  cb_toggle_set_insensi (GTK_TOGGLE_BUTTON (rectangle_button), delay_box);
+  gtk_widget_set_sensitive (GTK_WIDGET (delay_box), TRUE);
 
   gtk_widget_show_all (GTK_DIALOG (dlg)->vbox);
 
-- 
2.6.2


From 9854d93d05ef3418d839e40546897c788f366dcf Mon Sep 17 00:00:00 2001
From: Matias Wilkman <matias.wilkman@gmail.com>
Date: Tue, 24 Nov 2015 05:13:23 +0200
Subject: [PATCH 2/4] enable delay in region mode Made at meatspace coordinates
 Latitude:  61.4459573 Longitude:  23.8462587

---
 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 f4e6e92..86356ba 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;
@@ -760,6 +760,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,
@@ -915,7 +918,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;
@@ -998,6 +1001,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,
@@ -1030,10 +1035,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.
@@ -1099,9 +1104,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;
-- 
2.6.2


From 4a0bec24dc73a65e4d5b91331f5b9636917736d5 Mon Sep 17 00:00:00 2001
From: Matias Wilkman <matias.wilkman@gmail.com>
Date: Sat, 28 Nov 2015 21:59:29 +0200
Subject: [PATCH 3/4] fixed gray overlay in region mode screenshots

Made at meatspace coordinates
Latitude:  61.4460104
Longitude:  23.8463308
---
 lib/screenshooter-capture.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/screenshooter-capture.c b/lib/screenshooter-capture.c
index 86356ba..c435bab 100644
--- a/lib/screenshooter-capture.c
+++ b/lib/screenshooter-capture.c
@@ -748,6 +748,7 @@ static GdkPixbuf
   gtk_dialog_run (GTK_DIALOG (window));
   gtk_widget_destroy (window);
   gdk_cursor_unref (xhair_cursor);
+  gdk_flush();
 
   if (cancelled)
     return NULL;
-- 
2.6.2


From 3ff3399c83d12cd531fe7f6fc6fa89a63b4f93bb Mon Sep 17 00:00:00 2001
From: Matias Wilkman <matias.wilkman@gmail.com>
Date: Sat, 28 Nov 2015 22:06:39 +0200
Subject: [PATCH 4/4] allow delay of 0 (who's got a spare second these days?)
 Made at meatspace coordinates Latitude:  61.4458788 Longitude:  23.8460876

---
 lib/screenshooter-dialogs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/screenshooter-dialogs.c b/lib/screenshooter-dialogs.c
index 673b32a..6507db9 100644
--- a/lib/screenshooter-dialogs.c
+++ b/lib/screenshooter-dialogs.c
@@ -855,7 +855,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(1.0, 60.0, 1.0);
+  delay_spinner = gtk_spin_button_new_with_range(0.0, 60.0, 0.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"));
-- 
2.6.2

