[Xfce4-commits] [xfce/xfwm4] 06/32: Handle gtk_screen_width/height deprecation

noreply at xfce.org noreply at xfce.org
Tue Dec 5 09:21:52 CET 2017


This is an automated email from the git hooks/post-receive script.

o   l   i   v   i   e   r       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/xfwm4.

commit a0905eed964cf26a4c7872d472807f3c6ac2e795
Author: Viktor Odintsev <zakhams at gmail.com>
Date:   Thu Jun 29 16:43:25 2017 +0300

    Handle gtk_screen_width/height deprecation
---
 settings-dialogs/workspace-settings.c | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/settings-dialogs/workspace-settings.c b/settings-dialogs/workspace-settings.c
index 49e95b0..911032b 100644
--- a/settings-dialogs/workspace-settings.c
+++ b/settings-dialogs/workspace-settings.c
@@ -300,6 +300,30 @@ workspace_dialog_setup_names_treeview(GtkBuilder *builder,
                      G_CALLBACK(xfconf_workspace_names_changed), treeview);
 }
 
+
+
+static void
+workspace_dialog_get_screen_dimensions (gint *width, gint *height)
+{
+#if GTK_CHECK_VERSION(3, 22, 0)
+    GdkDisplay   *display;
+    GdkMonitor   *monitor;
+    GdkRectangle  geometry;
+
+    display = gdk_display_get_default ();
+    monitor = gdk_display_get_primary_monitor (display);
+    gdk_monitor_get_geometry (monitor, &geometry);
+
+    *width = geometry.width;
+    *height = geometry.height;
+#else
+    *width = gdk_screen_width ();
+    *height = gdk_screen_height ();
+#endif
+}
+
+
+
 static void
 workspace_dialog_configure_widgets (GtkBuilder *builder,
                                     XfconfChannel *channel)
@@ -328,8 +352,9 @@ workspace_dialog_configure_widgets (GtkBuilder *builder,
     }
 
     /* Set max margins range */
-    wmax = gdk_screen_width () / 4;
-    hmax = gdk_screen_height () / 4;
+    workspace_dialog_get_screen_dimensions (&wmax, &hmax);
+    wmax /= 4;
+    hmax /= 4;
 
     gtk_spin_button_set_range (GTK_SPIN_BUTTON (margin_top_spinbutton), 0, hmax);
     gtk_spin_button_set_range (GTK_SPIN_BUTTON (margin_right_spinbutton), 0, wmax);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list