]> Pileus Git - ~andy/gtk/blobdiff - gdk/gdkevents.h
stylecontext: Do invalidation on first resize container
[~andy/gtk] / gdk / gdkevents.h
index 4902601e3c6940dd3324a04da00765e0e64bb993..694505567d19be5acb846e2251f87d21c083ee7f 100644 (file)
@@ -12,9 +12,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
  * 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>
 #include <gdk/gdkdnd.h>
@@ -74,12 +73,63 @@ G_BEGIN_DECLS
  */
 #define GDK_PRIORITY_REDRAW     (G_PRIORITY_HIGH_IDLE + 20)
 
+/**
+ * GDK_EVENT_PROPAGATE:
+ *
+ * Use this macro as the return value for continuing the propagation of
+ * an event handler.
+ *
+ * Since: 3.4
+ */
+#define GDK_EVENT_PROPAGATE     (FALSE)
+
+/**
+ * GDK_EVENT_STOP:
+ *
+ * Use this macro as the return value for stopping the propagation of
+ * an event handler.
+ *
+ * Since: 3.4
+ */
+#define GDK_EVENT_STOP          (TRUE)
+
+/**
+ * GDK_BUTTON_PRIMARY:
+ *
+ * The primary button. This is typically the left mouse button, or the
+ * right button in a left-handed setup.
+ *
+ * Since: 3.4
+ */
+#define GDK_BUTTON_PRIMARY      (1)
+
+/**
+ * GDK_BUTTON_MIDDLE:
+ *
+ * The middle button.
+ *
+ * Since: 3.4
+ */
+#define GDK_BUTTON_MIDDLE       (2)
+
+/**
+ * GDK_BUTTON_SECONDARY:
+ *
+ * The secondary button. This is typically the right mouse button, or the
+ * left button in a left-handed setup.
+ *
+ * Since: 3.4
+ */
+#define GDK_BUTTON_SECONDARY    (3)
+
+
 
 typedef struct _GdkEventAny        GdkEventAny;
 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;
@@ -89,12 +139,13 @@ typedef struct _GdkEventProperty    GdkEventProperty;
 typedef struct _GdkEventSelection   GdkEventSelection;
 typedef struct _GdkEventOwnerChange GdkEventOwnerChange;
 typedef struct _GdkEventProximity   GdkEventProximity;
-typedef struct _GdkEventClient     GdkEventClient;
 typedef struct _GdkEventDND         GdkEventDND;
 typedef struct _GdkEventWindowState GdkEventWindowState;
 typedef struct _GdkEventSetting     GdkEventSetting;
 typedef struct _GdkEventGrabBroken  GdkEventGrabBroken;
 
+typedef struct _GdkEventSequence    GdkEventSequence;
+
 typedef union  _GdkEvent           GdkEvent;
 
 /**
@@ -174,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.
@@ -214,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.
@@ -221,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
 {
@@ -231,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,
@@ -261,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;
 
@@ -285,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.
  */
@@ -293,7 +369,8 @@ typedef enum
   GDK_SCROLL_UP,
   GDK_SCROLL_DOWN,
   GDK_SCROLL_LEFT,
-  GDK_SCROLL_RIGHT
+  GDK_SCROLL_RIGHT,
+  GDK_SCROLL_SMOOTH
 } GdkScrollDirection;
 
 /**
@@ -336,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.
  */
@@ -346,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;
 
 /**
@@ -372,6 +459,7 @@ typedef enum
  *   decorations.
  * @GDK_WINDOW_STATE_ABOVE: the window is kept above other windows.
  * @GDK_WINDOW_STATE_BELOW: the window is kept below other windows.
+ * @GDK_WINDOW_STATE_FOCUSED: the window is presented as focused (with active decorations).
  *
  * Specifies the state of a toplevel window.
  */
@@ -383,7 +471,8 @@ typedef enum
   GDK_WINDOW_STATE_STICKY     = 1 << 3,
   GDK_WINDOW_STATE_FULLSCREEN = 1 << 4,
   GDK_WINDOW_STATE_ABOVE      = 1 << 5,
-  GDK_WINDOW_STATE_BELOW      = 1 << 6
+  GDK_WINDOW_STATE_BELOW      = 1 << 6,
+  GDK_WINDOW_STATE_FOCUSED    = 1 << 7
 } GdkWindowState;
 
 /**
@@ -546,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:
@@ -594,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).
@@ -607,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.
@@ -617,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
 {
@@ -630,6 +776,8 @@ struct _GdkEventScroll
   GdkScrollDirection direction;
   GdkDevice *device;
   gdouble x_root, y_root;
+  gdouble delta_x;
+  gdouble delta_y;
 };
 
 /**
@@ -773,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.
  */
@@ -799,7 +947,7 @@ struct _GdkEventProperty
  * @target: the target to which the selection should be converted.
  * @property: the property in which to place the result of the conversion.
  * @time: the time of the event in milliseconds.
- * @requestor: the native window on which to place @property.
+ * @requestor: the window on which to place @property or %NULL if none.
  *
  * Generated when a selection is requested or ownership of a selection
  * is taken over by another client application.
@@ -813,21 +961,21 @@ struct _GdkEventSelection
   GdkAtom target;
   GdkAtom property;
   guint32 time;
-  GdkNativeWindow requestor;
+  GdkWindow *requestor;
 };
 
 /**
  * GdkEventOwnerChange:
  * @type: the type of the event (%GDK_OWNER_CHANGE).
- * @window: the window which received the event.
+ * @window: the window which received the event
  * @send_event: %TRUE if the event was sent explicitly (e.g. using
- *   <function>XSendEvent</function>).
- * @owner: the new owner of the selection.
- * @reason: the reason for the ownership change as a #GdkOwnerChange value.
- * @selection: the atom identifying the selection.
- * @time: the timestamp of the event.
+ *   <function>XSendEvent</function>)
+ * @owner: the new owner of the selection, or %NULL if there is none
+ * @reason: the reason for the ownership change as a #GdkOwnerChange value
+ * @selection: the atom identifying the selection
+ * @time: the timestamp of the event
  * @selection_time: the time at which the selection ownership was taken
- *   over.
+ *   over
  *
  * Generated when the owner of a selection changes. On X11, this
  * information is only available if the X server supports the XFIXES
@@ -874,35 +1022,6 @@ struct _GdkEventProximity
   GdkDevice *device;
 };
 
-/**
- * GdkEventClient:
- * @type: the type of the event (%GDK_CLIENT_EVENT).
- * @window: the window which received the event.
- * @send_event: %TRUE if the event was sent explicitly (e.g. using
- *   <function>XSendEvent</function>).
- * @message_type: the type of the message, which can be defined by the
- *   application.
- * @data_format: the format of the data, given as the number of bits in each
- *   data element, i.e. 8, 16, or 32. 8-bit data uses the b array of the
- *   data union, 16-bit data uses the s array, and 32-bit data uses the l
- *   array.
- *
- * An event sent by another client application.
- */
-struct _GdkEventClient
-{
-  GdkEventType type;
-  GdkWindow *window;
-  gint8 send_event;
-  GdkAtom message_type;
-  gushort data_format;
-  union {
-    char b[20];
-    short s[10];
-    long l[5];
-  } data;
-};
-
 /**
  * GdkEventSetting:
  * @type: the type of the event (%GDK_SETTING).
@@ -1051,6 +1170,7 @@ union _GdkEvent
   GdkEventVisibility       visibility;
   GdkEventMotion           motion;
   GdkEventButton           button;
+  GdkEventTouch             touch;
   GdkEventScroll            scroll;
   GdkEventKey              key;
   GdkEventCrossing         crossing;
@@ -1060,7 +1180,6 @@ union _GdkEvent
   GdkEventSelection        selection;
   GdkEventOwnerChange              owner_change;
   GdkEventProximity        proximity;
-  GdkEventClient           client;
   GdkEventDND               dnd;
   GdkEventWindowState       window_state;
   GdkEventSetting           setting;
@@ -1085,9 +1204,29 @@ gboolean  gdk_event_get_state           (const GdkEvent  *event,
 gboolean  gdk_event_get_coords         (const GdkEvent  *event,
                                         gdouble         *x_win,
                                         gdouble         *y_win);
-gboolean  gdk_event_get_root_coords    (const GdkEvent  *event,
-                                        gdouble         *x_root,
-                                        gdouble         *y_root);
+gboolean  gdk_event_get_root_coords    (const GdkEvent *event,
+                                        gdouble        *x_root,
+                                        gdouble        *y_root);
+GDK_AVAILABLE_IN_3_2
+gboolean  gdk_event_get_button          (const GdkEvent *event,
+                                         guint          *button);
+GDK_AVAILABLE_IN_3_2
+gboolean  gdk_event_get_click_count     (const GdkEvent *event,
+                                         guint          *click_count);
+GDK_AVAILABLE_IN_3_2
+gboolean  gdk_event_get_keyval          (const GdkEvent *event,
+                                         guint          *keyval);
+GDK_AVAILABLE_IN_3_2
+gboolean  gdk_event_get_keycode         (const GdkEvent *event,
+                                         guint16        *keycode);
+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);
@@ -1097,7 +1236,9 @@ GdkDevice* gdk_event_get_device         (const GdkEvent  *event);
 void       gdk_event_set_source_device  (GdkEvent        *event,
                                          GdkDevice       *device);
 GdkDevice* gdk_event_get_source_device  (const GdkEvent  *event);
-void      gdk_event_request_motions     (const GdkEventMotion *event);
+void       gdk_event_request_motions    (const GdkEventMotion *event);
+GDK_AVAILABLE_IN_3_4
+gboolean   gdk_event_triggers_context_menu (const GdkEvent *event);
 
 gboolean  gdk_events_get_distance       (GdkEvent        *event1,
                                          GdkEvent        *event2,
@@ -1118,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);
 
@@ -1125,19 +1269,9 @@ gboolean  gdk_get_show_events            (void);
 
 gboolean gdk_setting_get                           (const gchar *name,
                                                     GValue          *value);
-void gdk_add_client_message_filter                 (GdkAtom          message_type,
-                                                    GdkFilterFunc    func,
-                                                    gpointer         data);
-gboolean gdk_event_send_client_message             (GdkEvent        *event,
-                                                    GdkNativeWindow  winid);
-void     gdk_event_send_clientmessage_toall        (GdkEvent        *event);
 
 #endif /* GDK_MULTIHEAD_SAFE */
 
-gboolean gdk_event_send_client_message_for_display (GdkDisplay      *display,
-                                                    GdkEvent        *event,
-                                                    GdkNativeWindow  winid);
-
 G_END_DECLS
 
 #endif /* __GDK_EVENTS_H__ */