Commit b57c89dd authored by Jehan's avatar Jehan

plug-ins: differentiate a delay before the area/window selection...

... and a delay before the screenshot.
Until now, there was only delay before selection, which I changed in
commits d9cd4b61 and 614bcf6d. Actually a delay before selection may
also be useful, for instance when you use a tablet without keyboard (no
alt-tab possible) and the window/area you wish to capture is behind GIMP
window. Then you'd want to interact with the desktop with the pointer
before the cursor changes for selection interaction.
I add some logics so that the selection delay doesn't show when it is
unecessary (for instance for full-screen screenshot, or when the window
screenshot is based on the active window, not click selection, like with
GNOME shell API).
parent 1a1b1757
......@@ -92,8 +92,8 @@ screenshot_gnome_shell_shoot (ScreenshotValues *shootvals,
switch (shootvals->shoot_type)
{
case SHOOT_ROOT:
if (shootvals->select_delay > 0)
screenshot_delay (shootvals->select_delay);
if (shootvals->screenshot_delay > 0)
screenshot_delay (shootvals->screenshot_delay);
method = "Screenshot";
args = g_variant_new ("(bbs)",
......@@ -105,6 +105,9 @@ screenshot_gnome_shell_shoot (ScreenshotValues *shootvals,
break;
case SHOOT_REGION:
if (shootvals->select_delay > 0)
screenshot_delay (shootvals->select_delay);
retval = g_dbus_proxy_call_sync (proxy, "SelectArea", NULL,
G_DBUS_CALL_FLAGS_NONE,
-1, NULL, error);
......@@ -134,14 +137,14 @@ screenshot_gnome_shell_shoot (ScreenshotValues *shootvals,
gdk_screen_get_monitor_at_point (screen,
(shootvals->x1 + shootvals->x2) / 2,
(shootvals->y1 + shootvals->y2) / 2);
if (shootvals->select_delay > 0)
screenshot_delay (shootvals->select_delay);
if (shootvals->screenshot_delay > 0)
screenshot_delay (shootvals->screenshot_delay);
break;
case SHOOT_WINDOW:
if (shootvals->select_delay > 0)
screenshot_delay (shootvals->select_delay);
if (shootvals->screenshot_delay > 0)
screenshot_delay (shootvals->screenshot_delay);
method = "ScreenshotWindow";
args = g_variant_new ("(bbbs)",
......
......@@ -71,7 +71,8 @@ ScreenshotCapabilities
screenshot_kwin_get_capabilities (void)
{
return (SCREENSHOT_CAN_SHOOT_DECORATIONS |
SCREENSHOT_CAN_SHOOT_POINTER);
SCREENSHOT_CAN_SHOOT_POINTER |
SCREENSHOT_CAN_PICK_WINDOW);
/* TODO: SCREENSHOT_CAN_SHOOT_REGION.
* The KDE API has "screenshotArea" method but no method to get
* coordinates could be found. See below.
......@@ -97,6 +98,9 @@ screenshot_kwin_shoot (ScreenshotValues *shootvals,
switch (shootvals->shoot_type)
{
case SHOOT_ROOT:
if (shootvals->screenshot_delay > 0)
screenshot_delay (shootvals->screenshot_delay);
method = "screenshotFullscreen";
args = g_variant_new ("(b)", shootvals->show_cursor);
......@@ -125,6 +129,9 @@ screenshot_kwin_shoot (ScreenshotValues *shootvals,
break;
case SHOOT_WINDOW:
if (shootvals->select_delay > 0)
screenshot_delay (shootvals->select_delay);
/* XXX I expected "screenshotWindowUnderCursor" method to be the
* right one, but it returns nothing, nor is there a file
* descriptor in argument. So I don't understand how to grab the
......
......@@ -543,7 +543,8 @@ screenshot_x11_get_capabilities (void)
capabilities |= SCREENSHOT_CAN_SHOOT_POINTER;
#endif
capabilities |= SCREENSHOT_CAN_SHOOT_REGION;
capabilities |= SCREENSHOT_CAN_SHOOT_REGION |
SCREENSHOT_CAN_PICK_WINDOW;
return capabilities;
}
......@@ -574,14 +575,17 @@ screenshot_x11_shoot (ScreenshotValues *shootvals,
if (shootvals->shoot_type != SHOOT_ROOT && ! shootvals->window_id)
{
if (shootvals->select_delay > 0)
screenshot_delay (shootvals->select_delay);
shootvals->window_id = select_window (shootvals, screen);
if (! shootvals->window_id)
return GIMP_PDB_CANCEL;
}
if (shootvals->select_delay > 0)
screenshot_delay (shootvals->select_delay);
if (shootvals->screenshot_delay > 0)
screenshot_delay (shootvals->screenshot_delay);
display = gdk_screen_get_display (screen);
......
This diff is collapsed.
......@@ -34,7 +34,8 @@ typedef enum
SCREENSHOT_CAN_SHOOT_DECORATIONS = 0x1 << 0,
SCREENSHOT_CAN_SHOOT_POINTER = 0x1 << 1,
SCREENSHOT_CAN_PICK_NONINTERACTIVELY = 0x1 << 2,
SCREENSHOT_CAN_SHOOT_REGION = 0x1 << 3
SCREENSHOT_CAN_SHOOT_REGION = 0x1 << 3,
SCREENSHOT_CAN_PICK_WINDOW = 0x1 << 4
} ScreenshotCapabilities;
typedef enum
......@@ -57,6 +58,7 @@ typedef struct
guint window_id;
gint monitor;
guint select_delay;
guint screenshot_delay;
gint x1;
gint y1;
gint x2;
......
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