Using gtk_widget_set_extension_events() for a button?



Hi all,

I'm trying to get extension events information from a button widget. This is useful, for example, to know which input device caused the button to emit a "button_press_event" signal. To test this feature, I modified the scribble-xinput.c example given with the distribution by adding another signal handler before the "clicked" signal handler for the quit button:

g_signal_connect (G_OBJECT (button), "button_press_event",
                  G_CALLBACK (quit_button_press_event), NULL);

and setting the events and extension events masks for the button:

gtk_widget_set_events (button, GDK_BUTTON_PRESS_MASK);
gtk_widget_set_extension_events (button, GDK_EXTENSION_EVENTS_CURSOR);

I finally defined the following basic callback:

static gint
quit_button_press_event (GtkWidget *widget, GdkEventButton *event)
{
  print_button_press (event->device);
  return FALSE;
}

After setting up devices, I used the drawing area with my tablet stylus, getting expected messages such as "Button press on device 'stylus'" from the drawing area "button_press_event" signal handler (see the original code). However, after clicking on the quit button to exit the program, I got only "Button press on device 'Core Pointer'" from the quit_button_press_event callback.

According to this example, it seems that the quit button cannot be setup to emit extension events... Is it true or am I missing something?

Thanks in advance for your help,

David.





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