plug-ins: add an (empty) Win32 backend to screenshot

and buld it unconditionally. Somebody please move the code from
win-snap to the new file.
This commit is contained in:
Michael Natterer 2016-04-02 15:02:00 +02:00
parent cb76253c67
commit d164850484
6 changed files with 117 additions and 5 deletions

View File

@ -27,8 +27,6 @@ endif
if OS_WIN32
twain = twain
win_snap = win-snap
else
screenshot = screenshot
endif
SUBDIRS = \
@ -57,7 +55,7 @@ SUBDIRS = \
map-object \
pagecurl \
$(print) \
$(screenshot) \
screenshot \
selection-to-path \
$(twain) \
ui \

View File

@ -55,4 +55,6 @@ screenshot_SOURCES = \
screenshot-osx.c \
screenshot-osx.h \
screenshot-x11.c \
screenshot-x11.h
screenshot-x11.h \
screenshot-win32.c \
screenshot-win32.h

View File

@ -0,0 +1,61 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* Screenshot plug-in
* Copyright 1998-2007 Sven Neumann <sven@gimp.org>
* Copyright 2003 Henrik Brix Andersen <brix@gimp.org>
* Copyright 2012 Simone Karin Lehmann - OS X patches
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#ifdef G_OS_WIN32
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
#include "screenshot.h"
#include "screenshot-win32.h"
gboolean
screenshot_win32_available (void)
{
return FALSE;
}
ScreenshotCapabilities
screenshot_win32_get_capabilities (void)
{
return (SCREENSHOT_CAN_SHOOT_DECORATIONS |
SCREENSHOT_CAN_SHOOT_POINTER);
}
GimpPDBStatusType
screenshot_win32_shoot (ScreenshotValues *shootvals,
GdkScreen *screen,
gint32 *image_ID,
GError **error)
{
return GIMP_PDB_EXECUTION_ERROR;
}
#endif /* G_OS_WIN32 */

View File

@ -0,0 +1,36 @@
/* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef __SCREENSHOT_WIN32_H__
#define __SCREENSHOT_WIN32_H__
#ifdef G_OS_WIN32
gboolean screenshot_win32_available (void);
ScreenshotCapabilities screenshot_win32_get_capabilities (void);
GimpPDBStatusType screenshot_win32_shoot (ScreenshotValues *shootvals,
GdkScreen *screen,
gint32 *image_ID,
GError **error);
#endif /* G_OS_WIN32 */
#endif /* __SCREENSHOT_WIN32_H__ */

View File

@ -26,9 +26,10 @@
#include <libgimp/gimpui.h>
#include "screenshot.h"
#include "screenshot-osx.h"
#include "screenshot-gnome-shell.h"
#include "screenshot-osx.h"
#include "screenshot-x11.h"
#include "screenshot-win32.h"
#include "libgimp/stdplugins-intl.h"
@ -267,6 +268,14 @@ run (const gchar *name,
}
#endif
#ifdef G_OS_WIN32
if (! backend && screenshot_win32_available ())
{
backend = SCREENSHOT_BACKEND_WIN32;
capabilities = screenshot_win32_get_capabilities ();
}
#endif
if (! backend && screenshot_gnome_shell_available ())
{
backend = SCREENSHOT_BACKEND_GNOME_SHELL;
@ -389,6 +398,11 @@ shoot (GdkScreen *screen,
return screenshot_osx_shoot (&shootvals, screen, image_ID, error);
#endif
#ifdef G_OS_WIN32
if (backend == SCREENSHOT_BACKEND_WIN32)
return screenshot_win32_shoot (&shootvals, screen, image_ID, error);
#endif
if (backend == SCREENSHOT_BACKEND_GNOME_SHELL)
return screenshot_gnome_shell_shoot (&shootvals, screen, image_ID, error);

View File

@ -23,6 +23,7 @@ typedef enum
{
SCREENSHOT_BACKEND_NONE,
SCREENSHOT_BACKEND_OSX,
SCREENSHOT_BACKEND_WIN32,
SCREENSHOT_BACKEND_GNOME_SHELL,
SCREENSHOT_BACKEND_X11
} ScreenshotBackend;