[balsa/popover: 14/30] compose window: Improve context menu placement



commit 097739d8d707b84b73f078cbc73c7cd54936addb
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Thu May 7 15:51:19 2020 -0400

    compose window: Improve context menu placement

 src/sendmsg-window.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index 196574d73..938df3d7d 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -2419,7 +2419,6 @@ attachment_button_press_cb(GtkWidget * widget, GdkEventButton * event,
     GtkTreeView *tree_view = GTK_TREE_VIEW(widget);
     GtkTreePath *path;
 
-    g_return_val_if_fail(event, FALSE);
     if (!gdk_event_triggers_context_menu((GdkEvent *) event)
         || event->window != gtk_tree_view_get_bin_window(tree_view))
         return FALSE;
@@ -2440,8 +2439,18 @@ attachment_button_press_cb(GtkWidget * widget, GdkEventButton * event,
 
            gtk_tree_model_get(model, &iter, ATTACH_INFO_COLUMN, &attach_info, -1);
            if (attach_info != NULL) {
-               if (attach_info->popup_menu != NULL)
+               if (attach_info->popup_menu != NULL) {
+                    GdkRectangle rectangle;
+
+                    /* Pop up above the pointer */
+                    rectangle.x = event->x;
+                    rectangle.width = 0;
+                    rectangle.y = event->y;
+                    rectangle.height = 0;
+                    gtk_popover_set_pointing_to(GTK_POPOVER(attach_info->popup_menu),
+                                                &rectangle);
                     gtk_popover_popup(GTK_POPOVER(attach_info->popup_menu));
+                }
                g_object_unref(attach_info);
            }
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]