]> Pileus Git - ~andy/gtk/blobdiff - gdk/gdkevents.h
broadway: pointer targets differ in signedness
[~andy/gtk] / gdk / gdkevents.h
index 048537ee871b120c46d23cfb279d4164eb18f6e6..694505567d19be5acb846e2251f87d21c083ee7f 100644 (file)
  * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
  */
 
+#ifndef __GDK_EVENTS_H__
+#define __GDK_EVENTS_H__
+
 #if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
 #error "Only <gdk/gdk.h> can be included directly."
 #endif
 
-#ifndef __GDK_EVENTS_H__
-#define __GDK_EVENTS_H__
-
 #include <gdk/gdkversionmacros.h>
 #include <gdk/gdkcolor.h>
 #include <gdk/gdktypes.h>
@@ -129,6 +129,7 @@ typedef struct _GdkEventExpose          GdkEventExpose;
 typedef struct _GdkEventVisibility  GdkEventVisibility;
 typedef struct _GdkEventMotion     GdkEventMotion;
 typedef struct _GdkEventButton     GdkEventButton;
+typedef struct _GdkEventTouch       GdkEventTouch;
 typedef struct _GdkEventScroll      GdkEventScroll;  
 typedef struct _GdkEventKey        GdkEventKey;
 typedef struct _GdkEventFocus      GdkEventFocus;
@@ -143,6 +144,8 @@ typedef struct _GdkEventWindowState GdkEventWindowState;
 typedef struct _GdkEventSetting     GdkEventSetting;
 typedef struct _GdkEventGrabBroken  GdkEventGrabBroken;
 
+typedef struct _GdkEventSequence    GdkEventSequence;
+
 typedef union  _GdkEvent           GdkEvent;
 
 /**
@@ -222,8 +225,10 @@ typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
  * @GDK_2BUTTON_PRESS: a mouse button has been double-clicked (clicked twice
  *   within a short period of time). Note that each click also generates a
  *   %GDK_BUTTON_PRESS event.
+ * @GDK_DOUBLE_BUTTON_PRESS: alias for %GDK_2BUTTON_PRESS, added in 3.6.
  * @GDK_3BUTTON_PRESS: a mouse button has been clicked 3 times in a short period
  *   of time. Note that each click also generates a %GDK_BUTTON_PRESS event.
+ * @GDK_TRIPLE_BUTTON_PRESS: alias for %GDK_3BUTTON_PRESS, added in 3.6.
  * @GDK_BUTTON_RELEASE: a mouse button has been released.
  * @GDK_KEY_PRESS: a key has been pressed.
  * @GDK_KEY_RELEASE: a key has been released.
@@ -262,6 +267,14 @@ typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
  *   was added in 2.8.
  * @GDK_DAMAGE: the content of the window has been changed. This event type
  *   was added in 2.14.
+ * @GDK_TOUCH_BEGIN: A new touch event sequence has just started. This event
+ *   type was added in 3.4.
+ * @GDK_TOUCH_UPDATE: A touch event sequence has been updated. This event type
+ *   was added in 3.4.
+ * @GDK_TOUCH_END: A touch event sequence has finished. This event type
+ *   was added in 3.4.
+ * @GDK_TOUCH_CANCEL: A touch event sequence has been canceled. This event type
+ *   was added in 3.4.
  * @GDK_EVENT_LAST: marks the end of the GdkEventType enumeration. Added in 2.18
  *
  * Specifies the type of the event.
@@ -269,6 +282,13 @@ typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
  * Do not confuse these events with the signals that GTK+ widgets emit.
  * Although many of these events result in corresponding signals being emitted,
  * the events are often transformed or filtered along the way.
+ *
+ * In some language bindings, the values %GDK_2BUTTON_PRESS and
+ * %GDK_3BUTTON_PRESS would translate into something syntactically
+ * invalid (eg <literal>Gdk.EventType.2ButtonPress</literal>, where a
+ * symbol is not allowed to start with a number). In that case, the
+ * aliases %GDK_DOUBLE_BUTTON_PRESS and %GDK_TRIPLE_BUTTON_PRESS can
+ * be used instead.
  */
 typedef enum
 {
@@ -279,7 +299,9 @@ typedef enum
   GDK_MOTION_NOTIFY    = 3,
   GDK_BUTTON_PRESS     = 4,
   GDK_2BUTTON_PRESS    = 5,
+  GDK_DOUBLE_BUTTON_PRESS = GDK_2BUTTON_PRESS,
   GDK_3BUTTON_PRESS    = 6,
+  GDK_TRIPLE_BUTTON_PRESS = GDK_3BUTTON_PRESS,
   GDK_BUTTON_RELEASE   = 7,
   GDK_KEY_PRESS                = 8,
   GDK_KEY_RELEASE      = 9,
@@ -309,6 +331,10 @@ typedef enum
   GDK_OWNER_CHANGE      = 34,
   GDK_GRAB_BROKEN       = 35,
   GDK_DAMAGE            = 36,
+  GDK_TOUCH_BEGIN       = 37,
+  GDK_TOUCH_UPDATE      = 38,
+  GDK_TOUCH_END         = 39,
+  GDK_TOUCH_CANCEL      = 40,
   GDK_EVENT_LAST        /* helper variable for decls */
 } GdkEventType;
 
@@ -333,6 +359,8 @@ typedef enum
  * @GDK_SCROLL_DOWN: the window is scrolled down.
  * @GDK_SCROLL_LEFT: the window is scrolled to the left.
  * @GDK_SCROLL_RIGHT: the window is scrolled to the right.
+ * @GDK_SCROLL_SMOOTH: the scrolling is determined by the delta values
+ *   in #GdkEventScroll. See gdk_event_get_scroll_deltas(). Since: 3.4
  *
  * Specifies the direction for #GdkEventScroll.
  */
@@ -341,7 +369,8 @@ typedef enum
   GDK_SCROLL_UP,
   GDK_SCROLL_DOWN,
   GDK_SCROLL_LEFT,
-  GDK_SCROLL_RIGHT
+  GDK_SCROLL_RIGHT,
+  GDK_SCROLL_SMOOTH
 } GdkScrollDirection;
 
 /**
@@ -384,6 +413,13 @@ typedef enum
  * @GDK_CROSSING_GTK_UNGRAB: crossing because a GTK+ grab is deactivated.
  * @GDK_CROSSING_STATE_CHANGED: crossing because a GTK+ widget changed
  *   state (e.g. sensitivity).
+ * @GDK_CROSSING_TOUCH_BEGIN: crossing because a touch sequence has begun,
+ *   this event is synthetic as the pointer might have not left the window.
+ * @GDK_CROSSING_TOUCH_END: crossing because a touch sequence has ended,
+ *   this event is synthetic as the pointer might have not left the window.
+ * @GDK_CROSSING_DEVICE_SWITCH: crossing because of a device switch (i.e.
+ *   a mouse taking control of the pointer after a touch device), this event
+ *   is synthetic as the pointer didn't leave the window.
  *
  * Specifies the crossing mode for #GdkEventCrossing.
  */
@@ -394,7 +430,10 @@ typedef enum
   GDK_CROSSING_UNGRAB,
   GDK_CROSSING_GTK_GRAB,
   GDK_CROSSING_GTK_UNGRAB,
-  GDK_CROSSING_STATE_CHANGED
+  GDK_CROSSING_STATE_CHANGED,
+  GDK_CROSSING_TOUCH_BEGIN,
+  GDK_CROSSING_TOUCH_END,
+  GDK_CROSSING_DEVICE_SWITCH
 } GdkCrossingMode;
 
 /**
@@ -596,7 +635,7 @@ struct _GdkEventMotion
  *
  * Used for button press and button release events. The
  * @type field will be one of %GDK_BUTTON_PRESS,
- * %GDK_2BUTTON_PRESS, %GDK_3BUTTON_PRESS, and %GDK_BUTTON_RELEASE.
+ * %GDK_2BUTTON_PRESS, %GDK_3BUTTON_PRESS or %GDK_BUTTON_RELEASE,
  *
  * Double and triple-clicks result in a sequence of events being received.
  * For double-clicks the order of events will be:
@@ -644,6 +683,57 @@ struct _GdkEventButton
   gdouble x_root, y_root;
 };
 
+/**
+ * GdkEventTouch:
+ * @type: the type of the event (%GDK_TOUCH_BEGIN, %GDK_TOUCH_UPDATE,
+ *   %GDK_TOUCH_END, %GDK_TOUCH_CANCEL)
+ * @window: the window which received the event
+ * @send_event: %TRUE if the event was sent explicitly (e.g. using
+ *   <function>XSendEvent</function>)
+ * @time: the time of the event in milliseconds.
+ * @x: the x coordinate of the pointer relative to the window
+ * @y: the y coordinate of the pointer relative to the window
+ * @axes: @x, @y translated to the axes of @device, or %NULL if @device is
+ *   the mouse
+ * @state: (type GdkModifierType): a bit-mask representing the state of
+ *   the modifier keys (e.g. Control, Shift and Alt) and the pointer
+ *   buttons. See #GdkModifierType
+ * @sequence: the event sequence that the event belongs to
+ * @emulating_pointer: whether the event should be used for emulating
+ *   pointer event
+ * @device: the device where the event originated
+ * @x_root: the x coordinate of the pointer relative to the root of the
+ *   screen
+ * @y_root: the y coordinate of the pointer relative to the root of the
+ *   screen
+ *
+ * Used for touch events.
+ * @type field will be one of %GDK_TOUCH_BEGIN, %GDK_TOUCH_UPDATE,
+ * %GDK_TOUCH_END or %GDK_TOUCH_CANCEL.
+ *
+ * Touch events are grouped into sequences by means of the @sequence
+ * field, which can also be obtained with gdk_event_get_event_sequence().
+ * Each sequence begins with a %GDK_TOUCH_BEGIN event, followed by
+ * any number of %GDK_TOUCH_UPDATE events, and ends with a %GDK_TOUCH_END
+ * (or %GDK_TOUCH_CANCEL) event. With multitouch devices, there may be
+ * several active sequences at the same time.
+ */
+struct _GdkEventTouch
+{
+  GdkEventType type;
+  GdkWindow *window;
+  gint8 send_event;
+  guint32 time;
+  gdouble x;
+  gdouble y;
+  gdouble *axes;
+  guint state;
+  GdkEventSequence *sequence;
+  gboolean emulating_pointer;
+  GdkDevice *device;
+  gdouble x_root, y_root;
+};
+
 /**
  * GdkEventScroll:
  * @type: the type of the event (%GDK_SCROLL).
@@ -657,7 +747,8 @@ struct _GdkEventButton
  *   the modifier keys (e.g. Control, Shift and Alt) and the pointer
  *   buttons. See #GdkModifierType.
  * @direction: the direction to scroll to (one of %GDK_SCROLL_UP,
- *   %GDK_SCROLL_DOWN, %GDK_SCROLL_LEFT and %GDK_SCROLL_RIGHT).
+ *   %GDK_SCROLL_DOWN, %GDK_SCROLL_LEFT, %GDK_SCROLL_RIGHT or
+ *   %GDK_SCROLL_SMOOTH).
  * @device: the device where the event originated.
  * @x_root: the x coordinate of the pointer relative to the root of the
  *   screen.
@@ -667,6 +758,11 @@ struct _GdkEventButton
  * Generated from button presses for the buttons 4 to 7. Wheel mice are
  * usually configured to generate button press events for buttons 4 and 5
  * when the wheel is turned.
+ *
+ * Some GDK backends can also generate 'smooth' scroll events, which
+ * can be recognized by the %GDK_SCROLL_SMOOTH scroll direction. For
+ * these, the scroll deltas can be obtained with
+ * gdk_event_get_scroll_deltas().
  */
 struct _GdkEventScroll
 {
@@ -680,6 +776,8 @@ struct _GdkEventScroll
   GdkScrollDirection direction;
   GdkDevice *device;
   gdouble x_root, y_root;
+  gdouble delta_x;
+  gdouble delta_y;
 };
 
 /**
@@ -823,8 +921,8 @@ struct _GdkEventConfigure
  *   <function>XSendEvent</function>).
  * @atom: the property that was changed.
  * @time: the time of the event in milliseconds.
- * @state: whether the property was changed (%GDK_PROPERTY_NEW_VALUE) or
- *   deleted (%GDK_PROPERTY_DELETE).
+ * @state: (type GdkPropertyState): whether the property was changed
+ *   (%GDK_PROPERTY_NEW_VALUE) or deleted (%GDK_PROPERTY_DELETE).
  *
  * Describes a property change on a window.
  */
@@ -1072,6 +1170,7 @@ union _GdkEvent
   GdkEventVisibility       visibility;
   GdkEventMotion           motion;
   GdkEventButton           button;
+  GdkEventTouch             touch;
   GdkEventScroll            scroll;
   GdkEventKey              key;
   GdkEventCrossing         crossing;
@@ -1123,6 +1222,11 @@ gboolean  gdk_event_get_keycode         (const GdkEvent *event,
 GDK_AVAILABLE_IN_3_2
 gboolean gdk_event_get_scroll_direction (const GdkEvent *event,
                                          GdkScrollDirection *direction);
+GDK_AVAILABLE_IN_3_4
+gboolean  gdk_event_get_scroll_deltas   (const GdkEvent *event,
+                                         gdouble         *delta_x,
+                                         gdouble         *delta_y);
+
 gboolean  gdk_event_get_axis            (const GdkEvent  *event,
                                          GdkAxisUse       axis_use,
                                          gdouble         *value);
@@ -1155,6 +1259,9 @@ void       gdk_event_set_screen         (GdkEvent        *event,
                                          GdkScreen       *screen);
 GdkScreen *gdk_event_get_screen         (const GdkEvent  *event);
 
+GDK_AVAILABLE_IN_3_4
+GdkEventSequence *gdk_event_get_event_sequence (const GdkEvent *event);
+
 void     gdk_set_show_events           (gboolean        show_events);
 gboolean  gdk_get_show_events          (void);