1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = gdk3-Events.html
27  * outPack = gdk
28  * outFile = Event
29  * strct   = GdkEvent
30  * realStrct=
31  * ctorStrct=
32  * clss    = Event
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gdk_event_
41  * 	- gdk_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * 	- gobject.Value
49  * 	- gdk.Device
50  * 	- gdk.Screen
51  * 	- gdk.Window
52  * structWrap:
53  * 	- GValue* -> Value
54  * 	- GdkDevice* -> Device
55  * 	- GdkEvent* -> Event
56  * 	- GdkScreen* -> Screen
57  * 	- GdkWindow* -> Window
58  * module aliases:
59  * local aliases:
60  * overrides:
61  */
62 
63 module gdk.Event;
64 
65 public  import gtkc.gdktypes;
66 
67 private import gtkc.gdk;
68 private import glib.ConstructionException;
69 private import gobject.ObjectG;
70 
71 
72 private import glib.Str;
73 private import gobject.Value;
74 private import gdk.Device;
75 private import gdk.Screen;
76 private import gdk.Window;
77 
78 
79 
80 
81 /**
82  * This section describes functions dealing with events from the window
83  * system.
84  *
85  * In GTK+ applications the events are handled automatically in
86  * gtk_main_do_event() and passed on to the appropriate widgets, so these
87  * functions are rarely needed. Though some of the fields in the
88  * Event Structures are useful.
89  */
90 public class Event
91 {
92 	
93 	/** the main Gtk struct */
94 	protected GdkEvent* gdkEvent;
95 	
96 	
97 	public GdkEvent* getEventStruct()
98 	{
99 		return gdkEvent;
100 	}
101 	
102 	
103 	/** the main Gtk struct as a void* */
104 	protected void* getStruct()
105 	{
106 		return cast(void*)gdkEvent;
107 	}
108 	
109 	/**
110 	 * Sets our main struct and passes it to the parent class
111 	 */
112 	public this (GdkEvent* gdkEvent)
113 	{
114 		this.gdkEvent = gdkEvent;
115 	}
116 	
117 	/**
118 	 * Specifies the type of the event.
119 	 */
120 	public EventType type()
121 	{
122 		return gdkEvent.type;
123 	}
124 	
125 	/** Get a specific event. */
126 	public GdkEventAny* any()
127 	{
128 		return cast(GdkEventAny*)gdkEvent;
129 	}
130 	
131 	/** ditto */
132 	public GdkEventExpose* expose()
133 	{
134 		return cast(GdkEventExpose*)gdkEvent;
135 	}
136 	
137 	/** ditto */
138 	public GdkEventVisibility* visibility()
139 	{
140 		return cast(GdkEventVisibility*)gdkEvent;
141 	}
142 	
143 	/** ditto */
144 	public GdkEventMotion* motion()
145 	{
146 		return cast(GdkEventMotion*)gdkEvent;
147 	}
148 	
149 	/** ditto */
150 	public GdkEventButton* button()
151 	{
152 		return cast(GdkEventButton*)gdkEvent;
153 	}
154 	
155 	/** ditto */
156 	public GdkEventScroll* scroll()
157 	{
158 		return cast(GdkEventScroll*)gdkEvent;
159 	}
160 	
161 	/** ditto */
162 	public GdkEventKey* key()
163 	{
164 		return cast(GdkEventKey*)gdkEvent;
165 	}
166 	
167 	/** ditto */
168 	public GdkEventCrossing* crossing()
169 	{
170 		return cast(GdkEventCrossing*)gdkEvent;
171 	}
172 	
173 	/** ditto */
174 	public GdkEventFocus* focus()
175 	{
176 		return cast(GdkEventFocus*)gdkEvent;
177 	}
178 	
179 	/** ditto */
180 	public GdkEventConfigure* configure()
181 	{
182 		return cast(GdkEventConfigure*)gdkEvent;
183 	}
184 	
185 	/** ditto */
186 	public GdkEventProperty* property()
187 	{
188 		return cast(GdkEventProperty*)gdkEvent;
189 	}
190 	
191 	/** ditto */
192 	public GdkEventSelection* selection()
193 	{
194 		return cast(GdkEventSelection*)gdkEvent;
195 	}
196 	
197 	/** ditto */
198 	public GdkEventOwnerChange* ownerChange()
199 	{
200 		return cast(GdkEventOwnerChange*)gdkEvent;
201 	}
202 	
203 	/** ditto */
204 	public GdkEventProximity* proximity()
205 	{
206 		return cast(GdkEventProximity*)gdkEvent;
207 	}
208 	
209 	/** ditto */
210 	public GdkEventDND* dnd()
211 	{
212 		return cast(GdkEventDND*)gdkEvent;
213 	}
214 	
215 	/** ditto */
216 	public GdkEventWindowState* windowState()
217 	{
218 		return cast(GdkEventWindowState*)gdkEvent;
219 	}
220 	
221 	/** ditto */
222 	public GdkEventSetting* setting()
223 	{
224 		return cast(GdkEventSetting*)gdkEvent;
225 	}
226 	
227 	/** ditto */
228 	public GdkEventGrabBroken* grabBroken()
229 	{
230 		return cast(GdkEventGrabBroken*)gdkEvent;
231 	}
232 	
233 	/** */
234 	public static bool isDoubleClick(GdkEventButton* eventButton, int buttonNumber=1)
235 	{
236 		return eventButton.button==buttonNumber
237 		&& eventButton.type == EventType.DOUBLE_BUTTON_PRESS;
238 	}
239 	
240 	/** */
241 	public static bool isTripleClick(GdkEventButton* eventButton, int buttonNumber=1)
242 	{
243 		return eventButton.button==buttonNumber
244 		&& eventButton.type == EventType.TRIPLE_BUTTON_PRESS;
245 	}
246 	
247 	/**
248 	 * The event structs contain data specific to each type of event in GDK.
249 	 *
250 	 * Note
251 	 *
252 	 * A common mistake is to forget to set the event mask of a widget so that
253 	 * the required events are received. See gtk_widget_set_events().
254 	 */
255 	
256 	/**
257 	 * Checks if any events are ready to be processed for any display.
258 	 * Returns: TRUE if any events are pending.
259 	 */
260 	public static int eventsPending()
261 	{
262 		// gboolean gdk_events_pending (void);
263 		return gdk_events_pending();
264 	}
265 	
266 	/**
267 	 * If there is an event waiting in the event queue of some open
268 	 * display, returns a copy of it. See gdk_display_peek_event().
269 	 * Returns: a copy of the first GdkEvent on some event queue, or NULL if no events are in any queues. The returned GdkEvent should be freed with gdk_event_free().
270 	 */
271 	public static Event peek()
272 	{
273 		// GdkEvent * gdk_event_peek (void);
274 		auto p = gdk_event_peek();
275 		
276 		if(p is null)
277 		{
278 			return null;
279 		}
280 		
281 		return ObjectG.getDObject!(Event)(cast(GdkEvent*) p);
282 	}
283 	
284 	/**
285 	 * Checks all open displays for a GdkEvent to process,to be processed
286 	 * on, fetching events from the windowing system if necessary.
287 	 * See gdk_display_get_event().
288 	 * Returns: the next GdkEvent to be processed, or NULL if no events are pending. The returned GdkEvent should be freed with gdk_event_free().
289 	 */
290 	public static Event get()
291 	{
292 		// GdkEvent * gdk_event_get (void);
293 		auto p = gdk_event_get();
294 		
295 		if(p is null)
296 		{
297 			return null;
298 		}
299 		
300 		return ObjectG.getDObject!(Event)(cast(GdkEvent*) p);
301 	}
302 	
303 	/**
304 	 * Appends a copy of the given event onto the front of the event
305 	 * queue for event->any.window's display, or the default event
306 	 * queue if event->any.window is NULL. See gdk_display_put_event().
307 	 */
308 	public void put()
309 	{
310 		// void gdk_event_put (const GdkEvent *event);
311 		gdk_event_put(gdkEvent);
312 	}
313 	
314 	/**
315 	 * Creates a new event of the given type. All fields are set to 0.
316 	 * Since 2.2
317 	 * Params:
318 	 * type = a GdkEventType
319 	 * Throws: ConstructionException GTK+ fails to create the object.
320 	 */
321 	public this (GdkEventType type)
322 	{
323 		// GdkEvent * gdk_event_new (GdkEventType type);
324 		auto p = gdk_event_new(type);
325 		if(p is null)
326 		{
327 			throw new ConstructionException("null returned by gdk_event_new(type)");
328 		}
329 		this(cast(GdkEvent*) p);
330 	}
331 	
332 	/**
333 	 * Copies a GdkEvent, copying or incrementing the reference count of the
334 	 * resources associated with it (e.g. GdkWindow's and strings).
335 	 * Returns: a copy of event. The returned GdkEvent should be freed with gdk_event_free().
336 	 */
337 	public Event copy()
338 	{
339 		// GdkEvent * gdk_event_copy (const GdkEvent *event);
340 		auto p = gdk_event_copy(gdkEvent);
341 		
342 		if(p is null)
343 		{
344 			return null;
345 		}
346 		
347 		return ObjectG.getDObject!(Event)(cast(GdkEvent*) p);
348 	}
349 	
350 	/**
351 	 * Frees a GdkEvent, freeing or decrementing any resources associated with it.
352 	 * Note that this function should only be called with events returned from
353 	 * functions such as gdk_event_peek(), gdk_event_get(), gdk_event_copy()
354 	 * and gdk_event_new().
355 	 */
356 	public void free()
357 	{
358 		// void gdk_event_free (GdkEvent *event);
359 		gdk_event_free(gdkEvent);
360 	}
361 	
362 	/**
363 	 * Extract the axis value for a particular axis use from
364 	 * an event structure.
365 	 * Params:
366 	 * axisUse = the axis use to look for
367 	 * value = location to store the value found. [out]
368 	 * Returns: TRUE if the specified axis was found, otherwise FALSE
369 	 */
370 	public int getAxis(GdkAxisUse axisUse, out double value)
371 	{
372 		// gboolean gdk_event_get_axis (const GdkEvent *event,  GdkAxisUse axis_use,  gdouble *value);
373 		return gdk_event_get_axis(gdkEvent, axisUse, &value);
374 	}
375 	
376 	/**
377 	 * Extract the button number from an event.
378 	 * Params:
379 	 * button = location to store mouse button number. [out]
380 	 * Returns: TRUE if the event delivered a button number Since 3.2
381 	 */
382 	public int getButton(out uint button)
383 	{
384 		// gboolean gdk_event_get_button (const GdkEvent *event,  guint *button);
385 		return gdk_event_get_button(gdkEvent, &button);
386 	}
387 	
388 	/**
389 	 * Extracts the click count from an event.
390 	 * Params:
391 	 * clickCount = location to store click count. [out]
392 	 * Returns: TRUE if the event delivered a click count Since 3.2
393 	 */
394 	public int getClickCount(out uint clickCount)
395 	{
396 		// gboolean gdk_event_get_click_count (const GdkEvent *event,  guint *click_count);
397 		return gdk_event_get_click_count(gdkEvent, &clickCount);
398 	}
399 	
400 	/**
401 	 * Extract the event window relative x/y coordinates from an event.
402 	 * Params:
403 	 * xWin = location to put event window x coordinate. [out]
404 	 * yWin = location to put event window y coordinate. [out]
405 	 * Returns: TRUE if the event delivered event window coordinates
406 	 */
407 	public int getCoords(out double xWin, out double yWin)
408 	{
409 		// gboolean gdk_event_get_coords (const GdkEvent *event,  gdouble *x_win,  gdouble *y_win);
410 		return gdk_event_get_coords(gdkEvent, &xWin, &yWin);
411 	}
412 	
413 	/**
414 	 * Extracts the hardware keycode from an event.
415 	 * Params:
416 	 * keycode = location to store the keycode. [out]
417 	 * Returns: TRUE if the event delivered a hardware keycode Since 3.2
418 	 */
419 	public int getKeycode(out ushort keycode)
420 	{
421 		// gboolean gdk_event_get_keycode (const GdkEvent *event,  guint16 *keycode);
422 		return gdk_event_get_keycode(gdkEvent, &keycode);
423 	}
424 	
425 	/**
426 	 * Extracts the keyval from an event.
427 	 * Params:
428 	 * keyval = location to store the keyval. [out]
429 	 * Returns: TRUE if the event delivered a key symbol Since 3.2
430 	 */
431 	public int getKeyval(out uint keyval)
432 	{
433 		// gboolean gdk_event_get_keyval (const GdkEvent *event,  guint *keyval);
434 		return gdk_event_get_keyval(gdkEvent, &keyval);
435 	}
436 	
437 	/**
438 	 * Extract the root window relative x/y coordinates from an event.
439 	 * Params:
440 	 * xRoot = location to put root window x coordinate. [out]
441 	 * yRoot = location to put root window y coordinate. [out]
442 	 * Returns: TRUE if the event delivered root window coordinates
443 	 */
444 	public int getRootCoords(out double xRoot, out double yRoot)
445 	{
446 		// gboolean gdk_event_get_root_coords (const GdkEvent *event,  gdouble *x_root,  gdouble *y_root);
447 		return gdk_event_get_root_coords(gdkEvent, &xRoot, &yRoot);
448 	}
449 	
450 	/**
451 	 * Extracts the scroll direction from an event.
452 	 * Params:
453 	 * direction = location to store the scroll direction. [out]
454 	 * Returns: TRUE if the event delivered a scroll direction Since 3.2
455 	 */
456 	public int getScrollDirection(out GdkScrollDirection direction)
457 	{
458 		// gboolean gdk_event_get_scroll_direction (const GdkEvent *event,  GdkScrollDirection *direction);
459 		return gdk_event_get_scroll_direction(gdkEvent, &direction);
460 	}
461 	
462 	/**
463 	 * Retrieves the scroll deltas from a GdkEvent
464 	 * Params:
465 	 * deltaX = return location for X delta. [out]
466 	 * deltaY = return location for Y delta. [out]
467 	 * Returns: TRUE if the event contains smooth scroll information Since 3.4
468 	 */
469 	public int getScrollDeltas(out double deltaX, out double deltaY)
470 	{
471 		// gboolean gdk_event_get_scroll_deltas (const GdkEvent *event,  gdouble *delta_x,  gdouble *delta_y);
472 		return gdk_event_get_scroll_deltas(gdkEvent, &deltaX, &deltaY);
473 	}
474 	
475 	/**
476 	 * If the event contains a "state" field, puts that field in state. Otherwise
477 	 * stores an empty state (0). Returns TRUE if there was a state field
478 	 * in the event. event may be NULL, in which case it's treated
479 	 * as if the event had no state field.
480 	 * Params:
481 	 * state = return location for state. [out]
482 	 * Returns: TRUE if there was a state field in the event
483 	 */
484 	public int getState(out GdkModifierType state)
485 	{
486 		// gboolean gdk_event_get_state (const GdkEvent *event,  GdkModifierType *state);
487 		return gdk_event_get_state(gdkEvent, &state);
488 	}
489 	
490 	/**
491 	 * returns GDK_CURRENT_TIME. If event is NULL, returns GDK_CURRENT_TIME.
492 	 * Returns: time stamp field from event
493 	 */
494 	public uint getTime()
495 	{
496 		// guint32 gdk_event_get_time (const GdkEvent *event);
497 		return gdk_event_get_time(gdkEvent);
498 	}
499 	
500 	/**
501 	 * Extracts the GdkWindow associated with an event.
502 	 * Returns: The GdkWindow associated with the event. [transfer none] Since 3.10
503 	 */
504 	public Window getWindow()
505 	{
506 		// GdkWindow * gdk_event_get_window (const GdkEvent *event);
507 		auto p = gdk_event_get_window(gdkEvent);
508 		
509 		if(p is null)
510 		{
511 			return null;
512 		}
513 		
514 		return ObjectG.getDObject!(Window)(cast(GdkWindow*) p);
515 	}
516 	
517 	/**
518 	 * Retrieves the type of the event.
519 	 * Returns: a GdkEventType Since 3.10
520 	 */
521 	public GdkEventType getEventType()
522 	{
523 		// GdkEventType gdk_event_get_event_type (const GdkEvent *event);
524 		return gdk_event_get_event_type(gdkEvent);
525 	}
526 	
527 	/**
528 	 * If event if of type GDK_TOUCH_BEGIN, GDK_TOUCH_UPDATE,
529 	 * GDK_TOUCH_END or GDK_TOUCH_CANCEL, returns the GdkEventSequence
530 	 * to which the event belongs. Otherwise, return NULL.
531 	 * Returns: the event sequence that the event belongs to Since 3.4
532 	 */
533 	public GdkEventSequence* getEventSequence()
534 	{
535 		// GdkEventSequence * gdk_event_get_event_sequence (const GdkEvent *event);
536 		return gdk_event_get_event_sequence(gdkEvent);
537 	}
538 	
539 	/**
540 	 * Request more motion notifies if event is a motion notify hint event.
541 	 * This function should be used instead of gdk_window_get_pointer() to
542 	 * request further motion notifies, because it also works for extension
543 	 * events where motion notifies are provided for devices other than the
544 	 * core pointer. Coordinate extraction, processing and requesting more
545 	 * Since 2.12
546 	 * Params:
547 	 * event = a valid GdkEvent
548 	 */
549 	public static void requestMotions(GdkEventMotion* event)
550 	{
551 		// void gdk_event_request_motions (const GdkEventMotion *event);
552 		gdk_event_request_motions(event);
553 	}
554 	
555 	/**
556 	 * If both events contain X/Y information, this function will return TRUE
557 	 * and return in angle the relative angle from event1 to event2. The rotation
558 	 * direction for positive angles is from the positive X axis towards the positive
559 	 * Y axis.
560 	 * Params:
561 	 * event2 = second GdkEvent
562 	 * angle = return location for the relative angle between both events. [out]
563 	 * Returns: TRUE if the angle could be calculated. Since 3.0
564 	 */
565 	public int eventsGetAngle(Event event2, out double angle)
566 	{
567 		// gboolean gdk_events_get_angle (GdkEvent *event1,  GdkEvent *event2,  gdouble *angle);
568 		return gdk_events_get_angle(gdkEvent, (event2 is null) ? null : event2.getEventStruct(), &angle);
569 	}
570 	
571 	/**
572 	 * If both events contain X/Y information, the center of both coordinates
573 	 * will be returned in x and y.
574 	 * Params:
575 	 * event2 = second GdkEvent
576 	 * x = return location for the X coordinate of the center. [out]
577 	 * y = return location for the Y coordinate of the center. [out]
578 	 * Returns: TRUE if the center could be calculated. Since 3.0
579 	 */
580 	public int eventsGetCenter(Event event2, out double x, out double y)
581 	{
582 		// gboolean gdk_events_get_center (GdkEvent *event1,  GdkEvent *event2,  gdouble *x,  gdouble *y);
583 		return gdk_events_get_center(gdkEvent, (event2 is null) ? null : event2.getEventStruct(), &x, &y);
584 	}
585 	
586 	/**
587 	 * If both events have X/Y information, the distance between both coordinates
588 	 * (as in a straight line going from event1 to event2) will be returned.
589 	 * Params:
590 	 * event2 = second GdkEvent
591 	 * distance = return location for the distance. [out]
592 	 * Returns: TRUE if the distance could be calculated. Since 3.0
593 	 */
594 	public int eventsGetDistance(Event event2, out double distance)
595 	{
596 		// gboolean gdk_events_get_distance (GdkEvent *event1,  GdkEvent *event2,  gdouble *distance);
597 		return gdk_events_get_distance(gdkEvent, (event2 is null) ? null : event2.getEventStruct(), &distance);
598 	}
599 	
600 	/**
601 	 * This function returns whether a GdkEventButton should trigger a
602 	 * context menu, according to platform conventions. The right mouse
603 	 * button always triggers context menus. Additionally, if
604 	 * gdk_keymap_get_modifier_mask() returns a non-0 mask for
605 	 * GDK_MODIFIER_INTENT_CONTEXT_MENU, then the left mouse button will
606 	 * also trigger a context menu if this modifier is pressed.
607 	 * This function should always be used instead of simply checking for
608 	 * event->button == GDK_BUTTON_SECONDARY.
609 	 * Returns: TRUE if the event should trigger a context menu. Since 3.4
610 	 */
611 	public int triggersContextMenu()
612 	{
613 		// gboolean gdk_event_triggers_context_menu (const GdkEvent *event);
614 		return gdk_event_triggers_context_menu(gdkEvent);
615 	}
616 	
617 	/**
618 	 * Sets the function to call to handle all events from GDK.
619 	 * Note that GTK+ uses this to install its own event handler, so it is
620 	 * usually not useful for GTK+ applications. (Although an application
621 	 * can call this function then call gtk_main_do_event() to pass
622 	 * events to GTK+.)
623 	 * Params:
624 	 * func = the function to call to handle events from GDK.
625 	 * data = user data to pass to the function.
626 	 * notify = the function to call when the handler function is removed, i.e. when
627 	 * gdk_event_handler_set() is called with another event handler.
628 	 */
629 	public static void handlerSet(GdkEventFunc func, void* data, GDestroyNotify notify)
630 	{
631 		// void gdk_event_handler_set (GdkEventFunc func,  gpointer data,  GDestroyNotify notify);
632 		gdk_event_handler_set(func, data, notify);
633 	}
634 	
635 	/**
636 	 * Gets whether event debugging output is enabled.
637 	 * Returns: TRUE if event debugging output is enabled.
638 	 */
639 	public static int getShowEvents()
640 	{
641 		// gboolean gdk_get_show_events (void);
642 		return gdk_get_show_events();
643 	}
644 	
645 	/**
646 	 * Sets whether a trace of received events is output.
647 	 * Note that GTK+ must be compiled with debugging (that is,
648 	 * configured using the --enable-debug option)
649 	 * to use this option.
650 	 * Params:
651 	 * showEvents = TRUE to output event debugging information.
652 	 */
653 	public static void setShowEvents(int showEvents)
654 	{
655 		// void gdk_set_show_events (gboolean show_events);
656 		gdk_set_show_events(showEvents);
657 	}
658 	
659 	/**
660 	 * Sets the screen for event to screen. The event must
661 	 * have been allocated by GTK+, for instance, by
662 	 * gdk_event_copy().
663 	 * Since 2.2
664 	 * Params:
665 	 * screen = a GdkScreen
666 	 */
667 	public void setScreen(Screen screen)
668 	{
669 		// void gdk_event_set_screen (GdkEvent *event,  GdkScreen *screen);
670 		gdk_event_set_screen(gdkEvent, (screen is null) ? null : screen.getScreenStruct());
671 	}
672 	
673 	/**
674 	 * Returns the screen for the event. The screen is
675 	 * typically the screen for event->any.window, but
676 	 * for events such as mouse events, it is the screen
677 	 * where the pointer was when the event occurs -
678 	 * that is, the screen which has the root window
679 	 * to which event->motion.x_root and
680 	 * event->motion.y_root are relative.
681 	 * Since 2.2
682 	 * Returns: the screen for the event. [transfer none]
683 	 */
684 	public Screen getScreen()
685 	{
686 		// GdkScreen * gdk_event_get_screen (const GdkEvent *event);
687 		auto p = gdk_event_get_screen(gdkEvent);
688 		
689 		if(p is null)
690 		{
691 			return null;
692 		}
693 		
694 		return ObjectG.getDObject!(Screen)(cast(GdkScreen*) p);
695 	}
696 	
697 	/**
698 	 * If the event contains a "device" field, this function will return
699 	 * it, else it will return NULL.
700 	 * Returns: a GdkDevice, or NULL. [transfer none] Since 3.0
701 	 */
702 	public Device getDevice()
703 	{
704 		// GdkDevice * gdk_event_get_device (const GdkEvent *event);
705 		auto p = gdk_event_get_device(gdkEvent);
706 		
707 		if(p is null)
708 		{
709 			return null;
710 		}
711 		
712 		return ObjectG.getDObject!(Device)(cast(GdkDevice*) p);
713 	}
714 	
715 	/**
716 	 * Sets the device for event to device. The event must
717 	 * have been allocated by GTK+, for instance, by
718 	 * gdk_event_copy().
719 	 * Params:
720 	 * device = a GdkDevice
721 	 * Since 3.0
722 	 */
723 	public void setDevice(Device device)
724 	{
725 		// void gdk_event_set_device (GdkEvent *event,  GdkDevice *device);
726 		gdk_event_set_device(gdkEvent, (device is null) ? null : device.getDeviceStruct());
727 	}
728 	
729 	/**
730 	 * This function returns the hardware (slave) GdkDevice that has
731 	 * triggered the event, falling back to the virtual (master) device
732 	 * (as in gdk_event_get_device()) if the event wasn't caused by
733 	 * interaction with a hardware device. This may happen for example
734 	 * in synthesized crossing events after a GdkWindow updates its
735 	 * geometry or a grab is acquired/released.
736 	 * If the event does not contain a device field, this function will
737 	 * return NULL.
738 	 * Returns: a GdkDevice, or NULL. [transfer none] Since 3.0
739 	 */
740 	public Device getSourceDevice()
741 	{
742 		// GdkDevice * gdk_event_get_source_device (const GdkEvent *event);
743 		auto p = gdk_event_get_source_device(gdkEvent);
744 		
745 		if(p is null)
746 		{
747 			return null;
748 		}
749 		
750 		return ObjectG.getDObject!(Device)(cast(GdkDevice*) p);
751 	}
752 	
753 	/**
754 	 * Sets the slave device for event to device.
755 	 * The event must have been allocated by GTK+,
756 	 * for instance by gdk_event_copy().
757 	 * Params:
758 	 * device = a GdkDevice
759 	 * Since 3.0
760 	 */
761 	public void setSourceDevice(Device device)
762 	{
763 		// void gdk_event_set_source_device (GdkEvent *event,  GdkDevice *device);
764 		gdk_event_set_source_device(gdkEvent, (device is null) ? null : device.getDeviceStruct());
765 	}
766 	
767 	/**
768 	 * Obtains a desktop-wide setting, such as the double-click time,
769 	 * for the default screen. See gdk_screen_get_setting().
770 	 * Params:
771 	 * name = the name of the setting.
772 	 * value = location to store the value of the setting.
773 	 * Returns: TRUE if the setting existed and a value was stored in value, FALSE otherwise.
774 	 */
775 	public static int settingGet(string name, Value value)
776 	{
777 		// gboolean gdk_setting_get (const gchar *name,  GValue *value);
778 		return gdk_setting_get(Str.toStringz(name), (value is null) ? null : value.getValueStruct());
779 	}
780 }