Sign up

Looking for a symbolic way to refer to 3, like GDK_BUTTON_SECONDARY

The gtkd library mentions 'GDKBUTTONSECONDARY' a couple of times in comments (gdk/Event.d and gtk/Menu.d).

I'm testing the value of the button field (a uint) in a GdkEventButton struct (defined in gdktypes.d) to see if it is 3, to tell if the right mouse button was pressed.

I suppose that i should be using something more symbolic than just '3', and the internet things that GDKBUTTONSECONDARY is 3. So i think i should use this value, or something like it. (Perhaps this would be useful to left handers or something if the value can change depending on some system parameters.)

Anyhow, i can't seem to get a value out of GDKBUTTONSECONDARY.

Is there another symbol i can use for '3' that would be properly suggestive, and maybe modifiable for those cases where it should be?

(Or is this just a dumb point and i should be satisfied with 3. I actually am quite satisfied with gtkd, and quite willing to live with 3, but i would like to do things right if there's a better alternative to 3 than just leaving it raw.)

TIA!

Re: Looking for a symbolic way to refer to 3, like GDK_BUTTON_SECONDARY

Personally, I just define my own enum for this:

/**
 * Defined here since not defined in GtkD
 */
enum MouseButton : uint {
    PRIMARY = 1,
    MIDDLE = 2,
    SECONDARY = 3
}

Re: Looking for a symbolic way to refer to 3, like GDK_BUTTON_SECONDARY

On Tue, 08 Nov 2016 15:22:40 GMT, Gerald Nunn wrote:

Personally, I just define my own enum for this:

/**
 * Defined here since not defined in GtkD
 */
enum MouseButton : uint {
    PRIMARY = 1,
    MIDDLE = 2,
    SECONDARY = 3
}

Thanks Gerald, that's what i'll do then, i guess.