[geary/wip/279-convo-list-context-labels: 3/4] Fix shift-to-delete stuck on ConversationList context menu



commit e7372ea1cb76e5e140426cd63b3c63265de26ca7
Author: Michael Gratton <mike vee net>
Date:   Sun Aug 4 12:49:16 2019 +1000

    Fix shift-to-delete stuck on ConversationList context menu
    
    Use a GTK popover rather than regular menu so evenr processing continues
    when the menu is visible, and hence if Shift is released the main
    toolbar reverts back to showing Trash rather than Delete.

 src/client/conversation-list/conversation-list-view.vala | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/client/conversation-list/conversation-list-view.vala 
b/src/client/conversation-list/conversation-list-view.vala
index 12a5da3a..6ef39aaf 100644
--- a/src/client/conversation-list/conversation-list-view.vala
+++ b/src/client/conversation-list/conversation-list-view.vala
@@ -358,9 +358,18 @@ public class ConversationListView : Gtk.TreeView, Geary.BaseInterface {
             actions_section.append(_("_Forward"), "win."+Application.Controller.ACTION_FORWARD_MESSAGE);
             context_menu_model.append_section(null, actions_section);
 
-            Gtk.Menu context_menu = new Gtk.Menu.from_model(context_menu_model);
-            context_menu.insert_action_group("win", this.main_window);
-            context_menu.popup_at_pointer(event);
+            // Use a popover rather than a regular context menu since
+            // the latter grabs the event queue, so the MainWindow
+            // will not receive events if the user releases Shift,
+            // making the trash/delete header bar state wrong.
+            Gtk.Popover context_menu = new Gtk.Popover.from_model(
+                this, context_menu_model
+            );
+            Gdk.Rectangle dest = Gdk.Rectangle();
+            dest.x = (int) event.x;
+            dest.y = (int) event.y;
+            context_menu.set_pointing_to(dest);
+            context_menu.popup();
 
             // When the conversation under the mouse is selected, stop event propagation
             return get_selection().path_is_selected(path);


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