forked from AuroraMiddleware/gtk
Remove OwnerGrabButtonMask from button entries for GDK_BUTTON_PRESS /
Fri Feb 18 14:37:29 2000 Owen Taylor <otaylor@redhat.com> * gdk/x11/gdkwindow-x11.c (gdk_event_mask_table): Remove OwnerGrabButtonMask from button entries for GDK_BUTTON_PRESS / GDK_BUTTON_RELEASE. * gtk/gtklayout.c (gtk_layout_realize): Always add GDK_SCROLL to the event mask (which will result in button/press release being added to the event mask on Unix) so scrolling works for layouts in scroll windows. * gdk/gdkevents.h (enum): Fix up GDK_ALL_EVENTS_MASK. Patch from Anders Carlsson <andersca@picard.andersnet> to add a scroll event. * gtk/testgtk.c (scroll_test_scroll): Added an example of mouse wheel scrolling to the "Test Scrolling" part of testgtk. * gtk/gtkwidget.h (struct _GtkWidgetClass): Added scroll_event signal. * gtk/gtkwidget.c: Added "scroll_event" GTK+ signal and matched it against GDK_SCROLL. * gtk/gtkrange.c (gtk_range_scroll_event): Updated to use the new way of mouse wheel scrolling. * gtk/gtkscrolledwindow.c (gtk_scrolled_window_scroll_event): Likewise. * gtk/gtkspinbutton.c (gtk_spin_button_scroll): Likewise. * gtk/gtkmain.c: Removed previous mouse wheel hack. * gdk/x11/gdkwindow-x11.c (gdk_event_mask_table): Added entry in gdk_event_mask_table. * gdk/x11/gdkevents-x11.c (gdk_event_translate): Added GdkEventScroll handler. * gdk/gdkevents.h: Added GdkEventScroll structure.
This commit is contained in:
parent
ab1deac87f
commit
c8a2382b65
41
ChangeLog
41
ChangeLog
@ -1,3 +1,44 @@
|
||||
Fri Feb 18 14:37:29 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/x11/gdkwindow-x11.c (gdk_event_mask_table): Remove
|
||||
OwnerGrabButtonMask from button entries for
|
||||
GDK_BUTTON_PRESS / GDK_BUTTON_RELEASE.
|
||||
|
||||
* gtk/gtklayout.c (gtk_layout_realize): Always add GDK_SCROLL
|
||||
to the event mask (which will result in button/press release
|
||||
being added to the event mask on Unix) so scrolling works
|
||||
for layouts in scroll windows.
|
||||
|
||||
* gdk/gdkevents.h (enum): Fix up GDK_ALL_EVENTS_MASK.
|
||||
|
||||
Patch from Anders Carlsson <andersca@picard.andersnet> to add
|
||||
a scroll event.
|
||||
|
||||
* gtk/testgtk.c (scroll_test_scroll): Added an example of mouse wheel
|
||||
scrolling to the "Test Scrolling" part of testgtk.
|
||||
|
||||
* gtk/gtkwidget.h (struct _GtkWidgetClass): Added scroll_event signal.
|
||||
|
||||
* gtk/gtkwidget.c: Added "scroll_event" GTK+ signal and matched
|
||||
it against GDK_SCROLL.
|
||||
|
||||
* gtk/gtkrange.c (gtk_range_scroll_event): Updated to use the new
|
||||
way of mouse wheel scrolling.
|
||||
|
||||
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_scroll_event): Likewise.
|
||||
|
||||
* gtk/gtkspinbutton.c (gtk_spin_button_scroll): Likewise.
|
||||
|
||||
* gtk/gtkmain.c: Removed previous mouse wheel hack.
|
||||
|
||||
* gdk/x11/gdkwindow-x11.c (gdk_event_mask_table): Added entry in
|
||||
gdk_event_mask_table.
|
||||
|
||||
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Added
|
||||
GdkEventScroll handler.
|
||||
|
||||
* gdk/gdkevents.h: Added GdkEventScroll structure.
|
||||
|
||||
Thu Feb 17 17:10:12 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gt{h,k,}vpaned.[ch]: Add patch from Jonathan Blandford
|
||||
|
@ -1,3 +1,44 @@
|
||||
Fri Feb 18 14:37:29 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/x11/gdkwindow-x11.c (gdk_event_mask_table): Remove
|
||||
OwnerGrabButtonMask from button entries for
|
||||
GDK_BUTTON_PRESS / GDK_BUTTON_RELEASE.
|
||||
|
||||
* gtk/gtklayout.c (gtk_layout_realize): Always add GDK_SCROLL
|
||||
to the event mask (which will result in button/press release
|
||||
being added to the event mask on Unix) so scrolling works
|
||||
for layouts in scroll windows.
|
||||
|
||||
* gdk/gdkevents.h (enum): Fix up GDK_ALL_EVENTS_MASK.
|
||||
|
||||
Patch from Anders Carlsson <andersca@picard.andersnet> to add
|
||||
a scroll event.
|
||||
|
||||
* gtk/testgtk.c (scroll_test_scroll): Added an example of mouse wheel
|
||||
scrolling to the "Test Scrolling" part of testgtk.
|
||||
|
||||
* gtk/gtkwidget.h (struct _GtkWidgetClass): Added scroll_event signal.
|
||||
|
||||
* gtk/gtkwidget.c: Added "scroll_event" GTK+ signal and matched
|
||||
it against GDK_SCROLL.
|
||||
|
||||
* gtk/gtkrange.c (gtk_range_scroll_event): Updated to use the new
|
||||
way of mouse wheel scrolling.
|
||||
|
||||
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_scroll_event): Likewise.
|
||||
|
||||
* gtk/gtkspinbutton.c (gtk_spin_button_scroll): Likewise.
|
||||
|
||||
* gtk/gtkmain.c: Removed previous mouse wheel hack.
|
||||
|
||||
* gdk/x11/gdkwindow-x11.c (gdk_event_mask_table): Added entry in
|
||||
gdk_event_mask_table.
|
||||
|
||||
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Added
|
||||
GdkEventScroll handler.
|
||||
|
||||
* gdk/gdkevents.h: Added GdkEventScroll structure.
|
||||
|
||||
Thu Feb 17 17:10:12 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gt{h,k,}vpaned.[ch]: Add patch from Jonathan Blandford
|
||||
|
@ -1,3 +1,44 @@
|
||||
Fri Feb 18 14:37:29 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/x11/gdkwindow-x11.c (gdk_event_mask_table): Remove
|
||||
OwnerGrabButtonMask from button entries for
|
||||
GDK_BUTTON_PRESS / GDK_BUTTON_RELEASE.
|
||||
|
||||
* gtk/gtklayout.c (gtk_layout_realize): Always add GDK_SCROLL
|
||||
to the event mask (which will result in button/press release
|
||||
being added to the event mask on Unix) so scrolling works
|
||||
for layouts in scroll windows.
|
||||
|
||||
* gdk/gdkevents.h (enum): Fix up GDK_ALL_EVENTS_MASK.
|
||||
|
||||
Patch from Anders Carlsson <andersca@picard.andersnet> to add
|
||||
a scroll event.
|
||||
|
||||
* gtk/testgtk.c (scroll_test_scroll): Added an example of mouse wheel
|
||||
scrolling to the "Test Scrolling" part of testgtk.
|
||||
|
||||
* gtk/gtkwidget.h (struct _GtkWidgetClass): Added scroll_event signal.
|
||||
|
||||
* gtk/gtkwidget.c: Added "scroll_event" GTK+ signal and matched
|
||||
it against GDK_SCROLL.
|
||||
|
||||
* gtk/gtkrange.c (gtk_range_scroll_event): Updated to use the new
|
||||
way of mouse wheel scrolling.
|
||||
|
||||
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_scroll_event): Likewise.
|
||||
|
||||
* gtk/gtkspinbutton.c (gtk_spin_button_scroll): Likewise.
|
||||
|
||||
* gtk/gtkmain.c: Removed previous mouse wheel hack.
|
||||
|
||||
* gdk/x11/gdkwindow-x11.c (gdk_event_mask_table): Added entry in
|
||||
gdk_event_mask_table.
|
||||
|
||||
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Added
|
||||
GdkEventScroll handler.
|
||||
|
||||
* gdk/gdkevents.h: Added GdkEventScroll structure.
|
||||
|
||||
Thu Feb 17 17:10:12 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gt{h,k,}vpaned.[ch]: Add patch from Jonathan Blandford
|
||||
|
@ -1,3 +1,44 @@
|
||||
Fri Feb 18 14:37:29 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/x11/gdkwindow-x11.c (gdk_event_mask_table): Remove
|
||||
OwnerGrabButtonMask from button entries for
|
||||
GDK_BUTTON_PRESS / GDK_BUTTON_RELEASE.
|
||||
|
||||
* gtk/gtklayout.c (gtk_layout_realize): Always add GDK_SCROLL
|
||||
to the event mask (which will result in button/press release
|
||||
being added to the event mask on Unix) so scrolling works
|
||||
for layouts in scroll windows.
|
||||
|
||||
* gdk/gdkevents.h (enum): Fix up GDK_ALL_EVENTS_MASK.
|
||||
|
||||
Patch from Anders Carlsson <andersca@picard.andersnet> to add
|
||||
a scroll event.
|
||||
|
||||
* gtk/testgtk.c (scroll_test_scroll): Added an example of mouse wheel
|
||||
scrolling to the "Test Scrolling" part of testgtk.
|
||||
|
||||
* gtk/gtkwidget.h (struct _GtkWidgetClass): Added scroll_event signal.
|
||||
|
||||
* gtk/gtkwidget.c: Added "scroll_event" GTK+ signal and matched
|
||||
it against GDK_SCROLL.
|
||||
|
||||
* gtk/gtkrange.c (gtk_range_scroll_event): Updated to use the new
|
||||
way of mouse wheel scrolling.
|
||||
|
||||
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_scroll_event): Likewise.
|
||||
|
||||
* gtk/gtkspinbutton.c (gtk_spin_button_scroll): Likewise.
|
||||
|
||||
* gtk/gtkmain.c: Removed previous mouse wheel hack.
|
||||
|
||||
* gdk/x11/gdkwindow-x11.c (gdk_event_mask_table): Added entry in
|
||||
gdk_event_mask_table.
|
||||
|
||||
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Added
|
||||
GdkEventScroll handler.
|
||||
|
||||
* gdk/gdkevents.h: Added GdkEventScroll structure.
|
||||
|
||||
Thu Feb 17 17:10:12 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gt{h,k,}vpaned.[ch]: Add patch from Jonathan Blandford
|
||||
|
@ -1,3 +1,44 @@
|
||||
Fri Feb 18 14:37:29 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/x11/gdkwindow-x11.c (gdk_event_mask_table): Remove
|
||||
OwnerGrabButtonMask from button entries for
|
||||
GDK_BUTTON_PRESS / GDK_BUTTON_RELEASE.
|
||||
|
||||
* gtk/gtklayout.c (gtk_layout_realize): Always add GDK_SCROLL
|
||||
to the event mask (which will result in button/press release
|
||||
being added to the event mask on Unix) so scrolling works
|
||||
for layouts in scroll windows.
|
||||
|
||||
* gdk/gdkevents.h (enum): Fix up GDK_ALL_EVENTS_MASK.
|
||||
|
||||
Patch from Anders Carlsson <andersca@picard.andersnet> to add
|
||||
a scroll event.
|
||||
|
||||
* gtk/testgtk.c (scroll_test_scroll): Added an example of mouse wheel
|
||||
scrolling to the "Test Scrolling" part of testgtk.
|
||||
|
||||
* gtk/gtkwidget.h (struct _GtkWidgetClass): Added scroll_event signal.
|
||||
|
||||
* gtk/gtkwidget.c: Added "scroll_event" GTK+ signal and matched
|
||||
it against GDK_SCROLL.
|
||||
|
||||
* gtk/gtkrange.c (gtk_range_scroll_event): Updated to use the new
|
||||
way of mouse wheel scrolling.
|
||||
|
||||
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_scroll_event): Likewise.
|
||||
|
||||
* gtk/gtkspinbutton.c (gtk_spin_button_scroll): Likewise.
|
||||
|
||||
* gtk/gtkmain.c: Removed previous mouse wheel hack.
|
||||
|
||||
* gdk/x11/gdkwindow-x11.c (gdk_event_mask_table): Added entry in
|
||||
gdk_event_mask_table.
|
||||
|
||||
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Added
|
||||
GdkEventScroll handler.
|
||||
|
||||
* gdk/gdkevents.h: Added GdkEventScroll structure.
|
||||
|
||||
Thu Feb 17 17:10:12 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gt{h,k,}vpaned.[ch]: Add patch from Jonathan Blandford
|
||||
|
@ -1,3 +1,44 @@
|
||||
Fri Feb 18 14:37:29 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/x11/gdkwindow-x11.c (gdk_event_mask_table): Remove
|
||||
OwnerGrabButtonMask from button entries for
|
||||
GDK_BUTTON_PRESS / GDK_BUTTON_RELEASE.
|
||||
|
||||
* gtk/gtklayout.c (gtk_layout_realize): Always add GDK_SCROLL
|
||||
to the event mask (which will result in button/press release
|
||||
being added to the event mask on Unix) so scrolling works
|
||||
for layouts in scroll windows.
|
||||
|
||||
* gdk/gdkevents.h (enum): Fix up GDK_ALL_EVENTS_MASK.
|
||||
|
||||
Patch from Anders Carlsson <andersca@picard.andersnet> to add
|
||||
a scroll event.
|
||||
|
||||
* gtk/testgtk.c (scroll_test_scroll): Added an example of mouse wheel
|
||||
scrolling to the "Test Scrolling" part of testgtk.
|
||||
|
||||
* gtk/gtkwidget.h (struct _GtkWidgetClass): Added scroll_event signal.
|
||||
|
||||
* gtk/gtkwidget.c: Added "scroll_event" GTK+ signal and matched
|
||||
it against GDK_SCROLL.
|
||||
|
||||
* gtk/gtkrange.c (gtk_range_scroll_event): Updated to use the new
|
||||
way of mouse wheel scrolling.
|
||||
|
||||
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_scroll_event): Likewise.
|
||||
|
||||
* gtk/gtkspinbutton.c (gtk_spin_button_scroll): Likewise.
|
||||
|
||||
* gtk/gtkmain.c: Removed previous mouse wheel hack.
|
||||
|
||||
* gdk/x11/gdkwindow-x11.c (gdk_event_mask_table): Added entry in
|
||||
gdk_event_mask_table.
|
||||
|
||||
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Added
|
||||
GdkEventScroll handler.
|
||||
|
||||
* gdk/gdkevents.h: Added GdkEventScroll structure.
|
||||
|
||||
Thu Feb 17 17:10:12 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gt{h,k,}vpaned.[ch]: Add patch from Jonathan Blandford
|
||||
|
@ -1,3 +1,44 @@
|
||||
Fri Feb 18 14:37:29 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/x11/gdkwindow-x11.c (gdk_event_mask_table): Remove
|
||||
OwnerGrabButtonMask from button entries for
|
||||
GDK_BUTTON_PRESS / GDK_BUTTON_RELEASE.
|
||||
|
||||
* gtk/gtklayout.c (gtk_layout_realize): Always add GDK_SCROLL
|
||||
to the event mask (which will result in button/press release
|
||||
being added to the event mask on Unix) so scrolling works
|
||||
for layouts in scroll windows.
|
||||
|
||||
* gdk/gdkevents.h (enum): Fix up GDK_ALL_EVENTS_MASK.
|
||||
|
||||
Patch from Anders Carlsson <andersca@picard.andersnet> to add
|
||||
a scroll event.
|
||||
|
||||
* gtk/testgtk.c (scroll_test_scroll): Added an example of mouse wheel
|
||||
scrolling to the "Test Scrolling" part of testgtk.
|
||||
|
||||
* gtk/gtkwidget.h (struct _GtkWidgetClass): Added scroll_event signal.
|
||||
|
||||
* gtk/gtkwidget.c: Added "scroll_event" GTK+ signal and matched
|
||||
it against GDK_SCROLL.
|
||||
|
||||
* gtk/gtkrange.c (gtk_range_scroll_event): Updated to use the new
|
||||
way of mouse wheel scrolling.
|
||||
|
||||
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_scroll_event): Likewise.
|
||||
|
||||
* gtk/gtkspinbutton.c (gtk_spin_button_scroll): Likewise.
|
||||
|
||||
* gtk/gtkmain.c: Removed previous mouse wheel hack.
|
||||
|
||||
* gdk/x11/gdkwindow-x11.c (gdk_event_mask_table): Added entry in
|
||||
gdk_event_mask_table.
|
||||
|
||||
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Added
|
||||
GdkEventScroll handler.
|
||||
|
||||
* gdk/gdkevents.h: Added GdkEventScroll structure.
|
||||
|
||||
Thu Feb 17 17:10:12 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gt{h,k,}vpaned.[ch]: Add patch from Jonathan Blandford
|
||||
|
@ -13,3 +13,9 @@ Incompatible Changes from GTK+-1.2 to GTK+-1.4:
|
||||
- gtk_paned_set_gutter_size() has been removed, since the small handle tab
|
||||
has been changed to include the entire area previously occupied by
|
||||
the gutter.
|
||||
|
||||
- GDK no longer selects OwnerGrabButtonMask for button presses. This means
|
||||
that the automatic grab that occurs when the user presses a button
|
||||
will have owner_events = FALSE, so all events are redirected to the
|
||||
grab window, even events that would normally go to other windows of the
|
||||
window's owner.
|
@ -410,6 +410,7 @@ gdk_event_get_time (GdkEvent *event)
|
||||
case GDK_2BUTTON_PRESS:
|
||||
case GDK_3BUTTON_PRESS:
|
||||
case GDK_BUTTON_RELEASE:
|
||||
case GDK_SCROLL:
|
||||
return event->button.time;
|
||||
case GDK_KEY_PRESS:
|
||||
case GDK_KEY_RELEASE:
|
||||
|
@ -17,6 +17,7 @@ typedef struct _GdkEventNoExpose GdkEventNoExpose;
|
||||
typedef struct _GdkEventVisibility GdkEventVisibility;
|
||||
typedef struct _GdkEventMotion GdkEventMotion;
|
||||
typedef struct _GdkEventButton GdkEventButton;
|
||||
typedef struct _GdkEventScroll GdkEventScroll;
|
||||
typedef struct _GdkEventKey GdkEventKey;
|
||||
typedef struct _GdkEventFocus GdkEventFocus;
|
||||
typedef struct _GdkEventCrossing GdkEventCrossing;
|
||||
@ -69,6 +70,7 @@ typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
|
||||
* Map: A window has been mapped. (It is now visible on the screen).
|
||||
* Unmap: A window has been unmapped. (It is no longer visible on
|
||||
* the screen).
|
||||
* Scroll: A mouse wheel was scrolled either up or down.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
@ -103,7 +105,8 @@ typedef enum
|
||||
GDK_DROP_FINISHED = 27,
|
||||
GDK_CLIENT_EVENT = 28,
|
||||
GDK_VISIBILITY_NOTIFY = 29,
|
||||
GDK_NO_EXPOSE = 30
|
||||
GDK_NO_EXPOSE = 30,
|
||||
GDK_SCROLL = 31
|
||||
} GdkEventType;
|
||||
|
||||
/* Event masks. (Used to select what types of events a window
|
||||
@ -131,15 +134,25 @@ typedef enum
|
||||
GDK_PROXIMITY_IN_MASK = 1 << 18,
|
||||
GDK_PROXIMITY_OUT_MASK = 1 << 19,
|
||||
GDK_SUBSTRUCTURE_MASK = 1 << 20,
|
||||
GDK_ALL_EVENTS_MASK = 0x0FFFFF
|
||||
GDK_SCROLL_MASK = 1 << 21,
|
||||
GDK_ALL_EVENTS_MASK = 0x3FFFFE
|
||||
} GdkEventMask;
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
GDK_VISIBILITY_UNOBSCURED,
|
||||
GDK_VISIBILITY_PARTIAL,
|
||||
GDK_VISIBILITY_FULLY_OBSCURED
|
||||
} GdkVisibilityState;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GDK_SCROLL_UP,
|
||||
GDK_SCROLL_DOWN,
|
||||
GDK_SCROLL_LEFT,
|
||||
GDK_SCROLL_RIGHT
|
||||
} GdkScrollDirection;
|
||||
|
||||
/* Types of enter/leave notifications.
|
||||
* Ancestor:
|
||||
* Virtual:
|
||||
@ -244,6 +257,24 @@ struct _GdkEventButton
|
||||
gdouble x_root, y_root;
|
||||
};
|
||||
|
||||
struct _GdkEventScroll
|
||||
{
|
||||
GdkEventType type;
|
||||
GdkWindow *window;
|
||||
gint8 send_event;
|
||||
guint32 time;
|
||||
gdouble x;
|
||||
gdouble y;
|
||||
gdouble pressure;
|
||||
gdouble xtilt;
|
||||
gdouble ytilt;
|
||||
guint state;
|
||||
GdkScrollDirection direction;
|
||||
GdkInputSource source;
|
||||
guint32 deviceid;
|
||||
gdouble x_root, y_root;
|
||||
};
|
||||
|
||||
struct _GdkEventKey
|
||||
{
|
||||
GdkEventType type;
|
||||
@ -361,6 +392,7 @@ union _GdkEvent
|
||||
GdkEventVisibility visibility;
|
||||
GdkEventMotion motion;
|
||||
GdkEventButton button;
|
||||
GdkEventScroll scroll;
|
||||
GdkEventKey key;
|
||||
GdkEventCrossing crossing;
|
||||
GdkEventFocus focus_change;
|
||||
|
@ -700,23 +700,46 @@ gdk_event_translate (GdkEvent *event,
|
||||
break;
|
||||
}
|
||||
|
||||
event->button.type = GDK_BUTTON_PRESS;
|
||||
event->button.window = window;
|
||||
event->button.time = xevent->xbutton.time;
|
||||
event->button.x = xevent->xbutton.x;
|
||||
event->button.y = xevent->xbutton.y;
|
||||
event->button.x_root = (gfloat)xevent->xbutton.x_root;
|
||||
event->button.y_root = (gfloat)xevent->xbutton.y_root;
|
||||
event->button.pressure = 0.5;
|
||||
event->button.xtilt = 0;
|
||||
event->button.ytilt = 0;
|
||||
event->button.state = (GdkModifierType) xevent->xbutton.state;
|
||||
event->button.button = xevent->xbutton.button;
|
||||
event->button.source = GDK_SOURCE_MOUSE;
|
||||
event->button.deviceid = GDK_CORE_POINTER;
|
||||
/* If we get a ButtonPress event where the button is 4 or 5,
|
||||
it's a Scroll event */
|
||||
if (xevent->xbutton.button == 4 || xevent->xbutton.button == 5)
|
||||
{
|
||||
event->scroll.type = GDK_SCROLL;
|
||||
event->scroll.direction = (xevent->xbutton.button == 4) ?
|
||||
GDK_SCROLL_UP : GDK_SCROLL_DOWN;
|
||||
event->scroll.window = window;
|
||||
event->scroll.time = xevent->xbutton.x;
|
||||
event->scroll.x = xevent->xbutton.x;
|
||||
event->scroll.y = xevent->xbutton.y;
|
||||
event->scroll.x_root = (gfloat)xevent->xbutton.x_root;
|
||||
event->scroll.y_root = (gfloat)xevent->xbutton.y_root;
|
||||
event->scroll.pressure = 0.5;
|
||||
event->scroll.xtilt = 0;
|
||||
event->scroll.ytilt = 0;
|
||||
event->scroll.state = (GdkModifierType) xevent->xbutton.state;
|
||||
event->scroll.source = GDK_SOURCE_MOUSE;
|
||||
event->scroll.deviceid = GDK_CORE_POINTER;
|
||||
}
|
||||
else
|
||||
{
|
||||
event->button.type = GDK_BUTTON_PRESS;
|
||||
event->button.window = window;
|
||||
event->button.time = xevent->xbutton.time;
|
||||
event->button.x = xevent->xbutton.x;
|
||||
event->button.y = xevent->xbutton.y;
|
||||
event->button.x_root = (gfloat)xevent->xbutton.x_root;
|
||||
event->button.y_root = (gfloat)xevent->xbutton.y_root;
|
||||
event->button.pressure = 0.5;
|
||||
event->button.xtilt = 0;
|
||||
event->button.ytilt = 0;
|
||||
event->button.state = (GdkModifierType) xevent->xbutton.state;
|
||||
event->button.button = xevent->xbutton.button;
|
||||
event->button.source = GDK_SOURCE_MOUSE;
|
||||
event->button.deviceid = GDK_CORE_POINTER;
|
||||
|
||||
gdk_event_button_generate (event);
|
||||
}
|
||||
|
||||
gdk_event_button_generate (event);
|
||||
|
||||
break;
|
||||
|
||||
case ButtonRelease:
|
||||
@ -736,6 +759,13 @@ gdk_event_translate (GdkEvent *event,
|
||||
break;
|
||||
}
|
||||
|
||||
/* We treat button presses as scroll wheel events, so ignore the release */
|
||||
if (xevent->xbutton.button == 4 || xevent->xbutton.button == 5)
|
||||
{
|
||||
return_val = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
event->button.type = GDK_BUTTON_RELEASE;
|
||||
event->button.window = window;
|
||||
event->button.time = xevent->xbutton.time;
|
||||
|
@ -46,7 +46,7 @@
|
||||
#include <X11/extensions/shape.h>
|
||||
#endif
|
||||
|
||||
const int gdk_event_mask_table[20] =
|
||||
const int gdk_event_mask_table[21] =
|
||||
{
|
||||
ExposureMask,
|
||||
PointerMotionMask,
|
||||
@ -55,8 +55,8 @@ const int gdk_event_mask_table[20] =
|
||||
Button1MotionMask,
|
||||
Button2MotionMask,
|
||||
Button3MotionMask,
|
||||
ButtonPressMask | OwnerGrabButtonMask,
|
||||
ButtonReleaseMask | OwnerGrabButtonMask,
|
||||
ButtonPressMask,
|
||||
ButtonReleaseMask,
|
||||
KeyPressMask,
|
||||
KeyReleaseMask,
|
||||
EnterWindowMask,
|
||||
@ -67,7 +67,8 @@ const int gdk_event_mask_table[20] =
|
||||
VisibilityChangeMask,
|
||||
0, /* PROXIMITY_IN */
|
||||
0, /* PROXIMTY_OUT */
|
||||
SubstructureNotifyMask
|
||||
SubstructureNotifyMask,
|
||||
ButtonPressMask /* SCROLL; on X mouse wheel events is treated as mouse button 4/5 */
|
||||
};
|
||||
const int gdk_nevent_masks = sizeof (gdk_event_mask_table) / sizeof (int);
|
||||
|
||||
|
@ -467,7 +467,7 @@ gtk_layout_realize (GtkWidget *widget)
|
||||
|
||||
attributes.x = 0;
|
||||
attributes.y = 0;
|
||||
attributes.event_mask = GDK_EXPOSURE_MASK |
|
||||
attributes.event_mask = GDK_EXPOSURE_MASK | GDK_SCROLL_MASK |
|
||||
gtk_widget_get_events (widget);
|
||||
|
||||
layout->bin_window = gdk_window_new (widget->window,
|
||||
|
@ -757,45 +757,10 @@ gtk_main_do_event (GdkEvent *event)
|
||||
gtk_widget_event (event_widget, event);
|
||||
break;
|
||||
|
||||
case GDK_SCROLL:
|
||||
case GDK_BUTTON_PRESS:
|
||||
case GDK_2BUTTON_PRESS:
|
||||
case GDK_3BUTTON_PRESS:
|
||||
/* We treat button 4-5 specially, assume we have
|
||||
* a MS-style scrollwheel mouse, and try to find
|
||||
* a plausible widget to scroll. We also trap
|
||||
* button 4-5 double and triple clicks here, since
|
||||
* they will be generated if the user scrolls quickly.
|
||||
*/
|
||||
if ((grab_widget == event_widget) &&
|
||||
(event->button.button == 4 || event->button.button == 5))
|
||||
{
|
||||
GtkWidget *range = NULL;
|
||||
GtkWidget *scrollwin;
|
||||
|
||||
if (GTK_IS_RANGE (event_widget))
|
||||
range = event_widget;
|
||||
else
|
||||
{
|
||||
scrollwin = gtk_widget_get_ancestor (event_widget,
|
||||
GTK_TYPE_SCROLLED_WINDOW);
|
||||
if (scrollwin)
|
||||
range = GTK_SCROLLED_WINDOW (scrollwin)->vscrollbar;
|
||||
}
|
||||
|
||||
if (range && GTK_WIDGET_VISIBLE (range))
|
||||
{
|
||||
if (event->type == GDK_BUTTON_PRESS)
|
||||
{
|
||||
GtkAdjustment *adj = GTK_RANGE (range)->adjustment;
|
||||
gfloat new_value = adj->value + ((event->button.button == 4) ?
|
||||
-adj->page_increment / 2:
|
||||
adj->page_increment / 2);
|
||||
new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
|
||||
gtk_adjustment_set_value (adj, new_value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
gtk_propagate_event (grab_widget, event);
|
||||
break;
|
||||
|
||||
|
@ -73,6 +73,8 @@ static gint gtk_range_focus_in (GtkWidget *widget,
|
||||
GdkEventFocus *event);
|
||||
static gint gtk_range_focus_out (GtkWidget *widget,
|
||||
GdkEventFocus *event);
|
||||
static gint gtk_range_scroll_event (GtkWidget *widget,
|
||||
GdkEventScroll *event);
|
||||
static void gtk_range_style_set (GtkWidget *widget,
|
||||
GtkStyle *previous_style);
|
||||
|
||||
@ -153,6 +155,7 @@ gtk_range_class_init (GtkRangeClass *class)
|
||||
widget_class->button_press_event = gtk_range_button_press;
|
||||
widget_class->button_release_event = gtk_range_button_release;
|
||||
widget_class->motion_notify_event = gtk_range_motion_notify;
|
||||
widget_class->scroll_event = gtk_range_scroll_event;
|
||||
widget_class->key_press_event = gtk_range_key_press;
|
||||
widget_class->enter_notify_event = gtk_range_enter_notify;
|
||||
widget_class->leave_notify_event = gtk_range_leave_notify;
|
||||
@ -978,6 +981,30 @@ gtk_range_button_release (GtkWidget *widget,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_range_scroll_event (GtkWidget *widget,
|
||||
GdkEventScroll *event)
|
||||
{
|
||||
GtkRange *range;
|
||||
|
||||
g_return_val_if_fail (widget != NULL, FALSE);
|
||||
g_return_val_if_fail (GTK_IS_RANGE (widget), FALSE);
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
|
||||
range = GTK_RANGE (widget);
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (range)) {
|
||||
GtkAdjustment *adj = GTK_RANGE (range)->adjustment;
|
||||
gfloat new_value = adj->value + ((event->direction == GDK_SCROLL_UP) ?
|
||||
-adj->page_increment / 2:
|
||||
adj->page_increment / 2);
|
||||
new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
|
||||
gtk_adjustment_set_value (adj, new_value);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_range_motion_notify (GtkWidget *widget,
|
||||
GdkEventMotion *event)
|
||||
|
@ -95,6 +95,8 @@ static void gtk_scrolled_window_size_request (GtkWidget *widg
|
||||
GtkRequisition *requisition);
|
||||
static void gtk_scrolled_window_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
static gint gtk_scrolled_window_scroll_event (GtkWidget *widget,
|
||||
GdkEventScroll *event);
|
||||
static void gtk_scrolled_window_add (GtkContainer *container,
|
||||
GtkWidget *widget);
|
||||
static void gtk_scrolled_window_remove (GtkContainer *container,
|
||||
@ -108,7 +110,6 @@ static void gtk_scrolled_window_relative_allocation(GtkWidget *widg
|
||||
static void gtk_scrolled_window_adjustment_changed (GtkAdjustment *adjustment,
|
||||
gpointer data);
|
||||
|
||||
|
||||
static GtkContainerClass *parent_class = NULL;
|
||||
|
||||
|
||||
@ -180,6 +181,7 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class)
|
||||
widget_class->draw = gtk_scrolled_window_draw;
|
||||
widget_class->size_request = gtk_scrolled_window_size_request;
|
||||
widget_class->size_allocate = gtk_scrolled_window_size_allocate;
|
||||
widget_class->scroll_event = gtk_scrolled_window_scroll_event;
|
||||
|
||||
container_class->add = gtk_scrolled_window_add;
|
||||
container_class->remove = gtk_scrolled_window_remove;
|
||||
@ -270,6 +272,7 @@ gtk_scrolled_window_init (GtkScrolledWindow *scrolled_window)
|
||||
scrolled_window->hscrollbar_visible = FALSE;
|
||||
scrolled_window->vscrollbar_visible = FALSE;
|
||||
scrolled_window->window_placement = GTK_CORNER_TOP_LEFT;
|
||||
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
@ -848,6 +851,39 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
|
||||
gtk_widget_hide (scrolled_window->vscrollbar);
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_scrolled_window_scroll_event (GtkWidget *widget,
|
||||
GdkEventScroll *event)
|
||||
{
|
||||
GtkWidget *range;
|
||||
|
||||
g_return_val_if_fail (widget != NULL, FALSE);
|
||||
g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (widget), FALSE);
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
|
||||
if (event->direction == GDK_SCROLL_UP || event->direction == GDK_SCROLL_DOWN)
|
||||
range = GTK_SCROLLED_WINDOW (widget)->vscrollbar;
|
||||
else
|
||||
range = GTK_SCROLLED_WINDOW (widget)->hscrollbar;
|
||||
|
||||
if (range && GTK_WIDGET_VISIBLE (range))
|
||||
{
|
||||
GtkAdjustment *adj = GTK_RANGE (range)->adjustment;
|
||||
gfloat new_value;
|
||||
|
||||
if (event->direction == GDK_SCROLL_UP || event->direction == GDK_SCROLL_LEFT)
|
||||
new_value = adj->value - adj->page_increment / 2;
|
||||
else
|
||||
new_value = adj->value + adj->page_increment / 2;
|
||||
|
||||
new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
|
||||
gtk_adjustment_set_value (adj, new_value);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scrolled_window_adjustment_changed (GtkAdjustment *adjustment,
|
||||
|
@ -45,8 +45,6 @@
|
||||
#define MAX_TEXT_LENGTH 256
|
||||
#define MAX_TIMER_CALLS 5
|
||||
#define EPSILON 1e-5
|
||||
#define WHEEL_UP_BUTTON 4
|
||||
#define WHEEL_DOWN_BUTTON 5
|
||||
|
||||
enum {
|
||||
ARG_0,
|
||||
@ -113,6 +111,8 @@ static gint gtk_spin_button_key_press (GtkWidget *widget,
|
||||
GdkEventKey *event);
|
||||
static gint gtk_spin_button_key_release (GtkWidget *widget,
|
||||
GdkEventKey *event);
|
||||
static gint gtk_spin_button_scroll (GtkWidget *widget,
|
||||
GdkEventScroll *event);
|
||||
static void gtk_spin_button_activate (GtkEditable *editable);
|
||||
static void gtk_spin_button_snap (GtkSpinButton *spin_button,
|
||||
gfloat val);
|
||||
@ -235,6 +235,7 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class)
|
||||
widget_class->size_allocate = gtk_spin_button_size_allocate;
|
||||
widget_class->draw = gtk_spin_button_draw;
|
||||
widget_class->expose_event = gtk_spin_button_expose;
|
||||
widget_class->scroll_event = gtk_spin_button_scroll;
|
||||
widget_class->button_press_event = gtk_spin_button_button_press;
|
||||
widget_class->button_release_event = gtk_spin_button_button_release;
|
||||
widget_class->motion_notify_event = gtk_spin_button_motion_notify;
|
||||
@ -751,6 +752,36 @@ gtk_spin_button_focus_out (GtkWidget *widget,
|
||||
return GTK_WIDGET_CLASS (parent_class)->focus_out_event (widget, event);
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_spin_button_scroll (GtkWidget *widget,
|
||||
GdkEventScroll *event)
|
||||
{
|
||||
GtkSpinButton *spin;
|
||||
|
||||
g_return_val_if_fail (widget != NULL, FALSE);
|
||||
g_return_val_if_fail (GTK_IS_SPIN_BUTTON (widget), FALSE);
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
|
||||
spin = GTK_SPIN_BUTTON (widget);
|
||||
|
||||
if (event->direction == GDK_SCROLL_UP)
|
||||
{
|
||||
if (!GTK_WIDGET_HAS_FOCUS (widget))
|
||||
gtk_widget_grab_focus (widget);
|
||||
gtk_spin_button_real_spin (spin, spin->adjustment->step_increment);
|
||||
}
|
||||
else if (event->direction == GDK_SCROLL_DOWN)
|
||||
{
|
||||
if (!GTK_WIDGET_HAS_FOCUS (widget))
|
||||
gtk_widget_grab_focus (widget);
|
||||
gtk_spin_button_real_spin (spin, -spin->adjustment->step_increment);
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_spin_button_button_press (GtkWidget *widget,
|
||||
GdkEventButton *event)
|
||||
@ -765,19 +796,7 @@ gtk_spin_button_button_press (GtkWidget *widget,
|
||||
|
||||
if (!spin->button)
|
||||
{
|
||||
if (event->button == WHEEL_UP_BUTTON)
|
||||
{
|
||||
if (!GTK_WIDGET_HAS_FOCUS (widget))
|
||||
gtk_widget_grab_focus (widget);
|
||||
gtk_spin_button_real_spin (spin, spin->adjustment->step_increment);
|
||||
}
|
||||
else if (event->button == WHEEL_DOWN_BUTTON)
|
||||
{
|
||||
if (!GTK_WIDGET_HAS_FOCUS (widget))
|
||||
gtk_widget_grab_focus (widget);
|
||||
gtk_spin_button_real_spin (spin, -spin->adjustment->step_increment);
|
||||
}
|
||||
else if (event->window == spin->panel)
|
||||
if (event->window == spin->panel)
|
||||
{
|
||||
if (!GTK_WIDGET_HAS_FOCUS (widget))
|
||||
gtk_widget_grab_focus (widget);
|
||||
|
@ -64,6 +64,7 @@ enum {
|
||||
EVENT,
|
||||
BUTTON_PRESS_EVENT,
|
||||
BUTTON_RELEASE_EVENT,
|
||||
SCROLL_EVENT,
|
||||
MOTION_NOTIFY_EVENT,
|
||||
DELETE_EVENT,
|
||||
DESTROY_EVENT,
|
||||
@ -434,6 +435,14 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
gtk_marshal_BOOL__POINTER,
|
||||
GTK_TYPE_BOOL, 1,
|
||||
GTK_TYPE_GDK_EVENT);
|
||||
widget_signals[SCROLL_EVENT] =
|
||||
gtk_signal_new ("scroll_event",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GtkWidgetClass, scroll_event),
|
||||
gtk_marshal_BOOL__POINTER,
|
||||
GTK_TYPE_BOOL, 1,
|
||||
GTK_TYPE_GDK_EVENT);
|
||||
widget_signals[MOTION_NOTIFY_EVENT] =
|
||||
gtk_signal_new ("motion_notify_event",
|
||||
GTK_RUN_LAST,
|
||||
@ -2728,6 +2737,9 @@ gtk_widget_event (GtkWidget *widget,
|
||||
case GDK_3BUTTON_PRESS:
|
||||
signal_num = BUTTON_PRESS_EVENT;
|
||||
break;
|
||||
case GDK_SCROLL:
|
||||
signal_num = SCROLL_EVENT;
|
||||
break;
|
||||
case GDK_BUTTON_RELEASE:
|
||||
signal_num = BUTTON_RELEASE_EVENT;
|
||||
break;
|
||||
|
@ -297,6 +297,8 @@ struct _GtkWidgetClass
|
||||
GdkEventButton *event);
|
||||
gint (* button_release_event) (GtkWidget *widget,
|
||||
GdkEventButton *event);
|
||||
gint (* scroll_event) (GtkWidget *widget,
|
||||
GdkEventScroll *event);
|
||||
gint (* motion_notify_event) (GtkWidget *widget,
|
||||
GdkEventMotion *event);
|
||||
gint (* delete_event) (GtkWidget *widget,
|
||||
|
@ -7609,6 +7609,19 @@ scroll_test_expose (GtkWidget *widget, GdkEventExpose *event,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gint
|
||||
scroll_test_scroll (GtkWidget *widget, GdkEventScroll *event,
|
||||
GtkAdjustment *adj)
|
||||
{
|
||||
gfloat new_value = adj->value + ((event->direction == GDK_SCROLL_UP) ?
|
||||
-adj->page_increment / 2:
|
||||
adj->page_increment / 2);
|
||||
new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
|
||||
gtk_adjustment_set_value (adj, new_value);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
scroll_test_configure (GtkWidget *widget, GdkEventConfigure *event,
|
||||
GtkAdjustment *adj)
|
||||
@ -7728,7 +7741,7 @@ create_scroll_test (void)
|
||||
gtk_box_pack_start (GTK_BOX (hbox), drawing_area, TRUE, TRUE, 0);
|
||||
gtk_widget_show (drawing_area);
|
||||
|
||||
gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK);
|
||||
gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK | GDK_SCROLL_MASK);
|
||||
|
||||
adj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 1000.0, 1.0, 180.0, 200.0));
|
||||
scroll_test_pos = 0.0;
|
||||
@ -7741,7 +7754,8 @@ create_scroll_test (void)
|
||||
GTK_SIGNAL_FUNC (scroll_test_expose), adj);
|
||||
gtk_signal_connect (GTK_OBJECT (drawing_area), "configure_event",
|
||||
GTK_SIGNAL_FUNC (scroll_test_configure), adj);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (drawing_area), "scroll_event",
|
||||
GTK_SIGNAL_FUNC (scroll_test_scroll), adj);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
|
||||
GTK_SIGNAL_FUNC (scroll_test_adjustment_changed),
|
||||
|
@ -7609,6 +7609,19 @@ scroll_test_expose (GtkWidget *widget, GdkEventExpose *event,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gint
|
||||
scroll_test_scroll (GtkWidget *widget, GdkEventScroll *event,
|
||||
GtkAdjustment *adj)
|
||||
{
|
||||
gfloat new_value = adj->value + ((event->direction == GDK_SCROLL_UP) ?
|
||||
-adj->page_increment / 2:
|
||||
adj->page_increment / 2);
|
||||
new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
|
||||
gtk_adjustment_set_value (adj, new_value);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
scroll_test_configure (GtkWidget *widget, GdkEventConfigure *event,
|
||||
GtkAdjustment *adj)
|
||||
@ -7728,7 +7741,7 @@ create_scroll_test (void)
|
||||
gtk_box_pack_start (GTK_BOX (hbox), drawing_area, TRUE, TRUE, 0);
|
||||
gtk_widget_show (drawing_area);
|
||||
|
||||
gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK);
|
||||
gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK | GDK_SCROLL_MASK);
|
||||
|
||||
adj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 1000.0, 1.0, 180.0, 200.0));
|
||||
scroll_test_pos = 0.0;
|
||||
@ -7741,7 +7754,8 @@ create_scroll_test (void)
|
||||
GTK_SIGNAL_FUNC (scroll_test_expose), adj);
|
||||
gtk_signal_connect (GTK_OBJECT (drawing_area), "configure_event",
|
||||
GTK_SIGNAL_FUNC (scroll_test_configure), adj);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (drawing_area), "scroll_event",
|
||||
GTK_SIGNAL_FUNC (scroll_test_scroll), adj);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
|
||||
GTK_SIGNAL_FUNC (scroll_test_adjustment_changed),
|
||||
|
Loading…
Reference in New Issue
Block a user