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 668688 - Add symbolic names for left, right and middle buttons
Add symbolic names for left, right and middle buttons
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: X11
3.0.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks: 668692
 
 
Reported: 2012-01-25 19:10 UTC by Carlos Garcia Campos
Modified: 2012-01-27 08:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add symbolic names for left, right and middle buttons (36.16 KB, patch)
2012-01-25 19:10 UTC, Carlos Garcia Campos
committed Details | Review

Description Carlos Garcia Campos 2012-01-25 19:10:09 UTC
Created attachment 206125 [details] [review]
Add symbolic names for left, right and middle buttons

Add GDK_BUTTON_LEFT, GDK_BUTTON_MIDDLE and GDK_BUTTON_RIGHT macros and use them everywhere in gtk source code. I've split the patch into several commits (once per file) as suggested by Company. Attached here as a single file to make it easier.
Comment 1 Emmanuele Bassi (:ebassi) 2012-01-25 20:49:14 UTC
I'm not entirely sure encoding left/right is going to be a good plan. how's the layout for a left-handed pointer?

if we're in the business of symbolic names, I'd go for _BUTTON_PRIMARY, _BUTTON_MIDDLE and _BUTTON_SECONDARY.

in any case, I'll have to create a bug for Clutter as well. :-)
Comment 3 Emmanuele Bassi (:ebassi) 2012-01-26 15:34:26 UTC
Apple:
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSEvent_Class/Reference/Reference.html

though Apple has event types for left (up and down), and right (up and down), pointer events, and has no middle - just scroll.

(In reply to comment #2)

> Any reason why we should not follow the rest of the world? :)

like my mother says, "if the rest of the world jumps off a cliff...". ;-)

anyway, I'm more concerned of what happens on X11 when a left-handed user configures her mouse to be left-handed: do we flip the layout as well, so that the left-of-the-user button will still be the primary button, and the right-of-the-user will be the secondary button? because if we don't, we'd look pretty damn stupid.
Comment 4 Emmanuele Bassi (:ebassi) 2012-01-26 15:35:37 UTC
all above, though, is not to be considered in any way, shape, or form a blocking comment: symbolic constants are fine by me.
Comment 5 Benjamin Otte (Company) 2012-01-26 15:46:20 UTC
Comment on attachment 206125 [details] [review]
Add symbolic names for left, right and middle buttons

I guess that means Carlos gets to decide - he wrote the code after all. So feel free to push the patchset with any name you prefer.
Comment 6 Carlos Garnacho 2012-01-26 16:13:20 UTC
Given X11 flips the button numbers, so the usual 1 2 3 right-handed mapping turns into 3 2 1 on a left-handed setup, I see the left/middle/right naming prone to confusions. Even though there's prior art in some enums wrt RTL/LTR, I'm not so sure we should keep doing this, so primary/secondary makes most sense
Comment 7 Emmanuele Bassi (:ebassi) 2012-01-26 16:39:30 UTC
we could just pull a Microsoft/Apple/Whatever, and decide that we don't support left-handed pointing devices in the API naming. :-)
Comment 8 Carlos Garcia Campos 2012-01-27 08:50:06 UTC
Comment on attachment 206125 [details] [review]
Add symbolic names for left, right and middle buttons

Pushed using primary/secondary as suggested by ebassi and garnacho.