After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 74620 - Clean up button press handling (use one-grab-op-at-a-time pattern)
Clean up button press handling (use one-grab-op-at-a-time pattern)
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: GtkTextView
2.0.x
Other Linux
: Normal normal
: Small fix
Assigned To: gtk-bugs
gtk-bugs
: 336992 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2002-03-14 08:14 UTC by Dennis Björklund
Modified: 2014-08-03 15:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
simple fix (713 bytes, patch)
2002-03-14 08:15 UTC, Dennis Björklund
none Details | Review
fix + removal of unused parameter (2.75 KB, patch)
2002-03-14 08:16 UTC, Dennis Björklund
committed Details | Review

Description Dennis Björklund 2002-03-14 08:14:44 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?
Comment 1 Dennis Björklund 2002-03-14 08:15:48 UTC
Created attachment 7159 [details] [review]
simple fix
Comment 2 Dennis Björklund 2002-03-14 08:16:35 UTC
Created attachment 7160 [details] [review]
fix + removal of unused parameter
Comment 3 Havoc Pennington 2002-03-23 18:08:10 UTC
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.
Comment 4 Owen Taylor 2002-12-16 15:53:06 UTC
Code-cleanup
Comment 5 Matthias Clasen 2006-03-27 06:52:04 UTC
*** Bug 335622 has been marked as a duplicate of this bug. ***
Comment 6 Matthias Clasen 2006-03-28 16:05:57 UTC
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)
Comment 7 Matthias Clasen 2006-04-03 18:26:18 UTC
This is not actually fixed currently, since we don't get enough grab notifies.
Keeping this bug open until thats fixed.
Comment 8 Matthias Clasen 2006-04-03 18:28:06 UTC
*** Bug 336992 has been marked as a duplicate of this bug. ***
Comment 9 Matthias Clasen 2014-08-03 15:39:59 UTC
we're now using gestures, so closing this as obsolete