Commit f9076ae2 authored by Jehan's avatar Jehan
Browse files

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).
parent 01c39c8f
......@@ -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;
}
......
......@@ -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,
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment