gimp/plug-ins/screenshot/screenshot.h

63 lines
1.8 KiB
C
Raw Normal View History

/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef __SCREENSHOT_H__
#define __SCREENSHOT_H__
typedef enum
{
SCREENSHOT_BACKEND_NONE,
SCREENSHOT_BACKEND_OSX,
SCREENSHOT_BACKEND_WIN32,
plug-ins: implementation of the Freedesktop portal for screenshot. I am told by the GNOME/Flatpak people that this is what we will ultimately need to implement. Basically this portal is supposed to work everywhere, in sandboxes (Flatpak, hopefully Snap too?), but also out of sandboxes, i.e. in GNOME and KDE, whether Wayland or X11. So that should be the unique API we will have to implement in the end, and every desktop environment/sandbox will need to implement this API (which is good!). Apparently it is not part of default GNOME yet, but has to be installed separately (on Fedora, package is xdg-desktop-portal-gtk for GNOME and xdg-desktop-portal-kde for KDE). Now there are currently many shortcomings, and in particular, the screenshot API has apparently no advanced features (at all!). No window snap, no rectangular selection, no delaying, no choice on including cursor or decoration, nothing! Apparently this is normal that the API presents no feature, because "the API itself is not meant to specify the details how the screenshot is obtained. Instead the portal will present the user a dialog to take a screenshot, and that screenshot will be given back to the sandboxed app". This is acceptable behavior, except that currently, the dialog has none of the basic features so this is a very bad regression. This is why I test the freedesktop API last, which basically means it will likely never be actually used. That's on purpose. At least, the code is in and will be easy to improve later. Of course, when the Freedesktop portal for screenshot will finally be featureful, it is meant to be tested first. See: https://github.com/flatpak/xdg-desktop-portal/blob/master/data/org.freedesktop.portal.Screenshot.xml
2017-12-16 09:15:57 +08:00
SCREENSHOT_BACKEND_FREEDESKTOP,
SCREENSHOT_BACKEND_X11
} ScreenshotBackend;
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,
/* SHOOT_WINDOW mode only: if 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,
SCREENSHOT_CAN_SHOOT_WINDOW = 0x1 << 6
} ScreenshotCapabilities;
typedef enum
{
SCREENSHOT_PROFILE_POLICY_MONITOR,
SCREENSHOT_PROFILE_POLICY_SRGB
} ScreenshotProfilePolicy;
typedef enum
{
SHOOT_WINDOW,
SHOOT_ROOT,
SHOOT_REGION
} ShootType;
void screenshot_wait_delay (gint seconds);
#endif /* __SCREENSHOT_H__ */