! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Ctrl-Button1 doesn't end user action
Status:
RESOLVED: MOVED
Product:
Xfce4-terminal
Component:
General

Comments

Description Ralph Corderoy 2017-05-04 17:22:41 CEST
xfce4-terminal 0.8.4-1 on Arch Linux.

Ctrl-Button1 down over a URL opens the URL, but the terminal state doesn't then return to the "we are not in the middle of an action" state.  If I promptly release Ctrl and double-click Button1 to select the URL's text, it's taken as a triple-click.  The first click of my double click acts to complete a double click started by the Ctrl click that's already been actioned.

I don't think this should be the intended behaviour.  There are two distinct user actions.  I've done one.  The slate should then be wiped clean as Ctrl has been released and the second would then be independent.
Comment 1 Igor editbugs 2017-05-04 21:56:13 CEST
Thanks for the report! This is a good one, took me some time to find the root cause (at least I hope I found it).

It seems that xfce double click mouse settings affect the behavior. For example, I wasn't able to reproduce the bug having set the time to 100 ms; also, it's not reproducible if I move mouse cursor just a bit before clicking second time, to exceed threshold value (8 px).
Another thing is that I can see the following picture when the bug happens:
ctrl click: 1
release: 1
button: 1
button: 1
release: 1

I believe, altogether this means that the _DE emulates_ double click when you click two times not exceeding time and threshold values.
There may be a bug in DE code for it probably shouldn't take ctrl+click as the first part of a double click; but I wasn't able to find that code location so far.
Comment 2 Igor editbugs 2017-05-04 22:33:06 CEST
Another good evidence of that being a DE thing are the desktop or internet browser, for instance - if you ctrl+click and then quickly click on their element, this will work as a double click.
Comment 3 Ralph Corderoy 2017-05-05 16:37:54 CEST
I don't quite understand your "following picture", but I think I agree with the gist of what you're saying.  https://developer.gnome.org/gdk3/stable/gdk3-Event-Structures.html#GdkEventButton describes how GDK_2BUTTON_PRESS and GDK_3BUTTON_PRESS are generated when GDK spots time, distance, and source window are similar enough to the earlier presses.  It does this using the GdkDisplay's multiple_click_info hash table that's indexed by the event's "device".  Searching for multiple_click_info through the gtk+ source doesn't suggest there's a way to tell GDK "The previous UI action has completed, reset your state of number of clicks".  Perhaps they'd be open to adding a mechanism, or have a suggestion as to what the application should do instead.

Meanwhile, I was thinking xfce4-terminal could maintain its own state.  When a user action completes, it resets its state.  It only actions 2BUTTON if its current state is compatible.  Ditto 3BUTTON.  But this won't work because GDK stops after 3BUTTON;  it doesn't have an open-ended "another button press to extend this sequence" event.  This suggests GDK needs to provide a "reset", or else terminal has to ignore GDK's 2BUTTON and 3BUTTON and do those calculations itself;  surely the wrong approach.

GDK need to provide advice.
Comment 4 Igor editbugs 2017-05-05 16:54:14 CEST
(In reply to Ralph Corderoy from comment #3)
> I don't quite understand your "following picture"

Sorry, I guess I got distracted and didn't describe the picture properly.

What I'm trying to show is the following:
The first event is Ctrl+click that opens an URL. Then button 1 (left mouse button) is released; Ctrl is also released but it isn't a point of our interest.
Then, after some time that lies within double click time configured in Xfce mouse settings, I press left mouse button - once. But what I see is that the terminal receives _two_ button press events, the 2nd one going instantly after the one that I produced. Then there's a button release event (only one - for the button that I pressed, and not the generated press).

This makes me think that some component (I'm assuming, a WM) is generating the second button press event. I'm not sure how the terminal can be protected from that.
Comment 5 Igor editbugs 2017-05-05 17:00:16 CEST
I've also done some investigations and found some WMs that are clearly sending GDK_2BUTTON_PRESS_EVENT under such conditions:

muffin: https://github.com/linuxmint/muffin/blob/0d74bad641bdf6f42ce024c620e57acdc1b8fd81/src/ui/ui.c#L165
marco: https://github.com/mate-desktop/marco/blob/6d9adde1f91d399f5e429f9f09f996aecb7cfa35/src/ui/ui.c#L158
https://github.com/mate-desktop/marco/blob/562f3d4cc6e9674a602e8b4bf796c00a41e69368/src/core/display.c#L1506

Unfortunately, xfwm4 code is not that clear as the ones above, and I'm not familiar with it, so I wasn't able to find the exact place where it's sending second event. But, this code really looks like it's doing something similar - at least it's measuring time between two consecutive clicks and the distance between them: https://git.xfce.org/xfce/xfwm4/tree/src/events.c#n168
Comment 6 Ralph Corderoy 2017-05-05 17:17:12 CEST
No, there's not another component generating the GDK_2BUTTON_PRESS.  If you want to experiment with the lowest level, use xev(1).  That will show pure press and release of buttons and keys being passed from the X server to the X client.  At the X level there's no such thing as a "double click".

In our case, xfce4-terminal is the X client and it uses the gdk library rather than talk X itself.  It's that library, part of xfce4-terminal, that is seeing the X events, as shown by xev, tracking them over time to spot a "double click", and synthesizing the GDK_2BUTTON_PRESS GDK event, not X event, that is then handled by xfce4-terminal.  Search for multiple_click_info in the Gtk+ source;  there's not many occurrences.

(There's no window-manager involvement.  That you can see similar behaviour in other programs may be because they're also using Gtk+/Gdk.  The window-manager code you found that's generating GDK_2BUTTON_PRESS is just because they're trying to circumvent GDK's handling entirely because WMs are a bit special but have to then duplicate some of GDK's 2BUTTON detection.)
Comment 7 Git Bot editbugs 2020-05-24 23:43:14 CEST
-- GitLab Migration Automatic Message --

This bug has been migrated to xfce.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.xfce.org/apps/xfce4-terminal/-/issues/22.

Please create an account or use an existing account on one of our supported OAuth providers. 

If you want to fork to submit patches and merge requests please continue reading here: https://docs.xfce.org/contribute/dev/git/start#gitlab_forks_and_merge_requests

Also feel free to reach out to us on the mailing list https://mail.xfce.org/mailman/listinfo/xfce4-dev

Bug #13552

Reported by:
Ralph Corderoy
Reported on: 2017-05-04
Last modified on: 2020-05-24

People

CC List:
1 user

Version

Attachments

Additional information