[balsa/gtk4: 39/311] balsa-index: Change popup menu placement
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/gtk4: 39/311] balsa-index: Change popup menu placement
- Date: Fri, 17 Dec 2021 19:53:08 +0000 (UTC)
commit 7cdb0ae3caa94e5e7ae2f4ac03043bd2468297de
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Thu May 21 19:18:20 2020 -0400
balsa-index: Change popup menu placement
Pop up the context menu below the pointer instead of to its right.
That's closer to the previous behavior.
src/balsa-index.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/src/balsa-index.c b/src/balsa-index.c
index 58ef9716a..abb38c254 100644
--- a/src/balsa-index.c
+++ b/src/balsa-index.c
@@ -119,7 +119,7 @@ static void bndx_drag_cb(GtkWidget* widget,
/* Popup menu */
static void bndx_popup_menu_create(BalsaIndex * index);
-static void bndx_do_popup(BalsaIndex * index);
+static void bndx_do_popup(BalsaIndex * index, const GdkEvent *event);
static void sendmsg_window_destroy_cb(GtkWidget * widget, gpointer data);
@@ -288,7 +288,7 @@ bndx_destroy(GObject * obj)
static gboolean
bndx_popup_menu(GtkWidget * widget)
{
- bndx_do_popup(BALSA_INDEX(widget));
+ bndx_do_popup(BALSA_INDEX(widget), NULL);
return TRUE;
}
@@ -684,7 +684,7 @@ bndx_gesture_pressed_cb(GtkGestureMultiPress *multi_press_gesture,
gtk_tree_path_free(path);
}
- bndx_do_popup(bindex);
+ bndx_do_popup(bindex, event);
}
static void
@@ -2135,7 +2135,7 @@ bndx_popup_menu_create(BalsaIndex * bindex)
bindex->popup_menu = menu;
bindex->popup_popover = gtk_popover_new_from_model(GTK_WIDGET(bindex), G_MENU_MODEL(menu));
- gtk_popover_set_position(GTK_POPOVER(bindex->popup_popover), GTK_POS_RIGHT);
+ gtk_popover_set_position(GTK_POPOVER(bindex->popup_popover), GTK_POS_BOTTOM);
}
/* bndx_do_popup: common code for the popup menu;
@@ -2160,7 +2160,7 @@ bndx_action_set_enabled(BalsaIndex *bindex,
}
static void
-bndx_do_popup(BalsaIndex * index)
+bndx_do_popup(BalsaIndex * index, const GdkEvent *event)
{
LibBalsaMailbox* mailbox;
gboolean any;
@@ -2172,6 +2172,7 @@ bndx_do_popup(BalsaIndex * index)
GMenu *mru_menu;
GMenuItem *item;
GtkAllocation allocation;
+ gdouble x, y;
g_debug("%s:%s", __FILE__, __func__);
@@ -2221,18 +2222,20 @@ bndx_do_popup(BalsaIndex * index)
g_menu_insert_item(index->popup_menu, index->move_position, item);
g_object_unref(item);
- gtk_widget_get_allocation(GTK_WIDGET(index), &allocation);
- if (event != NULL && gdk_event_triggers_context_menu((GdkEvent *) event)) {
+ if (event != NULL &&
+ gdk_event_triggers_context_menu(event) &&
+ gdk_event_get_coords(event, &x, &y)) {
/* Pop up to the right of the pointer */
gtk_tree_view_convert_bin_window_to_widget_coords(GTK_TREE_VIEW(index),
- (gint) event->x,
- (gint) event->y,
+ (gint) x,
+ (gint) y,
&allocation.x,
&allocation.y);
allocation.width = 0;
allocation.height = 0;
} else {
/* Pop up to the right of the "From" column */
+ gtk_widget_get_allocation(GTK_WIDGET(index), &allocation);
allocation.width = balsa_app.index_num_width +
balsa_app.index_status_width +
balsa_app.index_attachment_width +
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]