[gnome-screenshot] utils: add an env variable to force fallback code path
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-screenshot] utils: add an env variable to force fallback code path
- Date: Wed, 24 Jul 2019 18:36:30 +0000 (UTC)
commit 5ba08bfadfba3ce6f7455435336d702ff264b2d3
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Wed Jul 24 13:25:36 2019 +0200
utils: add an env variable to force fallback code path
This will be useful to debug issues with it.
src/screenshot-utils.c | 29 ++++++++++++++++++++++-------
1 file changed, 22 insertions(+), 7 deletions(-)
---
diff --git a/src/screenshot-utils.c b/src/screenshot-utils.c
index 261fd71..b27a8c8 100644
--- a/src/screenshot-utils.c
+++ b/src/screenshot-utils.c
@@ -580,8 +580,8 @@ screenshot_fallback_get_pixbuf (GdkRectangle *rectangle)
return screenshot;
}
-GdkPixbuf *
-screenshot_get_pixbuf (GdkRectangle *rectangle)
+static GdkPixbuf *
+screenshot_shell_get_pixbuf (GdkRectangle *rectangle)
{
g_autoptr(GError) error = NULL;
g_autofree gchar *path = NULL, *filename = NULL, *tmpname = NULL;
@@ -644,13 +644,28 @@ screenshot_get_pixbuf (GdkRectangle *rectangle)
g_unlink (filename);
}
- if (error != NULL)
- {
- g_message ("Unable to use GNOME Shell's builtin screenshot interface, "
- "resorting to fallback X11.");
+ return screenshot;
+}
+
+GdkPixbuf *
+screenshot_get_pixbuf (GdkRectangle *rectangle)
+{
+ GdkPixbuf *screenshot = NULL;
+ gboolean force_fallback;
- screenshot = screenshot_fallback_get_pixbuf (rectangle);
+ force_fallback = g_getenv ("GNOME_SCREENSHOT_FORCE_FALLBACK") != NULL;
+ if (!force_fallback)
+ {
+ screenshot = screenshot_shell_get_pixbuf (rectangle);
+ if (!screenshot)
+ g_message ("Unable to use GNOME Shell's builtin screenshot interface, "
+ "resorting to fallback X11.");
}
+ else
+ g_message ("Using fallback X11 as requested");
+
+ if (!screenshot)
+ screenshot = screenshot_fallback_get_pixbuf (rectangle);
return screenshot;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]