[java-gnome-hackers] Res: MouseButton improvements
Brought to you by:
afcowie
From: Vreixo F. L. <met...@ya...> - 2009-05-18 09:23:18
|
Hi! > 3. I'm not sure that these should to be deprecated. Do these > ButtonPressEvents not get generated anymore? They still get emitted, *as > well as* ScrolledEvent, right? No, afaik. I cannot get a button-press-event for those buttons, for example... > 4. What happens if you scroll the mouse wheel in a window without a > Viewport & Scrollbar? Do you still get ScrollEvent? Yes, it seems those buttons are always mapped to an scroll-event. In fact, from devhelp documentation: "The ::scroll-event signal is emitted when a button in the 4 to 7 range is pressed. Wheel mice are usually configured to generate button press events for buttons 4 and 5 when the wheel is turned. " The second sentence is not clear, as I never receive the button press events. I guess it refers to "mouse wheel is usually configured in X to generate button press events, that we map (in GDK) to scroll events". In fact, looking at gdk sources I found this piece of code, that belongs to function "gdk_event_translate" (that I guess it translates X events to GDK events): switch (xevent->type) [....] case ButtonPress: [......] /* If we get a ButtonPress event where the button is 4 or 5, it's a Scroll event */ switch (xevent->xbutton.button) { case 4: /* up */ case 5: /* down */ case 6: /* left */ case 7: /* right */ event->scroll.type = GDK_SCROLL; [.............] default: event->button.type = GDK_BUTTON_PRESS; [....] (piece of code from gtk+-2.16.1/gdk/x11/gdkevents-x11.c) So it seems that those buttons always generate scroll events, and only scroll events. I don't know, however, whether some special configuration can change this behavior, although I don't think so. Cheers Vreixo Veja quais são os assuntos do momento no Yahoo! +Buscados http://br.maisbuscados.yahoo.com |