[gimp] plug-ins: add SCREENSHOT_CAN_DELAY_WINDOW_SHOT capability to screenshot.
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins: add SCREENSHOT_CAN_DELAY_WINDOW_SHOT capability to screenshot.
- Date: Sun, 10 Dec 2017 00:52:20 +0000 (UTC)
commit f9076ae294e9dc6492875d7242f18e75c7528b72
Author: Jehan <jehan girinstud io>
Date: Sun Dec 10 01:30:31 2017 +0100
plug-ins: add SCREENSHOT_CAN_DELAY_WINDOW_SHOT capability to screenshot.
This indicates if a delay can be inserted in-between the window pick and
the actual shot. This is indeed not always possible, for instance using
KWin API. Obviously this feature is only meaningful if
SCREENSHOT_CAN_PICK_WINDOW feature is enabled as well. For instance X11
screenshot has the feature, but GNOME won't need it since there is no
window selection (it simply snaps whatever is the active window).
plug-ins/screenshot/screenshot-x11.c | 3 ++-
plug-ins/screenshot/screenshot.c | 22 +++++++++++++++++++++-
plug-ins/screenshot/screenshot.h | 6 +++++-
3 files changed, 28 insertions(+), 3 deletions(-)
---
diff --git a/plug-ins/screenshot/screenshot-x11.c b/plug-ins/screenshot/screenshot-x11.c
index 63c7cf1..b905255 100644
--- a/plug-ins/screenshot/screenshot-x11.c
+++ b/plug-ins/screenshot/screenshot-x11.c
@@ -544,7 +544,8 @@ screenshot_x11_get_capabilities (void)
#endif
capabilities |= SCREENSHOT_CAN_SHOOT_REGION |
- SCREENSHOT_CAN_PICK_WINDOW;
+ SCREENSHOT_CAN_PICK_WINDOW |
+ SCREENSHOT_CAN_DELAY_WINDOW_SHOT;
return capabilities;
}
diff --git a/plug-ins/screenshot/screenshot.c b/plug-ins/screenshot/screenshot.c
index 69baa45..f54ae44 100644
--- a/plug-ins/screenshot/screenshot.c
+++ b/plug-ins/screenshot/screenshot.c
@@ -73,6 +73,7 @@ static gboolean shoot_delay_timeout (gpointer data);
static ScreenshotBackend backend = SCREENSHOT_BACKEND_NONE;
static ScreenshotCapabilities capabilities = 0;
static GtkWidget *select_delay_table = NULL;
+static GtkWidget *shot_delay_table = NULL;
static ScreenshotValues shootvals =
{
@@ -420,6 +421,19 @@ shoot_radio_button_toggled (GtkWidget *widget,
gtk_widget_show (select_delay_table);
}
}
+ if (shot_delay_table)
+ {
+ if (shootvals.shoot_type == SHOOT_WINDOW &&
+ (capabilities & SCREENSHOT_CAN_PICK_WINDOW) &&
+ ! (capabilities & SCREENSHOT_CAN_DELAY_WINDOW_SHOT))
+ {
+ gtk_widget_hide (shot_delay_table);
+ }
+ else
+ {
+ gtk_widget_show (shot_delay_table);
+ }
+ }
gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), shootvals.shoot_type);
}
@@ -695,8 +709,14 @@ shoot_dialog (GdkScreen **screen)
/* Screenshot delay */
table = gtk_table_new (2, 3, FALSE);
+ shot_delay_table = table;
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
- gtk_widget_show (table);
+ if (shootvals.shoot_type != SHOOT_WINDOW ||
+ ! (capabilities & SCREENSHOT_CAN_PICK_WINDOW) ||
+ (capabilities & SCREENSHOT_CAN_DELAY_WINDOW_SHOT))
+ {
+ gtk_widget_show (table);
+ }
label = gtk_label_new (_("Screenshot delay: "));
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
diff --git a/plug-ins/screenshot/screenshot.h b/plug-ins/screenshot/screenshot.h
index b8f80ad..57e5ae8 100644
--- a/plug-ins/screenshot/screenshot.h
+++ b/plug-ins/screenshot/screenshot.h
@@ -35,7 +35,11 @@ typedef enum
SCREENSHOT_CAN_SHOOT_POINTER = 0x1 << 1,
SCREENSHOT_CAN_PICK_NONINTERACTIVELY = 0x1 << 2,
SCREENSHOT_CAN_SHOOT_REGION = 0x1 << 3,
- SCREENSHOT_CAN_PICK_WINDOW = 0x1 << 4
+ /* SHOOT_WINDOW mode only: it window selection requires active click. */
+ SCREENSHOT_CAN_PICK_WINDOW = 0x1 << 4,
+ /* SHOOT_WINDOW + SCREENSHOT_CAN_PICK_WINDOW only: if a delay can be
+ * inserted in-between selection click and actual snapshot. */
+ SCREENSHOT_CAN_DELAY_WINDOW_SHOT = 0x1 << 5
} ScreenshotCapabilities;
typedef enum
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]