[Xfce4-commits] [panel-plugins/xfce4-clipman-plugin] 09/28: Use gtk_widget_get_preferred_size over gtk_widget_size_request

noreply at xfce.org noreply at xfce.org
Thu May 19 20:06:11 CEST 2016


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

ochosi pushed a commit to branch master
in repository panel-plugins/xfce4-clipman-plugin.

commit 4464e5cf27c30486b3f2c2a1d1036e6a667e1ce3
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Wed May 11 23:59:59 2016 +0200

    Use gtk_widget_get_preferred_size over gtk_widget_size_request
---
 panel-plugin/main-panel-plugin.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/panel-plugin/main-panel-plugin.c b/panel-plugin/main-panel-plugin.c
index 421c653..1832cc4 100644
--- a/panel-plugin/main-panel-plugin.c
+++ b/panel-plugin/main-panel-plugin.c
@@ -158,12 +158,13 @@ my_plugin_position_menu (GtkMenu *menu,
 {
   gboolean above = TRUE;
   gint button_width, button_height;
-  GtkRequisition requisition;
+  GtkRequisition minimum_size;
+  GtkRequisition natural_size;
   XfceScreenPosition screen_position;
 
   screen_position = xfce_panel_plugin_get_screen_position (plugin->panel_plugin);
   gtk_widget_get_size_request (plugin->button, &button_width, &button_height);
-  gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
+  gtk_widget_get_preferred_size (GTK_WIDGET (menu), &minimum_size, &natural_size);
   gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (plugin->panel_plugin)), x, y);
 
   switch (screen_position)
@@ -177,28 +178,28 @@ my_plugin_position_menu (GtkMenu *menu,
       case XFCE_SCREEN_POSITION_SE_H:
         if (above)
           /* Show menu above */
-          *y -= requisition.height;
+          *y -= minimum_size.height;
         else
           /* Show menu below */
           *y += button_height;
 
-        if (*x + requisition.width > gdk_screen_width ())
+        if (*x + minimum_size.width > gdk_screen_width ())
           /* Adjust horizontal position */
-          *x = gdk_screen_width () - requisition.width;
+          *x = gdk_screen_width () - minimum_size.width;
 
         break;
 
       default:
-        if (*x + button_width + requisition.width > gdk_screen_width ())
+        if (*x + button_width + minimum_size.width > gdk_screen_width ())
           /* Show menu on the right */
-          *x -= requisition.width;
+          *x -= minimum_size.width;
         else
           /* Show menu on the left */
           *x += button_width;
 
-        if (*y + requisition.height > gdk_screen_height ())
+        if (*y + minimum_size.height > gdk_screen_height ())
           /* Adjust vertical position */
-          *y = gdk_screen_height () - requisition.height;
+          *y = gdk_screen_height () - minimum_size.height;
 
         break;
     }

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


More information about the Xfce4-commits mailing list