GNOME Bugzilla – Bug 74620
Clean up button press handling (use one-grab-op-at-a-time pattern)
Last modified: 2014-08-03 15:39:59 UTC
Here is an assertion: gtk-demo (pid:1028): Gtk-CRITICAL **: file gtktextview.c: line 5054 (gtk_text_view_start_selection_drag): assertion `text_view->selection_drag_handler == 0' failed 1. Press left mouse button (which starts a selection) 2. Click right mouse button to popup menu (still holding left pressed) 3. Release left mouse button outside menu Now we are in a state where we have called gtk_text_view_start_selection_drag() but we will never call gtk_text_view_end_selection_drag() since the left button release was cought by the menu to dismiss it. Which leads to the assertion above. Most logical is to call gtk_text_view_end_selection_drag() before we popup the menu. Also notice that the menu popup can come from other places then just a right mouse button click. I'll attach a (very small) patch. The event argument to gtk_text_view_end_selection_drag() is not used but I'll leave it as is above. I'll also attach the same patch as above but which removes the unused argument. But maybe you have some plans for it later on?
Created attachment 7159 [details] [review] simple fix
Created attachment 7160 [details] [review] fix + removal of unused parameter
Hmm, I need to move the code to use my "grab operation" pattern first used in gtkrange.c (range_grab_add/range_grab_remove) and refined a bit in other code (metacity). The really simple variant of that is just Owen's "store current button" approach. Anyway I'll put in a bandaid for now but converting the bug to track the root problem.
Code-cleanup
*** Bug 335622 has been marked as a duplicate of this bug. ***
2006-03-28 Matthias Clasen <mclasen@redhat.com> * gtk/gtktextview.c (gtk_text_view_do_popup) (gtk_text_view_grab_notify): Move the call to gtk_text_view_end_selection_drag() from gtk_text_view_do_popup to gtk_text_view_grab_notify, so that it works not only for the text views own popup, but also for other ways in which we might become grab-shadowed during a selection drag. (#74620, Li Yuan)
This is not actually fixed currently, since we don't get enough grab notifies. Keeping this bug open until thats fixed.
*** Bug 336992 has been marked as a duplicate of this bug. ***
we're now using gestures, so closing this as obsolete