summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonsta <[email protected]>2015-12-22 14:56:07 +0300
committermonsta <[email protected]>2015-12-22 14:56:07 +0300
commitd3b8ad4bafa46a1222092401308ce7061a8f3e68 (patch)
tree91e12221d25211c3ff07d8a4d0db7bba149c0f9e
parente5d6b39cd12c2814678b543c4f5683c23ba2ccbf (diff)
downloadmate-utils-d3b8ad4bafa46a1222092401308ce7061a8f3e68.tar.bz2
mate-utils-d3b8ad4bafa46a1222092401308ce7061a8f3e68.tar.xz
mate-screenshot: reduce ifdef hell a bit
-rw-r--r--mate-screenshot/src/screenshot-utils.c31
1 files changed, 12 insertions, 19 deletions
diff --git a/mate-screenshot/src/screenshot-utils.c b/mate-screenshot/src/screenshot-utils.c
index eaeeca28..9d5d8af7 100644
--- a/mate-screenshot/src/screenshot-utils.c
+++ b/mate-screenshot/src/screenshot-utils.c
@@ -448,32 +448,25 @@ expose (GtkWidget *window, GdkEventExpose *event, gpointer unused)
static GtkWidget *
create_select_window (void)
{
- GtkWidget *window;
- GdkScreen *screen;
-#if GTK_CHECK_VERSION (3, 0, 0)
- GdkVisual *visual;
-#endif
+ GdkScreen *screen = gdk_screen_get_default ();
+ GtkWidget *window = gtk_window_new (GTK_WINDOW_POPUP);
- screen = gdk_screen_get_default ();
#if GTK_CHECK_VERSION (3, 0, 0)
- visual = gdk_screen_get_rgba_visual (screen);
-#endif
-
- window = gtk_window_new (GTK_WINDOW_POPUP);
- if (gdk_screen_is_composited (screen) &&
-#if GTK_CHECK_VERSION (3, 0, 0)
- visual)
-#else
- gdk_screen_get_rgba_colormap (screen))
-#endif
+ GdkVisual *visual = gdk_screen_get_rgba_visual (screen);
+ if (gdk_screen_is_composited (screen) && visual)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_visual (window, visual);
+ gtk_widget_set_app_paintable (window, TRUE);
+ }
#else
- gtk_widget_set_colormap (window, gdk_screen_get_rgba_colormap (screen));
-#endif
+ GdkColormap *colormap = gdk_screen_get_rgba_colormap (screen);
+ if (gdk_screen_is_composited (screen) && colormap)
+ {
+ gtk_widget_set_colormap (window, colormap);
gtk_widget_set_app_paintable (window, TRUE);
}
+#endif
+
#if GTK_CHECK_VERSION (3, 0, 0)
g_signal_connect (window, "draw", G_CALLBACK (draw), NULL);
#else