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