diff options
author | Alexander Mikhaylenko <alexm@gnome.org> | 2020-03-30 23:01:00 +0500 |
---|---|---|
committer | Alexander Mikhaylenko <alexm@gnome.org> | 2020-03-30 23:05:54 +0500 |
commit | 7981a6a942e12df62c590df085d3d6a10336af4f (patch) | |
tree | 6d57599c01bcf99e45dc149feeb24a0d3d51c7d7 /src | |
parent | 5dbe605c879cde0506d0908203ae0736a4aec29f (diff) | |
download | gnome-screenshot-7981a6a942e12df62c590df085d3d6a10336af4f.tar.gz |
Make X11 dependency optional
Introduce an 'x11' feature build option, and disable the fallback backend
if it's used.
Remove an unnecessary include in ScreenshotApplication.
Diffstat (limited to 'src')
-rw-r--r-- | src/screenshot-application.c | 1 | ||||
-rw-r--r-- | src/screenshot-utils.c | 22 | ||||
-rw-r--r-- | src/screenshot-utils.h | 1 |
3 files changed, 20 insertions, 4 deletions
diff --git a/src/screenshot-application.c b/src/screenshot-application.c index 1c6fe18..9836492 100644 --- a/src/screenshot-application.c +++ b/src/screenshot-application.c @@ -23,7 +23,6 @@ #include "config.h" -#include <gdk/gdkx.h> #include <gdk/gdkkeysyms.h> #include <fcntl.h> #include <unistd.h> diff --git a/src/screenshot-utils.c b/src/screenshot-utils.c index 04c0c8e..9ad46c5 100644 --- a/src/screenshot-utils.c +++ b/src/screenshot-utils.c @@ -21,6 +21,11 @@ #include "config.h" #include <gdk/gdkkeysyms.h> + +#if HAVE_X11 +#include <gdk/gdkx.h> +#endif + #include <gtk/gtk.h> #include <glib.h> #include <glib/gi18n.h> @@ -33,10 +38,12 @@ #endif #include "cheese-flash.h" + #include "screenshot-application.h" #include "screenshot-config.h" #include "screenshot-utils.h" +#ifdef HAVE_X11 static GdkWindow * screenshot_find_active_window (void) { @@ -271,6 +278,7 @@ screenshot_fallback_get_window_rect_coords (GdkWindow *window, screenshot_coordinates_out->height = height; } } +#endif /* HAVE_X11 */ void screenshot_play_sound_effect (const gchar *event_id, @@ -305,6 +313,7 @@ screenshot_play_sound_effect (const gchar *event_id, ca_proplist_destroy (p); } +#ifdef HAVE_X11 static void screenshot_fallback_fire_flash (GdkWindow *window, GdkRectangle *rectangle) @@ -584,6 +593,7 @@ screenshot_fallback_get_pixbuf (GdkRectangle *rectangle) return screenshot; } +#endif /* HAVE_X11 */ static GdkPixbuf * screenshot_shell_get_pixbuf (GdkRectangle *rectangle) @@ -656,21 +666,29 @@ GdkPixbuf * screenshot_get_pixbuf (GdkRectangle *rectangle) { GdkPixbuf *screenshot = NULL; - gboolean force_fallback; + gboolean force_fallback = FALSE; +#ifdef HAVE_X11 force_fallback = g_getenv ("GNOME_SCREENSHOT_FORCE_FALLBACK") != NULL; +#endif if (!force_fallback) { screenshot = screenshot_shell_get_pixbuf (rectangle); if (!screenshot) +#ifdef HAVE_X11 g_message ("Unable to use GNOME Shell's builtin screenshot interface, " "resorting to fallback X11."); - } +#else + g_message ("Unable to use GNOME Shell's builtin screenshot interface."); +#endif + } else g_message ("Using fallback X11 as requested"); +#ifdef HAVE_X11 if (!screenshot) screenshot = screenshot_fallback_get_pixbuf (rectangle); +#endif /* HAVE_X11 */ return screenshot; } diff --git a/src/screenshot-utils.h b/src/screenshot-utils.h index 0d83665..77e6b8c 100644 --- a/src/screenshot-utils.h +++ b/src/screenshot-utils.h @@ -20,7 +20,6 @@ #pragma once #include <gtk/gtk.h> -#include <gdk/gdkx.h> G_BEGIN_DECLS |