[Xfce4-commits] [xfce/xfce4-panel] 01/02: Fix deprecations in xfce-panel-plugin

noreply at xfce.org noreply at xfce.org
Fri Nov 9 00:20:10 CET 2018


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

o   c   h   o   s   i       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/xfce4-panel.

commit 6a7a2ace8d3c008104736b8fb20731382eea862a
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Fri Nov 9 00:19:38 2018 +0100

    Fix deprecations in xfce-panel-plugin
---
 libxfce4panel/xfce-panel-plugin.c | 55 ++++++++++++++++++++++++++-------------
 1 file changed, 37 insertions(+), 18 deletions(-)

diff --git a/libxfce4panel/xfce-panel-plugin.c b/libxfce4panel/xfce-panel-plugin.c
index 54b5158..dff6935 100644
--- a/libxfce4panel/xfce-panel-plugin.c
+++ b/libxfce4panel/xfce-panel-plugin.c
@@ -218,8 +218,6 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass)
   GObjectClass   *gobject_class;
   GtkWidgetClass *gtkwidget_class;
 
-  g_type_class_add_private (klass, sizeof (XfcePanelPluginPrivate));
-
   klass->construct = NULL;
 
   gobject_class = G_OBJECT_CLASS (klass);
@@ -681,7 +679,7 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass)
 static void
 xfce_panel_plugin_init (XfcePanelPlugin *plugin)
 {
-  plugin->priv = G_TYPE_INSTANCE_GET_PRIVATE (plugin, XFCE_TYPE_PANEL_PLUGIN, XfcePanelPluginPrivate);
+  plugin->priv = xfce_panel_plugin_get_instance_private (plugin);
 
   plugin->priv->name = NULL;
   plugin->priv->display_name = NULL;
@@ -2433,8 +2431,13 @@ xfce_panel_plugin_arrow_type (XfcePanelPlugin *plugin)
 {
   XfceScreenPosition  screen_position;
   GdkScreen          *screen;
+#if GTK_CHECK_VERSION (3, 22, 0)
+  GdkDisplay         *display;
+  GdkMonitor         *monitor;
+#else
   gint                monitor_num;
-  GdkRectangle        monitor;
+#endif
+  GdkRectangle        geometry;
   gint                x, y;
   GdkWindow          *window;
 
@@ -2461,17 +2464,22 @@ xfce_panel_plugin_arrow_type (XfcePanelPlugin *plugin)
 
       /* get the monitor geometry */
       screen = gtk_widget_get_screen (GTK_WIDGET (plugin));
+#if GTK_CHECK_VERSION (3, 22, 0)
+      display = gdk_screen_get_display (screen);
+      monitor = gdk_display_get_monitor_at_window (display, window);
+      gdk_monitor_get_geometry (monitor, &geometry);
+#else
       monitor_num = gdk_screen_get_monitor_at_window (screen, window);
-      gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
-
+      gdk_screen_get_monitor_geometry (screen, monitor_num, &geometry);
+#endif
       /* get the plugin root origin */
       gdk_window_get_root_origin (window, &x, &y);
 
       /* detect arrow type */
       if (screen_position == XFCE_SCREEN_POSITION_FLOATING_H)
-        return (y < (monitor.y + monitor.height / 2)) ? GTK_ARROW_DOWN : GTK_ARROW_UP;
+        return (y < (geometry.y + geometry.height / 2)) ? GTK_ARROW_DOWN : GTK_ARROW_UP;
       else
-        return (x < (monitor.x + monitor.width / 2)) ? GTK_ARROW_RIGHT : GTK_ARROW_LEFT;
+        return (x < (geometry.x + geometry.width / 2)) ? GTK_ARROW_RIGHT : GTK_ARROW_LEFT;
     }
 }
 
@@ -2504,8 +2512,13 @@ xfce_panel_plugin_position_widget (XfcePanelPlugin *plugin,
 {
   GtkRequisition  requisition;
   GdkScreen      *screen;
-  GdkRectangle    monitor;
+  GdkRectangle    geometry;
+#if GTK_CHECK_VERSION (3, 22, 0)
+  GdkDisplay     *display;
+  GdkMonitor     *monitor;
+#else
   gint            monitor_num;
+#endif
   GTimeVal        now_t, end_t;
   GtkWidget      *toplevel, *plug;
   gint            px, py;
@@ -2605,18 +2618,24 @@ xfce_panel_plugin_position_widget (XfcePanelPlugin *plugin,
 
   /* get the monitor geometry */
   screen = gtk_widget_get_screen (attach_widget);
+#if GTK_CHECK_VERSION (3, 22, 0)
+  display = gdk_screen_get_display (screen);
+  monitor = gdk_display_get_monitor_at_window (display, gtk_widget_get_window (attach_widget));
+  gdk_monitor_get_geometry (monitor, &geometry);
+#else
   monitor_num = gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (attach_widget));
-  gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
+  gdk_screen_get_monitor_geometry (screen, monitor_num, &geometry);
+#endif
 
   /* keep the menu inside the screen */
-  if (*x > monitor.x + monitor.width - requisition.width)
-    *x = monitor.x + monitor.width - requisition.width;
-  if (*x < monitor.x)
-    *x = monitor.x;
-  if (*y > monitor.y + monitor.height - requisition.height)
-    *y = monitor.y + monitor.height - requisition.height;
-  if (*y < monitor.y)
-    *y = monitor.y;
+  if (*x > geometry.x + geometry.width - requisition.width)
+    *x = geometry.x + geometry.width - requisition.width;
+  if (*x < geometry.x)
+    *x = geometry.x;
+  if (*y > geometry.y + geometry.height - requisition.height)
+    *y = geometry.y + geometry.height - requisition.height;
+  if (*y < geometry.y)
+    *y = geometry.y;
 
   /* popup on the correct screen */
   if (G_LIKELY (GTK_IS_MENU (menu_widget)))

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


More information about the Xfce4-commits mailing list