1XButtonEvent(3)                 XLIB FUNCTIONS                 XButtonEvent(3)
2
3
4

NAME

6       XButtonEvent,  XKeyEvent,  XMotionEvent - KeyPress, KeyRelease, Button‐
7       Press, ButtonRelease, and MotionNotify event structures
8

STRUCTURES

10       The structures for KeyPress,  KeyRelease,  ButtonPress,  ButtonRelease,
11       and MotionNotify events contain:
12
13       typedef struct {
14               int type;       /* ButtonPress or ButtonRelease */
15               unsigned long serial;   /* # of last request processed by server */
16               Bool send_event;        /* true if this came from a SendEvent request */
17               Display *display;       /* Display the event was read from */
18               Window window;  /* “event” window it is reported relative to */
19               Window root;    /* root window that the event occurred on */
20               Window subwindow;       /* child window */
21               Time time;      /* milliseconds */
22               int x, y;       /* pointer x, y coordinates in event window */
23               int x_root, y_root;     /* coordinates relative to root */
24               unsigned int state;     /* key or button mask */
25               unsigned int button;    /* detail */
26               Bool same_screen;       /* same screen flag */
27       } XButtonEvent;
28       typedef XButtonEvent XButtonPressedEvent;
29       typedef XButtonEvent XButtonReleasedEvent;
30
31       typedef struct {
32               int type;       /* KeyPress or KeyRelease */
33               unsigned long serial;   /* # of last request processed by server */
34               Bool send_event;        /* true if this came from a SendEvent request */
35               Display *display;       /* Display the event was read from */
36               Window window;  /* “event” window it is reported relative to */
37               Window root;    /* root window that the event occurred on */
38               Window subwindow;       /* child window */
39               Time time;      /* milliseconds */
40               int x, y;       /* pointer x, y coordinates in event window */
41               int x_root, y_root;     /* coordinates relative to root */
42               unsigned int state;     /* key or button mask */
43               unsigned int keycode;   /* detail */
44               Bool same_screen;       /* same screen flag */
45       } XKeyEvent;
46       typedef XKeyEvent XKeyPressedEvent;
47       typedef XKeyEvent XKeyReleasedEvent;
48
49       typedef struct {
50               int type;       /* MotionNotify */
51               unsigned long serial;   /* # of last request processed by server */
52               Bool send_event;        /* true if this came from a SendEvent request */
53               Display *display;       /* Display the event was read from */
54               Window window;  /* “event” window reported relative to */
55               Window root;    /* root window that the event occurred on */
56               Window subwindow;       /* child window */
57               Time time;      /* milliseconds */
58               int x, y;       /* pointer x, y coordinates in event window */
59               int x_root, y_root;     /* coordinates relative to root */
60               unsigned int state;     /* key or button mask */
61               char is_hint;   /* detail */
62               Bool same_screen;       /* same screen flag */
63       } XMotionEvent;
64       typedef XMotionEvent XPointerMovedEvent;
65
66       When  you receive these events, their structure members are set as fol‐
67       lows.
68
69       The type member is set to the event type constant  name  that  uniquely
70       identifies it.  For example, when the X server reports a GraphicsExpose
71       event to a client application, it sends an XGraphicsExposeEvent  struc‐
72       ture with the type member set to GraphicsExpose.  The display member is
73       set to a pointer to the display the event was read on.  The  send_event
74       member  is  set to True if the event came from a SendEvent protocol re‐
75       quest.  The serial member is set from the serial number reported in the
76       protocol  but expanded from the 16-bit least-significant bits to a full
77       32-bit value.  The window member is set to the window that is most use‐
78       ful to toolkit dispatchers.
79
80       These  structures have the following common members: window, root, sub‐
81       window, time, x, y, x_root, y_root, state, and same_screen.  The window
82       member is set to the window on which the event was generated and is re‐
83       ferred to as the event window.  As long as  the  conditions  previously
84       discussed  are  met,  this is the window used by the X server to report
85       the event.  The root member is set to the source window's root  window.
86       The x_root and y_root members are set to the pointer's coordinates rel‐
87       ative to the root window's origin at the time of the event.
88
89       The same_screen member is set to indicate whether the event  window  is
90       on  the same screen as the root window and can be either True or False.
91       If True, the event and root windows are on the same screen.  If  False,
92       the event and root windows are not on the same screen.
93
94       If  the source window is an inferior of the event window, the subwindow
95       member of the structure is set to the child of the event window that is
96       the  source window or the child of the event window that is an ancestor
97       of the source window.  Otherwise, the X server sets the subwindow  mem‐
98       ber  to  None.   The  time member is set to the time when the event was
99       generated and is expressed in milliseconds.
100
101       If the event window is on the same screen as the root window, the x and
102       y  members  are  set  to the coordinates relative to the event window's
103       origin.  Otherwise, these members are set to zero.
104
105       The state member is set to indicate the logical state  of  the  pointer
106       buttons and modifier keys just prior to the event, which is the bitwise
107       inclusive OR of one or more of the button or modifier key  masks:  But‐
108       ton1Mask,  Button2Mask,  Button3Mask,  Button4Mask, Button5Mask, Shift‐
109       Mask, LockMask, ControlMask, Mod1Mask,  Mod2Mask,  Mod3Mask,  Mod4Mask,
110       and Mod5Mask.
111
112       Each  of  these structures also has a member that indicates the detail.
113       For the XKeyPressedEvent and XKeyReleasedEvent structures, this  member
114       is  called a keycode.  It is set to a number that represents a physical
115       key on the keyboard.  The keycode is an  arbitrary  representation  for
116       any key on the keyboard (see sections 12.7 and 16.1).
117
118       For  the  XButtonPressedEvent and XButtonReleasedEvent structures, this
119       member is called button.  It represents the pointer button that changed
120       state  and  can  be  the Button1, Button2, Button3, Button4, or Button5
121       value.  For the XPointerMovedEvent structure,  this  member  is  called
122       is_hint.  It can be set to NotifyNormal or NotifyHint.
123

SEE ALSO

125       XAnyEvent(3),    XCreateWindowEvent(3),   XCirculateEvent(3),   XCircu‐
126       lateRequestEvent(3), XColormapEvent(3), XConfigureEvent(3),  XConfigur‐
127       eRequestEvent(3),   XCrossingEvent(3),   XDestroyWindowEvent(3),   XEr‐
128       rorEvent(3),   XExposeEvent(3),   XFocusChangeEvent(3),    XGraphicsEx‐
129       poseEvent(3),  XGravityEvent(3), XKeymapEvent(3), XMapEvent(3), XMapRe‐
130       questEvent(3),    XPropertyEvent(3),     XReparentEvent(3),     XResiz‐
131       eRequestEvent(3),  XSelectionClearEvent(3), XSelectionEvent(3), XSelec‐
132       tionRequestEvent(3), XUnmapEvent(3), XVisibilityEvent(3)
133       Xlib - C Language X Interface
134
135
136
137X Version 11                     libX11 1.7.0                  XButtonEvent(3)
Impressum