gdkevents.h

Go to the documentation of this file.
00001 #ifndef __GDK_EVENTS_H__
00002 #define __GDK_EVENTS_H__
00003 
00004 #include <gdk/gdktypes.h>
00005 #include <gdk/gdkdnd.h>
00006 #include <gdk/gdkinput.h>
00007 
00008 #ifdef __cplusplus
00009 extern "C" {
00010 #endif                          /* __cplusplus */
00011 
00012 #define   GDK_PRIORITY_EVENTS           (G_PRIORITY_DEFAULT)
00013 
00014    typedef struct _GdkEventAny GdkEventAny;
00015    typedef struct _GdkEventExpose GdkEventExpose;
00016    typedef struct _GdkEventNoExpose GdkEventNoExpose;
00017    typedef struct _GdkEventVisibility GdkEventVisibility;
00018    typedef struct _GdkEventMotion GdkEventMotion;
00019    typedef struct _GdkEventButton GdkEventButton;
00020    typedef struct _GdkEventScroll GdkEventScroll;
00021    typedef struct _GdkEventKey GdkEventKey;
00022    typedef struct _GdkEventFocus GdkEventFocus;
00023    typedef struct _GdkEventCrossing GdkEventCrossing;
00024    typedef struct _GdkEventConfigure GdkEventConfigure;
00025    typedef struct _GdkEventProperty GdkEventProperty;
00026    typedef struct _GdkEventSelection GdkEventSelection;
00027    typedef struct _GdkEventProximity GdkEventProximity;
00028    typedef struct _GdkEventClient GdkEventClient;
00029 
00030    typedef struct _GdkEventDND GdkEventDND;
00031 
00032    typedef union _GdkEvent GdkEvent;
00033 
00034    typedef void (*GdkEventFunc) (GdkEvent * event, gpointer data);
00035 
00036 /* Event filtering */
00037 
00038    typedef void GdkXEvent;      /* Can be cast to XEvent */
00039 
00040    typedef enum {
00041       GDK_FILTER_CONTINUE,      /* Event not handled, continue processesing */
00042       GDK_FILTER_TRANSLATE,     /* Translated event stored */
00043       GDK_FILTER_REMOVE         /* Terminate processing, removing event */
00044    } GdkFilterReturn;
00045 
00046    typedef GdkFilterReturn(*GdkFilterFunc) (GdkXEvent * xevent,
00047                                             GdkEvent * event,
00048                                             gpointer data);
00049 
00050 
00051 /* Event types.
00052  *   Nothing: No event occurred.
00053  *   Delete: A window delete event was sent by the window manager.
00054  *           The specified window should be deleted.
00055  *   Destroy: A window has been destroyed.
00056  *   Expose: Part of a window has been uncovered.
00057  *   NoExpose: Same as expose, but no expose event was generated.
00058  *   VisibilityNotify: A window has become fully/partially/not obscured.
00059  *   MotionNotify: The mouse has moved.
00060  *   ButtonPress: A mouse button was pressed.
00061  *   ButtonRelease: A mouse button was release.
00062  *   KeyPress: A key was pressed.
00063  *   KeyRelease: A key was released.
00064  *   EnterNotify: A window was entered.
00065  *   LeaveNotify: A window was exited.
00066  *   FocusChange: The focus window has changed. (The focus window gets
00067  *                keyboard events).
00068  *   Resize: A window has been resized.
00069  *   Map: A window has been mapped. (It is now visible on the screen).
00070  *   Unmap: A window has been unmapped. (It is no longer visible on
00071  *          the screen).
00072  *   Scroll: A mouse wheel was scrolled either up or down.
00073  */
00074    typedef enum {
00075       GDK_NOTHING = -1,
00076       GDK_DELETE = 0,
00077       GDK_DESTROY = 1,
00078       GDK_EXPOSE = 2,
00079       GDK_MOTION_NOTIFY = 3,
00080       GDK_BUTTON_PRESS = 4,
00081       GDK_2BUTTON_PRESS = 5,
00082       GDK_3BUTTON_PRESS = 6,
00083       GDK_BUTTON_RELEASE = 7,
00084       GDK_KEY_PRESS = 8,
00085       GDK_KEY_RELEASE = 9,
00086       GDK_ENTER_NOTIFY = 10,
00087       GDK_LEAVE_NOTIFY = 11,
00088       GDK_FOCUS_CHANGE = 12,
00089       GDK_CONFIGURE = 13,
00090       GDK_MAP = 14,
00091       GDK_UNMAP = 15,
00092       GDK_PROPERTY_NOTIFY = 16,
00093       GDK_SELECTION_CLEAR = 17,
00094       GDK_SELECTION_REQUEST = 18,
00095       GDK_SELECTION_NOTIFY = 19,
00096       GDK_PROXIMITY_IN = 20,
00097       GDK_PROXIMITY_OUT = 21,
00098       GDK_DRAG_ENTER = 22,
00099       GDK_DRAG_LEAVE = 23,
00100       GDK_DRAG_MOTION = 24,
00101       GDK_DRAG_STATUS = 25,
00102       GDK_DROP_START = 26,
00103       GDK_DROP_FINISHED = 27,
00104       GDK_CLIENT_EVENT = 28,
00105       GDK_VISIBILITY_NOTIFY = 29,
00106       GDK_NO_EXPOSE = 30,
00107       GDK_SCROLL = 31
00108    } GdkEventType;
00109 
00110 /* Event masks. (Used to select what types of events a window
00111  *  will receive).
00112  */
00113    typedef enum {
00114       GDK_EXPOSURE_MASK = 1 << 1,
00115       GDK_POINTER_MOTION_MASK = 1 << 2,
00116       GDK_POINTER_MOTION_HINT_MASK = 1 << 3,
00117       GDK_BUTTON_MOTION_MASK = 1 << 4,
00118       GDK_BUTTON1_MOTION_MASK = 1 << 5,
00119       GDK_BUTTON2_MOTION_MASK = 1 << 6,
00120       GDK_BUTTON3_MOTION_MASK = 1 << 7,
00121       GDK_BUTTON_PRESS_MASK = 1 << 8,
00122       GDK_BUTTON_RELEASE_MASK = 1 << 9,
00123       GDK_KEY_PRESS_MASK = 1 << 10,
00124       GDK_KEY_RELEASE_MASK = 1 << 11,
00125       GDK_ENTER_NOTIFY_MASK = 1 << 12,
00126       GDK_LEAVE_NOTIFY_MASK = 1 << 13,
00127       GDK_FOCUS_CHANGE_MASK = 1 << 14,
00128       GDK_STRUCTURE_MASK = 1 << 15,
00129       GDK_PROPERTY_CHANGE_MASK = 1 << 16,
00130       GDK_VISIBILITY_NOTIFY_MASK = 1 << 17,
00131       GDK_PROXIMITY_IN_MASK = 1 << 18,
00132       GDK_PROXIMITY_OUT_MASK = 1 << 19,
00133       GDK_SUBSTRUCTURE_MASK = 1 << 20,
00134       GDK_SCROLL_MASK = 1 << 21,
00135       GDK_ALL_EVENTS_MASK = 0x3FFFFE
00136    } GdkEventMask;
00137 
00138    typedef enum {
00139       GDK_VISIBILITY_UNOBSCURED,
00140       GDK_VISIBILITY_PARTIAL,
00141       GDK_VISIBILITY_FULLY_OBSCURED
00142    } GdkVisibilityState;
00143 
00144    typedef enum {
00145       GDK_SCROLL_UP,
00146       GDK_SCROLL_DOWN,
00147       GDK_SCROLL_LEFT,
00148       GDK_SCROLL_RIGHT
00149    } GdkScrollDirection;
00150 
00151 /* Types of enter/leave notifications.
00152  *   Ancestor:
00153  *   Virtual:
00154  *   Inferior:
00155  *   Nonlinear:
00156  *   NonlinearVirtual:
00157  *   Unknown: An unknown type of enter/leave event occurred.
00158  */
00159    typedef enum {
00160       GDK_NOTIFY_ANCESTOR = 0,
00161       GDK_NOTIFY_VIRTUAL = 1,
00162       GDK_NOTIFY_INFERIOR = 2,
00163       GDK_NOTIFY_NONLINEAR = 3,
00164       GDK_NOTIFY_NONLINEAR_VIRTUAL = 4,
00165       GDK_NOTIFY_UNKNOWN = 5
00166    } GdkNotifyType;
00167 
00168 /* Enter/leave event modes.
00169  *   NotifyNormal
00170  *   NotifyGrab
00171  *   NotifyUngrab
00172  */
00173    typedef enum {
00174       GDK_CROSSING_NORMAL,
00175       GDK_CROSSING_GRAB,
00176       GDK_CROSSING_UNGRAB
00177    } GdkCrossingMode;
00178 
00179    typedef enum {
00180       GDK_PROPERTY_NEW_VALUE,
00181       GDK_PROPERTY_DELETE
00182    } GdkPropertyState;
00183 
00184    struct _GdkEventAny {
00185       GdkEventType type;
00186       GdkWindow *window;
00187       gint8 send_event;
00188    };
00189 
00190    struct _GdkEventExpose {
00191       GdkEventType type;
00192       GdkWindow *window;
00193       gint8 send_event;
00194       GdkRectangle area;
00195       gint count;               /* If non-zero, how many more events follow. */
00196    };
00197 
00198    struct _GdkEventNoExpose {
00199       GdkEventType type;
00200       GdkWindow *window;
00201       gint8 send_event;
00202       /* XXX: does anyone need the X major_code or minor_code fields? */
00203    };
00204 
00205    struct _GdkEventVisibility {
00206       GdkEventType type;
00207       GdkWindow *window;
00208       gint8 send_event;
00209       GdkVisibilityState state;
00210    };
00211 
00212    struct _GdkEventMotion {
00213       GdkEventType type;
00214       GdkWindow *window;
00215       gint8 send_event;
00216       guint32 time;
00217       gdouble x;
00218       gdouble y;
00219       gdouble pressure;
00220       gdouble xtilt;
00221       gdouble ytilt;
00222       guint state;
00223       gint16 is_hint;
00224       GdkInputSource source;
00225       guint32 deviceid;
00226       gdouble x_root, y_root;
00227    };
00228 
00229    struct _GdkEventButton {
00230       GdkEventType type;
00231       GdkWindow *window;
00232       gint8 send_event;
00233       guint32 time;
00234       gdouble x;
00235       gdouble y;
00236       gdouble pressure;
00237       gdouble xtilt;
00238       gdouble ytilt;
00239       guint state;
00240       guint button;
00241       GdkInputSource source;
00242       guint32 deviceid;
00243       gdouble x_root, y_root;
00244    };
00245 
00246    struct _GdkEventScroll {
00247       GdkEventType type;
00248       GdkWindow *window;
00249       gint8 send_event;
00250       guint32 time;
00251       gdouble x;
00252       gdouble y;
00253       gdouble pressure;
00254       gdouble xtilt;
00255       gdouble ytilt;
00256       guint state;
00257       GdkScrollDirection direction;
00258       GdkInputSource source;
00259       guint32 deviceid;
00260       gdouble x_root, y_root;
00261    };
00262 
00263    struct _GdkEventKey {
00264       GdkEventType type;
00265       GdkWindow *window;
00266       gint8 send_event;
00267       guint32 time;
00268       guint state;
00269       guint keyval;
00270       gint length;
00271       gchar *string;
00272    };
00273 
00274    struct _GdkEventCrossing {
00275       GdkEventType type;
00276       GdkWindow *window;
00277       gint8 send_event;
00278       GdkWindow *subwindow;
00279       guint32 time;
00280       gdouble x;
00281       gdouble y;
00282       gdouble x_root;
00283       gdouble y_root;
00284       GdkCrossingMode mode;
00285       GdkNotifyType detail;
00286       gboolean focus;
00287       guint state;
00288    };
00289 
00290    struct _GdkEventFocus {
00291       GdkEventType type;
00292       GdkWindow *window;
00293       gint8 send_event;
00294       gint16 in;
00295    };
00296 
00297    struct _GdkEventConfigure {
00298       GdkEventType type;
00299       GdkWindow *window;
00300       gint8 send_event;
00301       gint16 x, y;
00302       gint16 width;
00303       gint16 height;
00304    };
00305 
00306    struct _GdkEventProperty {
00307       GdkEventType type;
00308       GdkWindow *window;
00309       gint8 send_event;
00310       GdkAtom atom;
00311       guint32 time;
00312       guint state;
00313    };
00314 
00315    struct _GdkEventSelection {
00316       GdkEventType type;
00317       GdkWindow *window;
00318       gint8 send_event;
00319       GdkAtom selection;
00320       GdkAtom target;
00321       GdkAtom property;
00322       guint32 requestor;
00323       guint32 time;
00324    };
00325 
00326 /* This event type will be used pretty rarely. It only is important
00327    for XInput aware programs that are drawing their own cursor */
00328 
00329    struct _GdkEventProximity {
00330       GdkEventType type;
00331       GdkWindow *window;
00332       gint8 send_event;
00333       guint32 time;
00334       GdkInputSource source;
00335       guint32 deviceid;
00336    };
00337 
00338    struct _GdkEventClient {
00339       GdkEventType type;
00340       GdkWindow *window;
00341       gint8 send_event;
00342       GdkAtom message_type;
00343       gushort data_format;
00344       union {
00345          char b[20];
00346          short s[10];
00347          long l[5];
00348       } data;
00349    };
00350 
00351 /* Event types for DND */
00352 
00353    struct _GdkEventDND {
00354       GdkEventType type;
00355       GdkWindow *window;
00356       gint8 send_event;
00357       GdkDragContext *context;
00358 
00359       guint32 time;
00360       gshort x_root, y_root;
00361    };
00362 
00363    union _GdkEvent {
00364       GdkEventType type;
00365       GdkEventAny any;
00366       GdkEventExpose expose;
00367       GdkEventNoExpose no_expose;
00368       GdkEventVisibility visibility;
00369       GdkEventMotion motion;
00370       GdkEventButton button;
00371       GdkEventScroll scroll;
00372       GdkEventKey key;
00373       GdkEventCrossing crossing;
00374       GdkEventFocus focus_change;
00375       GdkEventConfigure configure;
00376       GdkEventProperty property;
00377       GdkEventSelection selection;
00378       GdkEventProximity proximity;
00379       GdkEventClient client;
00380       GdkEventDND dnd;
00381    };
00382 
00383    gboolean gdk_events_pending(void);
00384    GdkEvent *gdk_event_get(void);
00385 
00386    GdkEvent *gdk_event_peek(void);
00387    GdkEvent *gdk_event_get_graphics_expose(GdkWindow * window);
00388    void gdk_event_put(GdkEvent * event);
00389 
00390    GdkEvent *gdk_event_copy(GdkEvent * event);
00391    void gdk_event_free(GdkEvent * event);
00392    guint32 gdk_event_get_time(GdkEvent * event);
00393 
00394    void gdk_event_handler_set(GdkEventFunc func,
00395                               gpointer data, GDestroyNotify notify);
00396 
00397    void gdk_set_show_events(gboolean show_events);
00398    gboolean gdk_get_show_events(void);
00399 
00400 /*
00401  * The following function adds a global filter for all client
00402  * messages of type message_type
00403  */
00404    void gdk_add_client_message_filter(GdkAtom message_type,
00405                                       GdkFilterFunc func, gpointer data);
00406 
00407    gboolean gdk_check_typed_window_event(GdkWindow * w, gint type,
00408                                          GdkEvent * event);
00409 
00410 #ifdef __cplusplus
00411 }
00412 #endif                          /* __cplusplus */
00413 #endif                          /* __GDK_EVENTS_H__ */

Generated on Tue Jul 5 14:14:37 2011 for ROOT_528-00b_version by  doxygen 1.5.1