Skip to content

guigtk: make double click handling consistent with Windows and macOS - #1633

Merged
phkahler merged 1 commit into
solvespace:masterfrom
iscgar:iscgar/gtk-fix-double-click
Nov 12, 2025
Merged

guigtk: make double click handling consistent with Windows and macOS#1633
phkahler merged 1 commit into
solvespace:masterfrom
iscgar:iscgar/gtk-fix-double-click

Conversation

@iscgar

@iscgar iscgar commented Oct 25, 2025

Copy link
Copy Markdown
Contributor

GTK sends a press event for the 2nd click before synthesising a double click event. This is inconsistent with the GUI code on Windows and macOS and causes double clicks to be interpreted as triple clicks by various receivers.

Fix it by saving the last press event, and eating the current event when it would be considered a double click by GTK and a receiver is set up, since a double click event will follow immediately.

GTK sends a press event for the 2nd click before synthesising a double
click event. This is inconsistent with the GUI code on Windows and macOS
and causes double clicks to be interpreted as triple clicks by various
receivers.

Fix it by saving the last press event, and eating the current event when
it would be considered a double click by GTK and a receiver is set up,
since a double click event will follow immediately.
@iscgar
iscgar force-pushed the iscgar/gtk-fix-double-click branch from 9f2c8ec to 0bae1f1 Compare October 25, 2025 20:37
@iscgar iscgar changed the title guigtk: make double handling consistent with the Windows and macOS GUI guigtk: make double click handling consistent with Windows and macOS Oct 25, 2025
@iscgar

iscgar commented Nov 8, 2025

Copy link
Copy Markdown
Contributor Author

@phkahler @ruevs friendly ping

This is a simple fix for a behaviour that has been bugging me for far too long on Linux. Can you please take a look?

@ruevs

ruevs commented Nov 8, 2025

Copy link
Copy Markdown
Member

My RaspberryPi (the only Linux machine I currently have) is tied up in something else, so I can't test this. That's why I kept quiet.

@phkahler

phkahler commented Nov 8, 2025

Copy link
Copy Markdown
Member

@iscgar I hate to say it but I don't even know what double clicking does in solvespace, so I can't really comment on how Windows and Linux differ in response to it. Is there some use for double clicks?

@iscgar

iscgar commented Nov 8, 2025

Copy link
Copy Markdown
Contributor Author

@iscgar I hate to say it but I don't even know what double clicking does in solvespace, so I can't really comment on how Windows and Linux differ in response to it. Is there some use for double clicks?

I don't think there's any part of the code that handles double clicks in any special way. Rather, the existing code treats the double click event as a regular click AFAICT. The problem with the GTK double click handling is that when a double click occurs, it behaves as if there was a triple click (because the events received are: click, click, double-click; whereas on Windows and macOS the events are: click, double-click). This is especially annoying in my named parameters branch, when I want to quickly create multiple parameters and double-click the "add" button, but it results in three parameters being added.

@phkahler

Copy link
Copy Markdown
Member

This is especially annoying in my named parameters branch, when I want to quickly create multiple parameters and double-click the "add" button, but it results in three parameters being added.

This situation is really ugly. My first reaction was "there go the GTK devs again being stupid", but after some thinking and reading they are giving the application developer all options for how to handle it. Some solutions:

  1. what you're doing with the timer to eliminate the second click event.
  2. We could just ignore double click events entirely - simpler?
  3. We could ignore button down events (in the text window) and only respond to release events.

If your intent is for fast clicking to perform the same operation rapidly, I'd go with option 2 for simplicity since we don't use double click anyway. Or would that create inconsistent behavior between GTK and Windows/mac?

@ruevs

ruevs commented Nov 11, 2025

Copy link
Copy Markdown
Member

Editing a constraint that has a value (length, angle, ratio, difference) is a double-click.

@iscgar

iscgar commented Nov 11, 2025

Copy link
Copy Markdown
Contributor Author

[snip] Some solutions:

1. what you're doing with the timer to eliminate the second click event.

2. We could just ignore double click events entirely - simpler?

3. We could ignore button down events (in the text window) and only respond to release events.

If your intent is for fast clicking to perform the same operation rapidly, I'd go with option 2 for simplicity since we don't use double click anyway. Or would that create inconsistent behavior between GTK and Windows/mac?

I looked at the code more carefully, and apparently while the text window doesn't handle a double click in any special way, the graphic window does use it for constraint editing. So ignoring the double click event in general is not really possible.

We could theoretically just ignore the double click event in the text window, but because on Windows and macOS the second click is only delivered as a double click event, that would lead to double clicks being interpreted as a single click on those platforms, which is still inconsistent.

So this leaves 1 and 3, and of those I think 1 is the simplest fix, as it simply aligns the behaviour with the other platforms for consistency.

@iscgar

iscgar commented Nov 11, 2025

Copy link
Copy Markdown
Contributor Author

Editing a constraint that has a value (length, angle, ratio, difference) is a double-click.

Missed your message. Sorry for repeating.

@phkahler
phkahler merged commit 925a527 into solvespace:master Nov 12, 2025
4 checks passed
@iscgar
iscgar deleted the iscgar/gtk-fix-double-click branch November 16, 2025 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants