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 module gdk.Device;
26 
27 private import gdk.Cursor;
28 private import gdk.DeviceTool;
29 private import gdk.Display;
30 private import gdk.Screen;
31 private import gdk.Seat;
32 private import gdk.Window;
33 private import gdk.c.functions;
34 public  import gdk.c.types;
35 private import glib.ListG;
36 private import glib.Str;
37 private import gobject.ObjectG;
38 private import gobject.Signals;
39 public  import gtkc.gdktypes;
40 private import std.algorithm;
41 
42 
43 /**
44  * The #GdkDevice object represents a single input device, such
45  * as a keyboard, a mouse, a touchpad, etc.
46  * 
47  * See the #GdkDeviceManager documentation for more information
48  * about the various kinds of master and slave devices, and their
49  * relationships.
50  */
51 public class Device : ObjectG
52 {
53 	/** the main Gtk struct */
54 	protected GdkDevice* gdkDevice;
55 
56 	/** Get the main Gtk struct */
57 	public GdkDevice* getDeviceStruct(bool transferOwnership = false)
58 	{
59 		if (transferOwnership)
60 			ownedRef = false;
61 		return gdkDevice;
62 	}
63 
64 	/** the main Gtk struct as a void* */
65 	protected override void* getStruct()
66 	{
67 		return cast(void*)gdkDevice;
68 	}
69 
70 	/**
71 	 * Sets our main struct and passes it to the parent class.
72 	 */
73 	public this (GdkDevice* gdkDevice, bool ownedRef = false)
74 	{
75 		this.gdkDevice = gdkDevice;
76 		super(cast(GObject*)gdkDevice, ownedRef);
77 	}
78 
79 
80 	/** */
81 	public static GType getType()
82 	{
83 		return gdk_device_get_type();
84 	}
85 
86 	/**
87 	 * Frees an array of #GdkTimeCoord that was returned by gdk_device_get_history().
88 	 *
89 	 * Params:
90 	 *     events = an array of #GdkTimeCoord.
91 	 */
92 	public static void freeHistory(GdkTimeCoord*[] events)
93 	{
94 		gdk_device_free_history(events.ptr, cast(int)events.length);
95 	}
96 
97 	/**
98 	 * Determines information about the current keyboard grab.
99 	 * This is not public API and must not be used by applications.
100 	 *
101 	 * Deprecated: The symbol was never meant to be used outside
102 	 * of GTK+
103 	 *
104 	 * Params:
105 	 *     display = the display for which to get the grab information
106 	 *     device = device to get the grab information from
107 	 *     grabWindow = location to store current grab window
108 	 *     ownerEvents = location to store boolean indicating whether
109 	 *         the @owner_events flag to gdk_keyboard_grab() or
110 	 *         gdk_pointer_grab() was %TRUE.
111 	 *
112 	 * Returns: %TRUE if this application currently has the
113 	 *     keyboard grabbed.
114 	 */
115 	public static bool grabInfoLibgtkOnly(Display display, Device device, out Window grabWindow, out bool ownerEvents)
116 	{
117 		GdkWindow* outgrabWindow = null;
118 		int outownerEvents;
119 
120 		auto p = gdk_device_grab_info_libgtk_only((display is null) ? null : display.getDisplayStruct(), (device is null) ? null : device.getDeviceStruct(), &outgrabWindow, &outownerEvents) != 0;
121 
122 		grabWindow = ObjectG.getDObject!(Window)(outgrabWindow);
123 		ownerEvents = (outownerEvents == 1);
124 
125 		return p;
126 	}
127 
128 	/**
129 	 * Returns the associated device to @device, if @device is of type
130 	 * %GDK_DEVICE_TYPE_MASTER, it will return the paired pointer or
131 	 * keyboard.
132 	 *
133 	 * If @device is of type %GDK_DEVICE_TYPE_SLAVE, it will return
134 	 * the master device to which @device is attached to.
135 	 *
136 	 * If @device is of type %GDK_DEVICE_TYPE_FLOATING, %NULL will be
137 	 * returned, as there is no associated device.
138 	 *
139 	 * Returns: The associated device, or
140 	 *     %NULL
141 	 *
142 	 * Since: 3.0
143 	 */
144 	public Device getAssociatedDevice()
145 	{
146 		auto p = gdk_device_get_associated_device(gdkDevice);
147 
148 		if(p is null)
149 		{
150 			return null;
151 		}
152 
153 		return ObjectG.getDObject!(Device)(cast(GdkDevice*) p);
154 	}
155 
156 	/**
157 	 * Returns the axes currently available on the device.
158 	 *
159 	 * Since: 3.22
160 	 */
161 	public GdkAxisFlags getAxes()
162 	{
163 		return gdk_device_get_axes(gdkDevice);
164 	}
165 
166 	/**
167 	 * Interprets an array of double as axis values for a given device,
168 	 * and locates the value in the array for a given axis use.
169 	 *
170 	 * Params:
171 	 *     axes = pointer to an array of axes
172 	 *     use = the use to look for
173 	 *     value = location to store the found value.
174 	 *
175 	 * Returns: %TRUE if the given axis use was found, otherwise %FALSE
176 	 */
177 	public bool getAxis(double[] axes, GdkAxisUse use, out double value)
178 	{
179 		return gdk_device_get_axis(gdkDevice, axes.ptr, use, &value) != 0;
180 	}
181 
182 	/**
183 	 * Returns the axis use for @index_.
184 	 *
185 	 * Params:
186 	 *     index = the index of the axis.
187 	 *
188 	 * Returns: a #GdkAxisUse specifying how the axis is used.
189 	 *
190 	 * Since: 2.20
191 	 */
192 	public GdkAxisUse getAxisUse(uint index)
193 	{
194 		return gdk_device_get_axis_use(gdkDevice, index);
195 	}
196 
197 	/**
198 	 * Interprets an array of double as axis values for a given device,
199 	 * and locates the value in the array for a given axis label, as returned
200 	 * by gdk_device_list_axes()
201 	 *
202 	 * Params:
203 	 *     axes = pointer to an array of axes
204 	 *     axisLabel = #GdkAtom with the axis label.
205 	 *     value = location to store the found value.
206 	 *
207 	 * Returns: %TRUE if the given axis use was found, otherwise %FALSE.
208 	 *
209 	 * Since: 3.0
210 	 */
211 	public bool getAxisValue(double[] axes, GdkAtom axisLabel, out double value)
212 	{
213 		return gdk_device_get_axis_value(gdkDevice, axes.ptr, axisLabel, &value) != 0;
214 	}
215 
216 	/**
217 	 * Returns the device type for @device.
218 	 *
219 	 * Returns: the #GdkDeviceType for @device.
220 	 *
221 	 * Since: 3.0
222 	 */
223 	public GdkDeviceType getDeviceType()
224 	{
225 		return gdk_device_get_device_type(gdkDevice);
226 	}
227 
228 	/**
229 	 * Returns the #GdkDisplay to which @device pertains.
230 	 *
231 	 * Returns: a #GdkDisplay. This memory is owned
232 	 *     by GTK+, and must not be freed or unreffed.
233 	 *
234 	 * Since: 3.0
235 	 */
236 	public Display getDisplay()
237 	{
238 		auto p = gdk_device_get_display(gdkDevice);
239 
240 		if(p is null)
241 		{
242 			return null;
243 		}
244 
245 		return ObjectG.getDObject!(Display)(cast(GdkDisplay*) p);
246 	}
247 
248 	/**
249 	 * Determines whether the pointer follows device motion.
250 	 * This is not meaningful for keyboard devices, which don't have a pointer.
251 	 *
252 	 * Returns: %TRUE if the pointer follows device motion
253 	 *
254 	 * Since: 2.20
255 	 */
256 	public bool getHasCursor()
257 	{
258 		return gdk_device_get_has_cursor(gdkDevice) != 0;
259 	}
260 
261 	/**
262 	 * Obtains the motion history for a pointer device; given a starting and
263 	 * ending timestamp, return all events in the motion history for
264 	 * the device in the given range of time. Some windowing systems
265 	 * do not support motion history, in which case, %FALSE will
266 	 * be returned. (This is not distinguishable from the case where
267 	 * motion history is supported and no events were found.)
268 	 *
269 	 * Note that there is also gdk_window_set_event_compression() to get
270 	 * more motion events delivered directly, independent of the windowing
271 	 * system.
272 	 *
273 	 * Params:
274 	 *     window = the window with respect to which which the event coordinates will be reported
275 	 *     start = starting timestamp for range of events to return
276 	 *     stop = ending timestamp for the range of events to return
277 	 *     events = location to store a newly-allocated array of #GdkTimeCoord, or
278 	 *         %NULL
279 	 *
280 	 * Returns: %TRUE if the windowing system supports motion history and
281 	 *     at least one event was found.
282 	 */
283 	public bool getHistory(Window window, uint start, uint stop, out GdkTimeCoord*[] events)
284 	{
285 		GdkTimeCoord** outevents = null;
286 		int nEvents;
287 
288 		auto p = gdk_device_get_history(gdkDevice, (window is null) ? null : window.getWindowStruct(), start, stop, &outevents, &nEvents) != 0;
289 
290 		events = outevents[0 .. nEvents];
291 
292 		return p;
293 	}
294 
295 	/**
296 	 * If @index_ has a valid keyval, this function will return %TRUE
297 	 * and fill in @keyval and @modifiers with the keyval settings.
298 	 *
299 	 * Params:
300 	 *     index = the index of the macro button to get.
301 	 *     keyval = return value for the keyval.
302 	 *     modifiers = return value for modifiers.
303 	 *
304 	 * Returns: %TRUE if keyval is set for @index.
305 	 *
306 	 * Since: 2.20
307 	 */
308 	public bool getKey(uint index, out uint keyval, out GdkModifierType modifiers)
309 	{
310 		return gdk_device_get_key(gdkDevice, index, &keyval, &modifiers) != 0;
311 	}
312 
313 	/**
314 	 * Gets information about which window the given pointer device is in, based on events
315 	 * that have been received so far from the display server. If another application
316 	 * has a pointer grab, or this application has a grab with owner_events = %FALSE,
317 	 * %NULL may be returned even if the pointer is physically over one of this
318 	 * application's windows.
319 	 *
320 	 * Returns: the last window the device
321 	 *
322 	 * Since: 3.12
323 	 */
324 	public Window getLastEventWindow()
325 	{
326 		auto p = gdk_device_get_last_event_window(gdkDevice);
327 
328 		if(p is null)
329 		{
330 			return null;
331 		}
332 
333 		return ObjectG.getDObject!(Window)(cast(GdkWindow*) p);
334 	}
335 
336 	/**
337 	 * Determines the mode of the device.
338 	 *
339 	 * Returns: a #GdkInputSource
340 	 *
341 	 * Since: 2.20
342 	 */
343 	public GdkInputMode getMode()
344 	{
345 		return gdk_device_get_mode(gdkDevice);
346 	}
347 
348 	/**
349 	 * Returns the number of axes the device currently has.
350 	 *
351 	 * Returns: the number of axes.
352 	 *
353 	 * Since: 3.0
354 	 */
355 	public int getNAxes()
356 	{
357 		return gdk_device_get_n_axes(gdkDevice);
358 	}
359 
360 	/**
361 	 * Returns the number of keys the device currently has.
362 	 *
363 	 * Returns: the number of keys.
364 	 *
365 	 * Since: 2.24
366 	 */
367 	public int getNKeys()
368 	{
369 		return gdk_device_get_n_keys(gdkDevice);
370 	}
371 
372 	/**
373 	 * Determines the name of the device.
374 	 *
375 	 * Returns: a name
376 	 *
377 	 * Since: 2.20
378 	 */
379 	public string getName()
380 	{
381 		return Str.toString(gdk_device_get_name(gdkDevice));
382 	}
383 
384 	/**
385 	 * Gets the current location of @device. As a slave device
386 	 * coordinates are those of its master pointer, This function
387 	 * may not be called on devices of type %GDK_DEVICE_TYPE_SLAVE,
388 	 * unless there is an ongoing grab on them, see gdk_device_grab().
389 	 *
390 	 * Params:
391 	 *     screen = location to store the #GdkScreen
392 	 *         the @device is on, or %NULL.
393 	 *     x = location to store root window X coordinate of @device, or %NULL.
394 	 *     y = location to store root window Y coordinate of @device, or %NULL.
395 	 *
396 	 * Since: 3.0
397 	 */
398 	public void getPosition(out Screen screen, out int x, out int y)
399 	{
400 		GdkScreen* outscreen = null;
401 
402 		gdk_device_get_position(gdkDevice, &outscreen, &x, &y);
403 
404 		screen = ObjectG.getDObject!(Screen)(outscreen);
405 	}
406 
407 	/**
408 	 * Gets the current location of @device in double precision. As a slave device's
409 	 * coordinates are those of its master pointer, this function
410 	 * may not be called on devices of type %GDK_DEVICE_TYPE_SLAVE,
411 	 * unless there is an ongoing grab on them. See gdk_device_grab().
412 	 *
413 	 * Params:
414 	 *     screen = location to store the #GdkScreen
415 	 *         the @device is on, or %NULL.
416 	 *     x = location to store root window X coordinate of @device, or %NULL.
417 	 *     y = location to store root window Y coordinate of @device, or %NULL.
418 	 *
419 	 * Since: 3.10
420 	 */
421 	public void getPositionDouble(out Screen screen, out double x, out double y)
422 	{
423 		GdkScreen* outscreen = null;
424 
425 		gdk_device_get_position_double(gdkDevice, &outscreen, &x, &y);
426 
427 		screen = ObjectG.getDObject!(Screen)(outscreen);
428 	}
429 
430 	/**
431 	 * Returns the product ID of this device, or %NULL if this information couldn't
432 	 * be obtained. This ID is retrieved from the device, and is thus constant for
433 	 * it. See gdk_device_get_vendor_id() for more information.
434 	 *
435 	 * Returns: the product ID, or %NULL
436 	 *
437 	 * Since: 3.16
438 	 */
439 	public string getProductId()
440 	{
441 		return Str.toString(gdk_device_get_product_id(gdkDevice));
442 	}
443 
444 	/**
445 	 * Returns the #GdkSeat the device belongs to.
446 	 *
447 	 * Returns: A #GdkSeat. This memory is owned by GTK+ and
448 	 *     must not be freed.
449 	 *
450 	 * Since: 3.20
451 	 */
452 	public Seat getSeat()
453 	{
454 		auto p = gdk_device_get_seat(gdkDevice);
455 
456 		if(p is null)
457 		{
458 			return null;
459 		}
460 
461 		return ObjectG.getDObject!(Seat)(cast(GdkSeat*) p);
462 	}
463 
464 	/**
465 	 * Determines the type of the device.
466 	 *
467 	 * Returns: a #GdkInputSource
468 	 *
469 	 * Since: 2.20
470 	 */
471 	public GdkInputSource getSource()
472 	{
473 		return gdk_device_get_source(gdkDevice);
474 	}
475 
476 	/**
477 	 * Gets the current state of a pointer device relative to @window. As a slave
478 	 * device’s coordinates are those of its master pointer, this
479 	 * function may not be called on devices of type %GDK_DEVICE_TYPE_SLAVE,
480 	 * unless there is an ongoing grab on them. See gdk_device_grab().
481 	 *
482 	 * Params:
483 	 *     window = a #GdkWindow.
484 	 *     axes = an array of doubles to store the values of
485 	 *         the axes of @device in, or %NULL.
486 	 *     mask = location to store the modifiers, or %NULL.
487 	 */
488 	public void getState(Window window, double[] axes, out GdkModifierType mask)
489 	{
490 		gdk_device_get_state(gdkDevice, (window is null) ? null : window.getWindowStruct(), axes.ptr, &mask);
491 	}
492 
493 	/**
494 	 * Returns the vendor ID of this device, or %NULL if this information couldn't
495 	 * be obtained. This ID is retrieved from the device, and is thus constant for
496 	 * it.
497 	 *
498 	 * This function, together with gdk_device_get_product_id(), can be used to eg.
499 	 * compose #GSettings paths to store settings for this device.
500 	 *
501 	 * |[<!-- language="C" -->
502 	 * static GSettings *
503 	 * get_device_settings (GdkDevice *device)
504 	 * {
505 	 * const gchar *vendor, *product;
506 	 * GSettings *settings;
507 	 * GdkDevice *device;
508 	 * gchar *path;
509 	 *
510 	 * vendor = gdk_device_get_vendor_id (device);
511 	 * product = gdk_device_get_product_id (device);
512 	 *
513 	 * path = g_strdup_printf ("/org/example/app/devices/%s:%s/", vendor, product);
514 	 * settings = g_settings_new_with_path (DEVICE_SCHEMA, path);
515 	 * g_free (path);
516 	 *
517 	 * return settings;
518 	 * }
519 	 * ]|
520 	 *
521 	 * Returns: the vendor ID, or %NULL
522 	 *
523 	 * Since: 3.16
524 	 */
525 	public string getVendorId()
526 	{
527 		return Str.toString(gdk_device_get_vendor_id(gdkDevice));
528 	}
529 
530 	/**
531 	 * Obtains the window underneath @device, returning the location of the device in @win_x and @win_y. Returns
532 	 * %NULL if the window tree under @device is not known to GDK (for example, belongs to another application).
533 	 *
534 	 * As a slave device coordinates are those of its master pointer, This
535 	 * function may not be called on devices of type %GDK_DEVICE_TYPE_SLAVE,
536 	 * unless there is an ongoing grab on them, see gdk_device_grab().
537 	 *
538 	 * Params:
539 	 *     winX = return location for the X coordinate of the device location,
540 	 *         relative to the window origin, or %NULL.
541 	 *     winY = return location for the Y coordinate of the device location,
542 	 *         relative to the window origin, or %NULL.
543 	 *
544 	 * Returns: the #GdkWindow under the
545 	 *     device position, or %NULL.
546 	 *
547 	 * Since: 3.0
548 	 */
549 	public Window getWindowAtPosition(out int winX, out int winY)
550 	{
551 		auto p = gdk_device_get_window_at_position(gdkDevice, &winX, &winY);
552 
553 		if(p is null)
554 		{
555 			return null;
556 		}
557 
558 		return ObjectG.getDObject!(Window)(cast(GdkWindow*) p);
559 	}
560 
561 	/**
562 	 * Obtains the window underneath @device, returning the location of the device in @win_x and @win_y in
563 	 * double precision. Returns %NULL if the window tree under @device is not known to GDK (for example,
564 	 * belongs to another application).
565 	 *
566 	 * As a slave device coordinates are those of its master pointer, This
567 	 * function may not be called on devices of type %GDK_DEVICE_TYPE_SLAVE,
568 	 * unless there is an ongoing grab on them, see gdk_device_grab().
569 	 *
570 	 * Params:
571 	 *     winX = return location for the X coordinate of the device location,
572 	 *         relative to the window origin, or %NULL.
573 	 *     winY = return location for the Y coordinate of the device location,
574 	 *         relative to the window origin, or %NULL.
575 	 *
576 	 * Returns: the #GdkWindow under the
577 	 *     device position, or %NULL.
578 	 *
579 	 * Since: 3.0
580 	 */
581 	public Window getWindowAtPositionDouble(out double winX, out double winY)
582 	{
583 		auto p = gdk_device_get_window_at_position_double(gdkDevice, &winX, &winY);
584 
585 		if(p is null)
586 		{
587 			return null;
588 		}
589 
590 		return ObjectG.getDObject!(Window)(cast(GdkWindow*) p);
591 	}
592 
593 	/**
594 	 * Grabs the device so that all events coming from this device are passed to
595 	 * this application until the device is ungrabbed with gdk_device_ungrab(),
596 	 * or the window becomes unviewable. This overrides any previous grab on the device
597 	 * by this client.
598 	 *
599 	 * Note that @device and @window need to be on the same display.
600 	 *
601 	 * Device grabs are used for operations which need complete control over the
602 	 * given device events (either pointer or keyboard). For example in GTK+ this
603 	 * is used for Drag and Drop operations, popup menus and such.
604 	 *
605 	 * Note that if the event mask of an X window has selected both button press
606 	 * and button release events, then a button press event will cause an automatic
607 	 * pointer grab until the button is released. X does this automatically since
608 	 * most applications expect to receive button press and release events in pairs.
609 	 * It is equivalent to a pointer grab on the window with @owner_events set to
610 	 * %TRUE.
611 	 *
612 	 * If you set up anything at the time you take the grab that needs to be
613 	 * cleaned up when the grab ends, you should handle the #GdkEventGrabBroken
614 	 * events that are emitted when the grab ends unvoluntarily.
615 	 *
616 	 * Deprecated: Use gdk_seat_grab() instead.
617 	 *
618 	 * Params:
619 	 *     window = the #GdkWindow which will own the grab (the grab window)
620 	 *     grabOwnership = specifies the grab ownership.
621 	 *     ownerEvents = if %FALSE then all device events are reported with respect to
622 	 *         @window and are only reported if selected by @event_mask. If
623 	 *         %TRUE then pointer events for this application are reported
624 	 *         as normal, but pointer events outside this application are
625 	 *         reported with respect to @window and only if selected by
626 	 *         @event_mask. In either mode, unreported events are discarded.
627 	 *     eventMask = specifies the event mask, which is used in accordance with
628 	 *         @owner_events.
629 	 *     cursor = the cursor to display while the grab is active if the device is
630 	 *         a pointer. If this is %NULL then the normal cursors are used for
631 	 *         @window and its descendants, and the cursor for @window is used
632 	 *         elsewhere.
633 	 *     time = the timestamp of the event which led to this pointer grab. This
634 	 *         usually comes from the #GdkEvent struct, though %GDK_CURRENT_TIME
635 	 *         can be used if the time isn’t known.
636 	 *
637 	 * Returns: %GDK_GRAB_SUCCESS if the grab was successful.
638 	 *
639 	 * Since: 3.0
640 	 */
641 	public GdkGrabStatus grab(Window window, GdkGrabOwnership grabOwnership, bool ownerEvents, GdkEventMask eventMask, Cursor cursor, uint time)
642 	{
643 		return gdk_device_grab(gdkDevice, (window is null) ? null : window.getWindowStruct(), grabOwnership, ownerEvents, eventMask, (cursor is null) ? null : cursor.getCursorStruct(), time);
644 	}
645 
646 	/**
647 	 * Returns a #GList of #GdkAtoms, containing the labels for
648 	 * the axes that @device currently has.
649 	 *
650 	 * Returns: A #GList of #GdkAtoms, free with g_list_free().
651 	 *
652 	 * Since: 3.0
653 	 */
654 	public ListG listAxes()
655 	{
656 		auto p = gdk_device_list_axes(gdkDevice);
657 
658 		if(p is null)
659 		{
660 			return null;
661 		}
662 
663 		return new ListG(cast(GList*) p);
664 	}
665 
666 	/**
667 	 * If the device if of type %GDK_DEVICE_TYPE_MASTER, it will return
668 	 * the list of slave devices attached to it, otherwise it will return
669 	 * %NULL
670 	 *
671 	 * Returns: the list of slave devices, or %NULL. The list must be
672 	 *     freed with g_list_free(), the contents of the list are
673 	 *     owned by GTK+ and should not be freed.
674 	 */
675 	public ListG listSlaveDevices()
676 	{
677 		auto p = gdk_device_list_slave_devices(gdkDevice);
678 
679 		if(p is null)
680 		{
681 			return null;
682 		}
683 
684 		return new ListG(cast(GList*) p);
685 	}
686 
687 	/**
688 	 * Specifies how an axis of a device is used.
689 	 *
690 	 * Params:
691 	 *     index = the index of the axis
692 	 *     use = specifies how the axis is used
693 	 */
694 	public void setAxisUse(uint index, GdkAxisUse use)
695 	{
696 		gdk_device_set_axis_use(gdkDevice, index, use);
697 	}
698 
699 	/**
700 	 * Specifies the X key event to generate when a macro button of a device
701 	 * is pressed.
702 	 *
703 	 * Params:
704 	 *     index = the index of the macro button to set
705 	 *     keyval = the keyval to generate
706 	 *     modifiers = the modifiers to set
707 	 */
708 	public void setKey(uint index, uint keyval, GdkModifierType modifiers)
709 	{
710 		gdk_device_set_key(gdkDevice, index, keyval, modifiers);
711 	}
712 
713 	/**
714 	 * Sets a the mode of an input device. The mode controls if the
715 	 * device is active and whether the device’s range is mapped to the
716 	 * entire screen or to a single window.
717 	 *
718 	 * Note: This is only meaningful for floating devices, master devices (and
719 	 * slaves connected to these) drive the pointer cursor, which is not limited
720 	 * by the input mode.
721 	 *
722 	 * Params:
723 	 *     mode = the input mode.
724 	 *
725 	 * Returns: %TRUE if the mode was successfully changed.
726 	 */
727 	public bool setMode(GdkInputMode mode)
728 	{
729 		return gdk_device_set_mode(gdkDevice, mode) != 0;
730 	}
731 
732 	/**
733 	 * Release any grab on @device.
734 	 *
735 	 * Deprecated: Use gdk_seat_ungrab() instead.
736 	 *
737 	 * Params:
738 	 *     time = a timestap (e.g. %GDK_CURRENT_TIME).
739 	 *
740 	 * Since: 3.0
741 	 */
742 	public void ungrab(uint time)
743 	{
744 		gdk_device_ungrab(gdkDevice, time);
745 	}
746 
747 	/**
748 	 * Warps @device in @display to the point @x,@y on
749 	 * the screen @screen, unless the device is confined
750 	 * to a window by a grab, in which case it will be moved
751 	 * as far as allowed by the grab. Warping the pointer
752 	 * creates events as if the user had moved the mouse
753 	 * instantaneously to the destination.
754 	 *
755 	 * Note that the pointer should normally be under the
756 	 * control of the user. This function was added to cover
757 	 * some rare use cases like keyboard navigation support
758 	 * for the color picker in the #GtkColorSelectionDialog.
759 	 *
760 	 * Params:
761 	 *     screen = the screen to warp @device to.
762 	 *     x = the X coordinate of the destination.
763 	 *     y = the Y coordinate of the destination.
764 	 *
765 	 * Since: 3.0
766 	 */
767 	public void warp(Screen screen, int x, int y)
768 	{
769 		gdk_device_warp(gdkDevice, (screen is null) ? null : screen.getScreenStruct(), x, y);
770 	}
771 
772 	/**
773 	 * The ::changed signal is emitted either when the #GdkDevice
774 	 * has changed the number of either axes or keys. For example
775 	 * In X this will normally happen when the slave device routing
776 	 * events through the master device changes (for example, user
777 	 * switches from the USB mouse to a tablet), in that case the
778 	 * master device will change to reflect the new slave device
779 	 * axes and keys.
780 	 */
781 	gulong addOnChanged(void delegate(Device) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
782 	{
783 		return Signals.connect(this, "changed", dlg, connectFlags ^ ConnectFlags.SWAPPED);
784 	}
785 
786 	/**
787 	 * The ::tool-changed signal is emitted on pen/eraser
788 	 * #GdkDevices whenever tools enter or leave proximity.
789 	 *
790 	 * Params:
791 	 *     tool = The new current tool
792 	 *
793 	 * Since: 3.22
794 	 */
795 	gulong addOnToolChanged(void delegate(DeviceTool, Device) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
796 	{
797 		return Signals.connect(this, "tool-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED);
798 	}
799 }