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