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

ninetls pushed a 
commit to branch 
master
in repository panel-plugins/xfce4-statusnotifier-plugin.

commit 52cbbdb446fdd60d39b421e197277969789aa413
Author: Viktor Odintsev <nine...@xfce.org>
Date:   Sat Aug 5 22:15:39 2017 +0300

    Fix menu positioning
---
 panel-plugin/sn-button.c | 21 +++++++++++++++++++--
 panel-plugin/sn-plugin.c |  1 -
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/panel-plugin/sn-button.c b/panel-plugin/sn-button.c
index f43e94e..8023dd0 100644
--- a/panel-plugin/sn-button.c
+++ b/panel-plugin/sn-button.c
@@ -76,6 +76,7 @@ struct _SnButton
   GtkWidget           *box;
 
   guint                menu_deactivate_handler;
+  guint                menu_size_allocate_handler;
 };
 
 G_DEFINE_TYPE (SnButton, sn_button, GTK_TYPE_BUTTON)
@@ -132,6 +133,7 @@ sn_button_init (SnButton *button)
   button->box = NULL;
 
   button->menu_deactivate_handler = 0;
+  button->menu_size_allocate_handler = 0;
 
   gtk_widget_set_halign (GTK_WIDGET (button), GTK_ALIGN_FILL);
   gtk_widget_set_valign (GTK_WIDGET (button), GTK_ALIGN_FILL);
@@ -202,6 +204,9 @@ sn_button_finalize (GObject *object)
   if (button->menu_deactivate_handler != 0)
     g_signal_handler_disconnect (button->menu, 
button->menu_deactivate_handler);
 
+  if (button->menu_size_allocate_handler != 0)
+    g_signal_handler_disconnect (button->menu, 
button->menu_size_allocate_handler);
+
   G_OBJECT_CLASS (sn_button_parent_class)->finalize (object);
 }
 
@@ -252,7 +257,7 @@ sn_button_button_press (GtkWidget      *widget,
           button->menu_deactivate_handler = 
             g_signal_connect_swapped (G_OBJECT (button->menu), "deactivate",
                                       G_CALLBACK (sn_button_menu_deactivate), 
button);
-          gtk_menu_reposition (GTK_MENU (button->menu));
+
 #if GTK_CHECK_VERSION(3, 22, 0)
           gtk_menu_popup_at_widget (GTK_MENU (button->menu), widget,
                                     GDK_GRAVITY_NORTH_WEST, 
GDK_GRAVITY_NORTH_WEST,
@@ -356,6 +361,12 @@ sn_button_menu_changed (GtkWidget *widget,
           gtk_menu_popdown (GTK_MENU (button->menu));
         }
 
+      if (button->menu_size_allocate_handler != 0)
+        {
+          g_signal_handler_disconnect (button->menu, 
button->menu_size_allocate_handler);
+          button->menu_size_allocate_handler = 0;
+        }
+
       gtk_menu_detach (GTK_MENU (button->menu));
     }
 
@@ -363,7 +374,13 @@ sn_button_menu_changed (GtkWidget *widget,
   button->menu = sn_item_get_menu (item);
 
   if (button->menu != NULL)
-    gtk_menu_attach_to_widget (GTK_MENU (button->menu), GTK_WIDGET (button), 
NULL);
+    {
+      gtk_menu_attach_to_widget (GTK_MENU (button->menu), GTK_WIDGET (button), 
NULL);
+      /* restore menu position to its corner if size was changed */
+      button->menu_size_allocate_handler =
+        g_signal_connect (button->menu, "size-allocate",
+                          G_CALLBACK (gtk_menu_reposition), NULL);
+    }
 }
 
 
diff --git a/panel-plugin/sn-plugin.c b/panel-plugin/sn-plugin.c
index 8b742ab..f503b30 100644
--- a/panel-plugin/sn-plugin.c
+++ b/panel-plugin/sn-plugin.c
@@ -104,7 +104,6 @@ static void
 sn_plugin_free (XfcePanelPlugin *panel_plugin)
 {
   SnPlugin *plugin = XFCE_SN_PLUGIN (panel_plugin);
-  GList    *children, *li;
 
   /* remove children so they won't use unrefed SnItems and SnConfig */
   gtk_container_remove (GTK_CONTAINER (panel_plugin), plugin->box);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits

Reply via email to