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



commit d164850484e82994a363947de3b6f40354704c03
Author: Michael Natterer <mitch gimp org>
Date:   Sat Apr 2 15:02:00 2016 +0200

    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.

 plug-ins/Makefile.am                   |    4 +--
 plug-ins/screenshot/Makefile.am        |    4 ++-
 plug-ins/screenshot/screenshot-win32.c |   61 ++++++++++++++++++++++++++++++++
 plug-ins/screenshot/screenshot-win32.h |   36 +++++++++++++++++++
 plug-ins/screenshot/screenshot.c       |   16 ++++++++-
 plug-ins/screenshot/screenshot.h       |    1 +
 6 files changed, 117 insertions(+), 5 deletions(-)
---
diff --git a/plug-ins/Makefile.am b/plug-ins/Makefile.am
index cb7ff14..c10daff 100644
--- a/plug-ins/Makefile.am
+++ b/plug-ins/Makefile.am
@@ -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                      \
diff --git a/plug-ins/screenshot/Makefile.am b/plug-ins/screenshot/Makefile.am
index 1f9c798..81bc746 100644
--- a/plug-ins/screenshot/Makefile.am
+++ b/plug-ins/screenshot/Makefile.am
@@ -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
diff --git a/plug-ins/screenshot/screenshot-win32.c b/plug-ins/screenshot/screenshot-win32.c
new file mode 100644
index 0000000..dcd5802
--- /dev/null
+++ b/plug-ins/screenshot/screenshot-win32.c
@@ -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 */
diff --git a/plug-ins/screenshot/screenshot-win32.h b/plug-ins/screenshot/screenshot-win32.h
new file mode 100644
index 0000000..66adf27
--- /dev/null
+++ b/plug-ins/screenshot/screenshot-win32.h
@@ -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__ */
diff --git a/plug-ins/screenshot/screenshot.c b/plug-ins/screenshot/screenshot.c
index 3ecd8d3..b46f4d2 100644
--- a/plug-ins/screenshot/screenshot.c
+++ b/plug-ins/screenshot/screenshot.c
@@ -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);
 
diff --git a/plug-ins/screenshot/screenshot.h b/plug-ins/screenshot/screenshot.h
index 1535493..39fb5fe 100644
--- a/plug-ins/screenshot/screenshot.h
+++ b/plug-ins/screenshot/screenshot.h
@@ -23,6 +23,7 @@ typedef enum
 {
   SCREENSHOT_BACKEND_NONE,
   SCREENSHOT_BACKEND_OSX,
+  SCREENSHOT_BACKEND_WIN32,
   SCREENSHOT_BACKEND_GNOME_SHELL,
   SCREENSHOT_BACKEND_X11
 } ScreenshotBackend;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]