"click" event on a GtkSpinEntry



Hi all,

I want to catch a click/button-press event *only* on the entry
part of a GtkSpinButton. Put in other words I want to filter out
events happening on the up and down buttons of a spin entry.

I tried several strategies until actually finding a working
approach. The implementation though is too hackish for my taste:

    #define WHEEL_MASK (GDK_BUTTON1_MOTION_MASK|GDK_BUTTON3_MOTION_MASK)

    static gboolean
    button_press_event_callback(GtkSpinButton *spin, GdkEventButton *event)
    {
        if ((gdk_window_get_events(event->window) & WHEEL_MASK) > 0) {
            ...
        }
    }

I found sperimentally that the event mask of the up and down
GdkWindows are different from the GdkWindow of the entry and I'm
leveraging this fact to filter out the unwanted events.

This anyway could be an implementation detail so this behavior can
potentially be changed in the future.

Is there a more reliable way to accomplish the same result?

Ciao.
-- 
Nicola


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]