[balsa/popover: 28/67] balsa-index: Change popup menu placement
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/popover: 28/67] balsa-index: Change popup menu placement
- Date: Mon, 17 Aug 2020 15:25:00 +0000 (UTC)
commit f8d369c68c7a88f54231196eeb882193932c49b8
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 4eaaa453c..b58d37946 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);
@@ -276,7 +276,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;
}
@@ -672,7 +672,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
@@ -2035,7 +2035,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;
@@ -2060,7 +2060,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;
@@ -2072,6 +2072,7 @@ bndx_do_popup(BalsaIndex * index)
GMenu *mru_menu;
GMenuItem *item;
GtkAllocation allocation;
+ gdouble x, y;
g_debug("%s:%s", __FILE__, __func__);
@@ -2121,18 +2122,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]