From 312e23c23cb23be7bdeadc89270ed5098511571b Mon Sep 17 00:00:00 2001 From: Dustin Falgout Date: Sat, 29 Oct 2016 23:51:29 -0500 Subject: [PATCH] discontinue use of some deprecated methods if built with gtk 3.22+ --- meson.build | 10 ++++++++-- src/greeter.c | 9 ++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index c619530..73c0ab6 100644 --- a/meson.build +++ b/meson.build @@ -30,7 +30,7 @@ webext_deps = [webkit2_webext, lightdm_gobject] has_webkitgtk_2_14 = webkit2.version().version_compare('>=2.14.0') has_lightdm_1_19_2 = lightdm_gobject.version().version_compare('>=1.19.2') - +has_gtk_3_22 = gtk3.version().version_compare('>=3.22') # =================================== # # ------->>> Configuration <<<------- # @@ -56,12 +56,18 @@ conf.set('DESKTOP_DIR', '"@0@"'.format(get_option('with-desktop-dir'))) conf.set('WEBEXT_DIR', '"@0@"'.format(get_option('with-webext-dir'))) -conf.set('HAS_WEBKITGTK_2_14', has_webkitgtk_2_14) +if has_webkitgtk_2_14 + conf.set('HAS_WEBKITGTK_2_14', has_webkitgtk_2_14) +endif if has_lightdm_1_19_2 conf.set('HAS_LIGHTDM_1_19_2', has_lightdm_1_19_2) endif +if has_gtk_3_22 + conf.set('HAS_GTK_3_22', has_gtk_3_22) +endif + # ===================================== # # ------->>> Sub Directories <<<------- # diff --git a/src/greeter.c b/src/greeter.c index cfbbbbe..aef20b5 100644 --- a/src/greeter.c +++ b/src/greeter.c @@ -373,7 +373,14 @@ main(int argc, char **argv) { screen = gtk_window_get_screen(GTK_WINDOW(window)); gtk_window_set_decorated(GTK_WINDOW(window), FALSE); - gdk_screen_get_monitor_geometry(screen, gdk_screen_get_primary_monitor(screen), &geometry); + + #ifdef HAS_GTK_3_22 + GdkMonitor *monitor = gdk_display_get_primary_monitor(default_display); + gdk_monitor_get_geometry(monitor, &geometry); + #else + gdk_screen_get_monitor_geometry(screen, gdk_screen_get_primary_monitor(screen), &geometry); + #endif + gtk_window_set_default_size(GTK_WINDOW(window), geometry.width, geometry.height); gtk_window_move(GTK_WINDOW(window), geometry.x, geometry.y);