1 <!-- ##### SECTION Title ##### -->
4 <!-- ##### SECTION Short_Description ##### -->
5 data structures specific to each type of event.
7 <!-- ##### SECTION Long_Description ##### -->
9 The event structs contain data specific to each type of event in GDK.
13 A common mistake is to forget to set the event mask of a widget so that the
14 required events are received. See gtk_widget_set_events().
18 <!-- ##### SECTION See_Also ##### -->
23 <!-- ##### UNION GdkEvent ##### -->
25 The #GdkEvent struct contains a union of all of the event structs,
26 and allows access to the data fields in a number of ways.
29 The event type is always the first field in all of the event structs, and
30 can always be accessed with the following code, no matter what type of event
43 To access other fields of the event structs, the pointer to the event can be
44 cast to the appropriate event struct pointer, or the union member name can be
45 used. For example if the event type is %GDK_BUTTON_PRESS then the x coordinate
46 of the button press can be accessed with:
52 x = ((GdkEventButton*)event)->x;
67 <!-- ##### STRUCT GdkEventAny ##### -->
69 Contains the fields which are common to all event structs.
70 Any event pointer can safely be cast to a pointer to a #GdkEventAny to access
74 @type: the type of the event.
75 @window: the window which received the event.
76 @send_event: %TRUE if the event was sent explicitly (e.g. using
77 <function>XSendEvent</function>).
79 <!-- ##### STRUCT GdkEventKey ##### -->
81 Describes a key press or key release event.
84 @type: the type of the event (%GDK_KEY_PRESS or %GDK_KEY_RELEASE).
85 @window: the window which received the event.
86 @send_event: %TRUE if the event was sent explicitly (e.g. using
87 <function>XSendEvent</function>).
88 @time: the time of the event in milliseconds.
89 @state: a bit-mask representing the state of the modifier keys (e.g. Control,
90 Shift and Alt) and the pointer buttons. See #GdkModifierType.
91 @keyval: the key that was pressed or released. See the <filename><gdk/gdkkeysym.h></filename>
92 header file for a complete list of GDK key codes.
93 @length: the length of @string.
94 @string: a nul-terminated multi-byte string containing the composed characters
95 resulting from the key press. When text is being input, in a #GtkEntry for
96 example, it is these characters which should be added to the input buffer.
97 When using <link linkend="gdk-Input-Methods">Input Methods</link> to support
98 internationalized text input, the composed characters appear here after the
99 pre-editing has been completed.
100 @hardware_keycode: the raw code of the key that was pressed or released.
101 @group: the keyboard group.
103 <!-- ##### STRUCT GdkEventButton ##### -->
105 Used for button press and button release events. The
106 <structfield>type</structfield> field will be one of %GDK_BUTTON_PRESS,
107 %GDK_2BUTTON_PRESS, %GDK_3BUTTON_PRESS, and %GDK_BUTTON_RELEASE.
110 Double and triple-clicks result in a sequence of events being received.
111 For double-clicks the order of events will be:
113 <listitem><para>%GDK_BUTTON_PRESS</para></listitem>
114 <listitem><para>%GDK_BUTTON_RELEASE</para></listitem>
115 <listitem><para>%GDK_BUTTON_PRESS</para></listitem>
116 <listitem><para>%GDK_2BUTTON_PRESS</para></listitem>
117 <listitem><para>%GDK_BUTTON_RELEASE</para></listitem>
119 Note that the first click is received just like a normal
120 button press, while the second click results in a %GDK_2BUTTON_PRESS being
121 received just after the %GDK_BUTTON_PRESS.
124 Triple-clicks are very similar to double-clicks, except that %GDK_3BUTTON_PRESS
125 is inserted after the third click. The order of the events is:
127 <listitem><para>%GDK_BUTTON_PRESS</para></listitem>
128 <listitem><para>%GDK_BUTTON_RELEASE</para></listitem>
129 <listitem><para>%GDK_BUTTON_PRESS</para></listitem>
130 <listitem><para>%GDK_2BUTTON_PRESS</para></listitem>
131 <listitem><para>%GDK_BUTTON_RELEASE</para></listitem>
132 <listitem><para>%GDK_BUTTON_PRESS</para></listitem>
133 <listitem><para>%GDK_3BUTTON_PRESS</para></listitem>
134 <listitem><para>%GDK_BUTTON_RELEASE</para></listitem>
138 For a double click to occur, the second button press must occur within 1/4 of
139 a second of the first. For a triple click to occur, the third button press
140 must also occur within 1/2 second of the first button press.
143 @type: the type of the event (%GDK_BUTTON_PRESS, %GDK_2BUTTON_PRESS,
144 %GDK_3BUTTON_PRESS or %GDK_BUTTON_RELEASE).
145 @window: the window which received the event.
146 @send_event: %TRUE if the event was sent explicitly (e.g. using
147 <function>XSendEvent</function>).
148 @time: the time of the event in milliseconds.
149 @x: the x coordinate of the pointer relative to the window.
150 @y: the y coordinate of the pointer relative to the window.
151 @axes: @x, @y translated to the axes of @device, or %NULL if @device is
153 @state: a bit-mask representing the state of the modifier keys (e.g. Control,
154 Shift and Alt) and the pointer buttons. See #GdkModifierType.
155 @button: the button which was pressed or released, numbered from 1 to 5.
156 Normally button 1 is the left mouse button, 2 is the middle button,
157 and 3 is the right button. On 2-button mice, the middle button can often
158 be simulated by pressing both mouse buttons together.
159 @device: the device where the event originated.
160 @x_root: the x coordinate of the pointer relative to the root of the screen.
161 @y_root: the y coordinate of the pointer relative to the root of the screen.
163 <!-- ##### STRUCT GdkEventScroll ##### -->
165 Generated from button presses for the buttons 4 to 7. Wheel mice are
166 usually configured to generate button press events for buttons 4 and 5
167 when the wheel is turned.
170 @type: the type of the event (%GDK_SCROLL).
171 @window: the window which received the event.
172 @send_event: %TRUE if the event was sent explicitly (e.g. using
173 <function>XSendEvent</function>).
174 @x: the x coordinate of the pointer relative to the window.
175 @y: the y coordinate of the pointer relative to the window.
176 @state: a bit-mask representing the state of the modifier keys (e.g. Control,
177 Shift and Alt) and the pointer buttons. See #GdkModifierType.
178 @direction: the direction to scroll to (one of %GDK_SCROLL_UP,
179 %GDK_SCROLL_DOWN, %GDK_SCROLL_LEFT and %GDK_SCROLL_RIGHT).
180 @device: the device where the event originated.
181 @x_root: the x coordinate of the pointer relative to the root of the screen.
182 @y_root: the y coordinate of the pointer relative to the root of the screen.
184 <!-- ##### STRUCT GdkEventMotion ##### -->
186 Generated when the pointer moves.
189 @type: the type of the event.
190 @window: the window which received the event.
191 @send_event: %TRUE if the event was sent explicitly (e.g. using
192 <function>XSendEvent</function>).
193 @time: the time of the event in milliseconds.
194 @x: the x coordinate of the pointer relative to the window.
195 @y: the y coordinate of the pointer relative to the window.
196 @axes: @x, @y translated to the axes of @device, or %NULL if @device is
198 @state: a bit-mask representing the state of the modifier keys (e.g. Control,
199 Shift and Alt) and the pointer buttons. See #GdkModifierType.
201 @device: the device where the event originated.
202 @x_root: the x coordinate of the pointer relative to the root of the screen.
203 @y_root: the y coordinate of the pointer relative to the root of the screen.
205 <!-- ##### STRUCT GdkEventExpose ##### -->
207 Generated when all or part of a window becomes visible and needs to be
211 @type: the type of the event (%GDK_EXPOSE).
212 @window: the window which received the event.
213 @send_event: %TRUE if the event was sent explicitly (e.g. using
214 <function>XSendEvent</function>).
215 @area: bounding box of @region.
216 @region: the region that needs to be redrawn.
217 @count: the number of contiguous %GDK_EXPOSE events following this one.
218 The only use for this is "exposure compression", i.e. handling all contiguous
219 %GDK_EXPOSE events in one go, though GDK performs some exposure compression
220 so this is not normally needed.
222 <!-- ##### STRUCT GdkEventVisibility ##### -->
224 Generated when the window visibility status has changed.
227 @type: the type of the event (%GDK_VISIBILITY_NOTIFY).
228 @window: the window which received the event.
229 @send_event: %TRUE if the event was sent explicitly (e.g. using
230 <function>XSendEvent</function>).
231 @state: the new visibility state (%GDK_VISIBILITY_FULLY_OBSCURED,
232 %GDK_VISIBILITY_PARTIAL or %GDK_VISIBILITY_UNOBSCURED).
234 <!-- ##### STRUCT GdkEventCrossing ##### -->
236 Generated when the pointer enters or leaves a window.
239 @type: the type of the event (%GDK_ENTER_NOTIFY or %GDK_LEAVE_NOTIFY).
240 @window: the window which received the event.
241 @send_event: %TRUE if the event was sent explicitly (e.g. using
242 <function>XSendEvent</function>).
243 @subwindow: the window that was entered or left.
244 @time: the time of the event in milliseconds.
245 @x: the x coordinate of the pointer relative to the window.
246 @y: the y coordinate of the pointer relative to the window.
247 @x_root: the x coordinate of the pointer relative to the root of the screen.
248 @y_root: the y coordinate of the pointer relative to the root of the screen.
249 @mode: the crossing mode (%GDK_CROSSING_NORMAL, %GDK_CROSSING_GRAB or
250 %GDK_CROSSING_UNGRAB).
251 @detail: the kind of crossing that happended (%GDK_NOTIFY_INFERIOR,
252 %GDK_NOTIFY_ANCESTOR, %GDK_NOTIFY_VIRTUAL, %GDK_NOTIFY_NONLINEAR or
253 %GDK_NOTIFY_NONLINEAR_VIRTUAL).
254 @focus: %TRUE if @window is the focus window or an inferior.
255 @state: a bit-mask representing the state of the modifier keys (e.g. Control,
256 Shift and Alt) and the pointer buttons. See #GdkModifierType.
258 <!-- ##### STRUCT GdkEventFocus ##### -->
260 Describes a change of keyboard focus.
263 @type: the type of the event (%GDK_FOCUS_CHANGE).
264 @window: the window which received the event.
265 @send_event: %TRUE if the event was sent explicitly (e.g. using <function>XSendEvent</function>).
266 @in: %TRUE if the window has gained the keyboard focus, %FALSE if it has lost
269 <!-- ##### STRUCT GdkEventConfigure ##### -->
271 Generated when a window size or position has changed.
274 @type: the type of the event (%GDK_CONFIGURE).
275 @window: the window which received the event.
276 @send_event: %TRUE if the event was sent explicitly (e.g. using <function>XSendEvent</function>).
277 @x: the new x coordinate of the window, relative to its parent.
278 @y: the new y coordinate of the window, relative to its parent.
279 @width: the new width of the window.
280 @height: the new height of the window.
282 <!-- ##### STRUCT GdkEventProperty ##### -->
284 Describes a property change on a window.
287 @type: the type of the event (%GDK_PROPERTY_NOTIFY).
288 @window: the window which received the event.
289 @send_event: %TRUE if the event was sent explicitly (e.g. using <function>XSendEvent</function>).
290 @atom: the property that was changed.
291 @time: the time of the event in milliseconds.
292 @state: whether the property was changed (%GDK_PROPERTY_NEW_VALUE) or
293 deleted (%GDK_PROPERTY_DELETE).
295 <!-- ##### STRUCT GdkEventSelection ##### -->
297 Generated when a selection is requested or ownership of a selection
298 is taken over by another client application.
301 @type: the type of the event (%GDK_SELECTION_CLEAR, %GDK_SELECTION_NOTIFY or
302 %GDK_SELECTION_REQUEST).
303 @window: the window which received the event.
304 @send_event: %TRUE if the event was sent explicitly (e.g. using <function>XSendEvent</function>).
305 @selection: the selection.
306 @target: the target to which the selection should be converted.
307 @property: the property in which to place the result of the conversion.
308 @time: the time of the event in milliseconds.
309 @requestor: the native window on which to place @property.
311 <!-- ##### TYPEDEF GdkNativeWindow ##### -->
313 Used to represent native windows (<type>Window</type>s for the X11 backend,
314 <type>HWND</type>s for Win32).
318 <!-- ##### STRUCT GdkEventDND ##### -->
320 Generated during DND operations.
323 @type: the type of the event (%GDK_DRAG_ENTER, %GDK_DRAG_LEAVE,
324 %GDK_DRAG_MOTION, %GDK_DRAG_STATUS, %GDK_DROP_START or %GDK_DROP_FINISHED).
325 @window: the window which received the event.
326 @send_event: %TRUE if the event was sent explicitly (e.g. using <function>XSendEvent</function>).
327 @context: the #GdkDragContext for the current DND operation.
328 @time: the time of the event in milliseconds.
329 @x_root: the x coordinate of the pointer relative to the root of the screen,
330 only set for %GDK_DRAG_MOTION and %GDK_DROP_START.
331 @y_root: the y coordinate of the pointer relative to the root of the screen,
332 only set for %GDK_DRAG_MOTION and %GDK_DROP_START.
334 <!-- ##### STRUCT GdkEventProximity ##### -->
336 FIXME: Lookup XProximityNotifyEvent.
339 @type: the type of the event (%GDK_PROXIMITY_IN or %GDK_PROXIMITY_OUT).
340 @window: the window which received the event.
341 @send_event: %TRUE if the event was sent explicitly (e.g. using <function>XSendEvent</function>).
342 @time: the time of the event in milliseconds.
343 @device: the device where the event originated.
345 <!-- ##### STRUCT GdkEventClient ##### -->
347 An event sent by another client application.
350 @type: the type of the event (%GDK_CLIENT_EVENT).
351 @window: the window which received the event.
352 @send_event: %TRUE if the event was sent explicitly (e.g. using <function>XSendEvent</function>).
353 @message_type: the type of the message, which can be defined by the
355 @data_format: the format of the data, given as the number of bits in each
356 data element, i.e. 8, 16, or 32. 8-bit data uses the b array of the data
357 union, 16-bit data uses the s array, and 32-bit data uses the l array.
359 <!-- ##### STRUCT GdkEventNoExpose ##### -->
361 Generated when the area of a #GdkDrawable being copied, with gdk_draw_pixmap()
362 or gdk_window_copy_area(), was completely available.
365 FIXME: add more here.
368 @type: the type of the event (%GDK_NO_EXPOSE).
369 @window: the window which received the event.
370 @send_event: %TRUE if the event was sent explicitly (e.g. using <function>XSendEvent</function>).
372 <!-- ##### STRUCT GdkEventWindowState ##### -->
374 Generated when the state of a toplevel window changes.
377 @type: the type of the event (%GDK_WINDOW_STATE).
378 @window: the window which received the event.
379 @send_event: %TRUE if the event was sent explicitly (e.g. using <function>XSendEvent</function>).
380 @changed_mask: mask specifying what flags have changed.
381 @new_window_state: the new window state, a combination of #GdkWindowState bits.
383 <!-- ##### STRUCT GdkEventSetting ##### -->
385 Generated when a setting is modified.
388 @type: the type of the event (%GDK_SETTING).
389 @window: the window which received the event.
390 @send_event: %TRUE if the event was sent explicitly (e.g. using <function>XSendEvent</function>).
391 @action: what happened to the setting (%GDK_SETTING_ACTION_NEW,
392 %GDK_SETTING_ACTION_CHANGED or %GDK_SETTING_ACTION_DELETED).
393 @name: the name of the setting.
395 <!-- ##### ENUM GdkScrollDirection ##### -->
397 Specifies the direction for #GdkEventScroll.
400 @GDK_SCROLL_UP: the window is scrolled up.
401 @GDK_SCROLL_DOWN: the window is scrolled down.
402 @GDK_SCROLL_LEFT: the window is scrolled to the left.
403 @GDK_SCROLL_RIGHT: the window is scrolled to the right.
405 <!-- ##### ENUM GdkVisibilityState ##### -->
407 Specifies the visiblity status of a window for a #GdkEventVisibility.
410 @GDK_VISIBILITY_UNOBSCURED: the window is completely visible.
411 @GDK_VISIBILITY_PARTIAL: the window is partially visible.
412 @GDK_VISIBILITY_FULLY_OBSCURED: the window is not visible at all.
414 <!-- ##### ENUM GdkCrossingMode ##### -->
416 Specifies the crossing mode for #GdkEventCrossing.
419 @GDK_CROSSING_NORMAL: crossing because of pointer motion.
420 @GDK_CROSSING_GRAB: crossing because a grab is activated.
421 @GDK_CROSSING_UNGRAB: crossing because a grab is deactivated.
423 <!-- ##### ENUM GdkNotifyType ##### -->
425 Specifies the kind of crossing for #GdkEventCrossing.
428 See the X11 protocol specification of <type>LeaveNotify</type> for
429 full details of crossing event generation.
432 @GDK_NOTIFY_ANCESTOR: the window is entered from an ancestor or
433 left towards an ancestor.
434 @GDK_NOTIFY_VIRTUAL: the pointer moves between an ancestor and an
435 inferior of the window.
436 @GDK_NOTIFY_INFERIOR: the window is entered from an inferior or
437 left towards an inferior.
438 @GDK_NOTIFY_NONLINEAR: the window is entered from or left towards
439 a window which is neither an ancestor nor an inferior.
440 @GDK_NOTIFY_NONLINEAR_VIRTUAL: the pointer moves between two windows
441 which are not ancestors of each other and the window is part of
442 the ancestor chain between one of these windows and their least
446 <!-- ##### ENUM GdkPropertyState ##### -->
448 Specifies the type of a property change for a #GdkEventProperty.
451 @GDK_PROPERTY_NEW_VALUE: the property value was changed.
452 @GDK_PROPERTY_DELETE: the property was deleted.
454 <!-- ##### ENUM GdkWindowState ##### -->
456 Specifies the state of a toplevel window.
459 @GDK_WINDOW_STATE_WITHDRAWN: the window is not shown.
460 @GDK_WINDOW_STATE_ICONIFIED: the window is minimized.
461 @GDK_WINDOW_STATE_MAXIMIZED: the window is maximized.
462 @GDK_WINDOW_STATE_STICKY: the window is sticky.
464 <!-- ##### ENUM GdkSettingAction ##### -->
466 Specifies the kind of modification applied to a setting in a #GdkEventSetting.
469 @GDK_SETTING_ACTION_NEW: a setting was added.
470 @GDK_SETTING_ACTION_CHANGED: a setting was changed.
471 @GDK_SETTING_ACTION_DELETED: a setting was deleted.