[Xfce4-commits] [xfce/xfce4-panel] 04/04: Fix anchors for gtk_menu_popup_at_widget

noreply at xfce.org noreply at xfce.org
Sun Dec 2 23:59:40 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 0dba5bc9cfd35fe35e9d7acb5791b08b8e38cece
Author: Alistair Buxton <a.j.buxton at gmail.com>
Date:   Sat Dec 1 20:43:34 2018 +0000

    Fix anchors for gtk_menu_popup_at_widget
    
    This fixes the use of anchors throughout the panel codebase.
    
    In most cases the menu position depends on the panel orientation.
    If the panel is vertical then the top left corner of the menu is
    aligned with the top right corner of the widget. If the panel is
    horizontal then the top left corner of the menu is aligned with
    the bottom left corner of the widget.
    
    In one case the logic is different: the menu which pops up when
    right clicking the window list dropdown is adjusted to behave
    like a normal cascading menu.
    
    Only one usage of gtk_menu_popup_at_widget is not modified:
    The dropdown menu for when a launcher has multiple actions appears
    to be correct already.
    
    Note that gdk automatically flips anchors to make the menu fit
    on screen, so this automatically works if the panel is on the
    right or bottom edge of the screen.
    
    Fixes bug #14803
---
 plugins/actions/actions.c                   |  5 ++---
 plugins/applicationsmenu/applicationsmenu.c |  5 ++---
 plugins/directorymenu/directorymenu.c       |  5 ++---
 plugins/launcher/launcher.c                 |  5 ++---
 plugins/tasklist/tasklist-widget.c          | 15 ++++++---------
 plugins/windowmenu/windowmenu.c             |  7 +++----
 6 files changed, 17 insertions(+), 25 deletions(-)

diff --git a/plugins/actions/actions.c b/plugins/actions/actions.c
index e20ccdb..69482e9 100644
--- a/plugins/actions/actions.c
+++ b/plugins/actions/actions.c
@@ -1345,8 +1345,7 @@ actions_plugin_menu (GtkWidget     *button,
 
   gtk_menu_popup_at_widget (GTK_MENU (plugin->menu), button,
                             xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)) == GTK_ORIENTATION_VERTICAL
-                            ? GDK_GRAVITY_WEST : GDK_GRAVITY_NORTH,
-                            xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)) == GTK_ORIENTATION_VERTICAL
-                            ? GDK_GRAVITY_EAST : GDK_GRAVITY_SOUTH,
+                            ? GDK_GRAVITY_NORTH_EAST : GDK_GRAVITY_SOUTH_WEST,
+                            GDK_GRAVITY_NORTH_WEST,
                             NULL);
 }
diff --git a/plugins/applicationsmenu/applicationsmenu.c b/plugins/applicationsmenu/applicationsmenu.c
index de9de6d..d2a0920 100644
--- a/plugins/applicationsmenu/applicationsmenu.c
+++ b/plugins/applicationsmenu/applicationsmenu.c
@@ -782,9 +782,8 @@ applications_menu_plugin_menu (GtkWidget              *button,
   /* show the menu */
   gtk_menu_popup_at_widget (GTK_MENU (plugin->menu), button,
                             xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)) == GTK_ORIENTATION_VERTICAL
-                            ? GDK_GRAVITY_WEST : GDK_GRAVITY_NORTH,
-                            xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)) == GTK_ORIENTATION_VERTICAL
-                            ? GDK_GRAVITY_EAST : GDK_GRAVITY_SOUTH,
+                            ? GDK_GRAVITY_NORTH_EAST : GDK_GRAVITY_SOUTH_WEST,
+                            GDK_GRAVITY_NORTH_WEST,
                             (GdkEvent *) event);
 
   return TRUE;
diff --git a/plugins/directorymenu/directorymenu.c b/plugins/directorymenu/directorymenu.c
index 6be1d5c..850084b 100644
--- a/plugins/directorymenu/directorymenu.c
+++ b/plugins/directorymenu/directorymenu.c
@@ -1014,8 +1014,7 @@ directory_menu_plugin_menu (GtkWidget           *button,
 
   gtk_menu_popup_at_widget (GTK_MENU (menu), button,
                             xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)) == GTK_ORIENTATION_VERTICAL
-                            ? GDK_GRAVITY_WEST : GDK_GRAVITY_NORTH,
-                            xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)) == GTK_ORIENTATION_VERTICAL
-                            ? GDK_GRAVITY_EAST : GDK_GRAVITY_SOUTH,
+                            ? GDK_GRAVITY_NORTH_EAST : GDK_GRAVITY_SOUTH_WEST,
+                            GDK_GRAVITY_NORTH_WEST,
                             NULL);
 }
diff --git a/plugins/launcher/launcher.c b/plugins/launcher/launcher.c
index bf957d8..3aa64d3 100644
--- a/plugins/launcher/launcher.c
+++ b/plugins/launcher/launcher.c
@@ -1702,9 +1702,8 @@ launcher_plugin_menu_popup (gpointer user_data)
   gtk_menu_popup_at_widget (GTK_MENU (plugin->menu),
                             plugin->button,
                             xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)) == GTK_ORIENTATION_VERTICAL
-                            ? GDK_GRAVITY_WEST : GDK_GRAVITY_NORTH,
-                            xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)) == GTK_ORIENTATION_VERTICAL
-                            ? GDK_GRAVITY_EAST : GDK_GRAVITY_SOUTH,
+                            ? GDK_GRAVITY_NORTH_EAST : GDK_GRAVITY_SOUTH_WEST,
+                            GDK_GRAVITY_NORTH_WEST,
                             NULL);
 
   /* fallback to manual positioning, this is used with
diff --git a/plugins/tasklist/tasklist-widget.c b/plugins/tasklist/tasklist-widget.c
index a79c9ff..8eaa358 100644
--- a/plugins/tasklist/tasklist-widget.c
+++ b/plugins/tasklist/tasklist-widget.c
@@ -1515,9 +1515,8 @@ xfce_tasklist_arrow_button_toggled (GtkWidget    *button,
       gtk_menu_attach_to_widget (GTK_MENU (menu), button, NULL);
       gtk_menu_popup_at_widget (GTK_MENU (menu), button,
                                 xfce_tasklist_vertical (tasklist)
-                                ? GDK_GRAVITY_WEST : GDK_GRAVITY_NORTH_EAST,
-                                xfce_tasklist_vertical (tasklist)
-                                ? GDK_GRAVITY_EAST : GDK_GRAVITY_SOUTH_EAST,
+                                ? GDK_GRAVITY_NORTH_EAST : GDK_GRAVITY_SOUTH_WEST,
+                                GDK_GRAVITY_NORTH_WEST,
                                 NULL);
     }
 }
@@ -2919,9 +2918,8 @@ xfce_tasklist_button_button_press_event (GtkWidget         *button,
       gtk_menu_attach_to_widget (GTK_MENU (menu), button, NULL);
       gtk_menu_popup_at_widget (GTK_MENU (menu), button,
                                 xfce_tasklist_vertical (child->tasklist)
-                                ? GDK_GRAVITY_SOUTH_EAST : GDK_GRAVITY_NORTH_WEST,
-                                xfce_tasklist_vertical (child->tasklist)
-                                ? GDK_GRAVITY_SOUTH_EAST : GDK_GRAVITY_SOUTH_WEST,
+                                ? GDK_GRAVITY_NORTH_EAST : GDK_GRAVITY_SOUTH_WEST,
+                                GDK_GRAVITY_NORTH_WEST,
                                 (GdkEvent *) event);
 
       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
@@ -3657,9 +3655,8 @@ xfce_tasklist_group_button_button_press_event (GtkWidget         *button,
       gtk_menu_attach_to_widget (GTK_MENU (menu), button, NULL);
       gtk_menu_popup_at_widget (GTK_MENU (menu), button,
                                 xfce_tasklist_vertical (group_child->tasklist)
-                                ? GDK_GRAVITY_SOUTH_EAST : GDK_GRAVITY_NORTH_WEST,
-                                xfce_tasklist_vertical (group_child->tasklist)
-                                ? GDK_GRAVITY_SOUTH_EAST : GDK_GRAVITY_SOUTH_WEST,
+                                ? GDK_GRAVITY_NORTH_EAST : GDK_GRAVITY_SOUTH_WEST,
+                                GDK_GRAVITY_NORTH_WEST,
                                 (GdkEvent *) event);
 
       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
diff --git a/plugins/windowmenu/windowmenu.c b/plugins/windowmenu/windowmenu.c
index 4975d2f..d585928 100644
--- a/plugins/windowmenu/windowmenu.c
+++ b/plugins/windowmenu/windowmenu.c
@@ -944,7 +944,7 @@ window_menu_plugin_menu_window_item_activate (GtkWidget      *mi,
           G_CALLBACK (window_menu_plugin_menu_actions_selection_done),
           gtk_widget_get_parent (mi));
       gtk_menu_popup_at_widget (GTK_MENU (menu), mi,
-                                GDK_GRAVITY_SOUTH,
+                                GDK_GRAVITY_NORTH_EAST,
                                 GDK_GRAVITY_NORTH_WEST,
                                 (GdkEvent *) event);
 
@@ -1396,8 +1396,7 @@ window_menu_plugin_menu (GtkWidget        *button,
 
   gtk_menu_popup_at_widget (GTK_MENU (menu), button,
                             xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)) == GTK_ORIENTATION_VERTICAL
-                            ? GDK_GRAVITY_WEST : GDK_GRAVITY_NORTH,
-                            xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)) == GTK_ORIENTATION_VERTICAL
-                            ? GDK_GRAVITY_EAST : GDK_GRAVITY_SOUTH,
+                            ? GDK_GRAVITY_NORTH_EAST : GDK_GRAVITY_SOUTH_WEST,
+                            GDK_GRAVITY_NORTH_WEST,
                             NULL);
 }

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


More information about the Xfce4-commits mailing list