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.Display; 26 27 private import gdk.AppLaunchContext; 28 private import gdk.Device; 29 private import gdk.DeviceManager; 30 private import gdk.Event; 31 private import gdk.MonitorG; 32 private import gdk.Screen; 33 private import gdk.Seat; 34 private import gdk.Window; 35 private import gdk.c.functions; 36 public import gdk.c.types; 37 private import glib.ListG; 38 private import glib.Str; 39 private import gobject.ObjectG; 40 private import gobject.Signals; 41 public import gtkc.gdktypes; 42 private import std.algorithm; 43 44 45 /** 46 * #GdkDisplay objects purpose are two fold: 47 * 48 * - To manage and provide information about input devices (pointers and keyboards) 49 * 50 * - To manage and provide information about the available #GdkScreens 51 * 52 * GdkDisplay objects are the GDK representation of an X Display, 53 * which can be described as a workstation consisting of 54 * a keyboard, a pointing device (such as a mouse) and one or more 55 * screens. 56 * It is used to open and keep track of various GdkScreen objects 57 * currently instantiated by the application. It is also used to 58 * access the keyboard(s) and mouse pointer(s) of the display. 59 * 60 * Most of the input device handling has been factored out into 61 * the separate #GdkDeviceManager object. Every display has a 62 * device manager, which you can obtain using 63 * gdk_display_get_device_manager(). 64 */ 65 public class Display : ObjectG 66 { 67 /** the main Gtk struct */ 68 protected GdkDisplay* gdkDisplay; 69 70 /** Get the main Gtk struct */ 71 public GdkDisplay* getDisplayStruct(bool transferOwnership = false) 72 { 73 if (transferOwnership) 74 ownedRef = false; 75 return gdkDisplay; 76 } 77 78 /** the main Gtk struct as a void* */ 79 protected override void* getStruct() 80 { 81 return cast(void*)gdkDisplay; 82 } 83 84 /** 85 * Sets our main struct and passes it to the parent class. 86 */ 87 public this (GdkDisplay* gdkDisplay, bool ownedRef = false) 88 { 89 this.gdkDisplay = gdkDisplay; 90 super(cast(GObject*)gdkDisplay, ownedRef); 91 } 92 93 94 /** */ 95 public static GType getType() 96 { 97 return gdk_display_get_type(); 98 } 99 100 /** 101 * Gets the default #GdkDisplay. This is a convenience 102 * function for: 103 * `gdk_display_manager_get_default_display (gdk_display_manager_get ())`. 104 * 105 * Returns: a #GdkDisplay, or %NULL if 106 * there is no default display. 107 * 108 * Since: 2.2 109 */ 110 public static Display getDefault() 111 { 112 auto p = gdk_display_get_default(); 113 114 if(p is null) 115 { 116 return null; 117 } 118 119 return ObjectG.getDObject!(Display)(cast(GdkDisplay*) p); 120 } 121 122 /** 123 * Opens a display. 124 * 125 * Params: 126 * displayName = the name of the display to open 127 * 128 * Returns: a #GdkDisplay, or %NULL if the 129 * display could not be opened 130 * 131 * Since: 2.2 132 */ 133 public static Display open(string displayName) 134 { 135 auto p = gdk_display_open(Str.toStringz(displayName)); 136 137 if(p is null) 138 { 139 return null; 140 } 141 142 return ObjectG.getDObject!(Display)(cast(GdkDisplay*) p); 143 } 144 145 /** 146 * Opens the default display specified by command line arguments or 147 * environment variables, sets it as the default display, and returns 148 * it. gdk_parse_args() must have been called first. If the default 149 * display has previously been set, simply returns that. An internal 150 * function that should not be used by applications. 151 * 152 * Deprecated: This symbol was never meant to be used outside 153 * of GTK+ 154 * 155 * Returns: the default display, if it 156 * could be opened, otherwise %NULL. 157 */ 158 public static Display openDefaultLibgtkOnly() 159 { 160 auto p = gdk_display_open_default_libgtk_only(); 161 162 if(p is null) 163 { 164 return null; 165 } 166 167 return ObjectG.getDObject!(Display)(cast(GdkDisplay*) p); 168 } 169 170 /** 171 * Emits a short beep on @display 172 * 173 * Since: 2.2 174 */ 175 public void beep() 176 { 177 gdk_display_beep(gdkDisplay); 178 } 179 180 /** 181 * Closes the connection to the windowing system for the given display, 182 * and cleans up associated resources. 183 * 184 * Since: 2.2 185 */ 186 public void close() 187 { 188 gdk_display_close(gdkDisplay); 189 } 190 191 /** 192 * Returns %TRUE if there is an ongoing grab on @device for @display. 193 * 194 * Params: 195 * device = a #GdkDevice 196 * 197 * Returns: %TRUE if there is a grab in effect for @device. 198 */ 199 public bool deviceIsGrabbed(Device device) 200 { 201 return gdk_display_device_is_grabbed(gdkDisplay, (device is null) ? null : device.getDeviceStruct()) != 0; 202 } 203 204 /** 205 * Flushes any requests queued for the windowing system; this happens automatically 206 * when the main loop blocks waiting for new events, but if your application 207 * is drawing without returning control to the main loop, you may need 208 * to call this function explicitly. A common case where this function 209 * needs to be called is when an application is executing drawing commands 210 * from a thread other than the thread where the main loop is running. 211 * 212 * This is most useful for X11. On windowing systems where requests are 213 * handled synchronously, this function will do nothing. 214 * 215 * Since: 2.4 216 */ 217 public void flush() 218 { 219 gdk_display_flush(gdkDisplay); 220 } 221 222 /** 223 * Returns a #GdkAppLaunchContext suitable for launching 224 * applications on the given display. 225 * 226 * Returns: a new #GdkAppLaunchContext for @display. 227 * Free with g_object_unref() when done 228 * 229 * Since: 3.0 230 */ 231 public AppLaunchContext getAppLaunchContext() 232 { 233 auto p = gdk_display_get_app_launch_context(gdkDisplay); 234 235 if(p is null) 236 { 237 return null; 238 } 239 240 return ObjectG.getDObject!(AppLaunchContext)(cast(GdkAppLaunchContext*) p, true); 241 } 242 243 /** 244 * Returns the default size to use for cursors on @display. 245 * 246 * Returns: the default cursor size. 247 * 248 * Since: 2.4 249 */ 250 public uint getDefaultCursorSize() 251 { 252 return gdk_display_get_default_cursor_size(gdkDisplay); 253 } 254 255 /** 256 * Returns the default group leader window for all toplevel windows 257 * on @display. This window is implicitly created by GDK. 258 * See gdk_window_set_group(). 259 * 260 * Returns: The default group leader window 261 * for @display 262 * 263 * Since: 2.4 264 */ 265 public Window getDefaultGroup() 266 { 267 auto p = gdk_display_get_default_group(gdkDisplay); 268 269 if(p is null) 270 { 271 return null; 272 } 273 274 return ObjectG.getDObject!(Window)(cast(GdkWindow*) p); 275 } 276 277 /** 278 * Get the default #GdkScreen for @display. 279 * 280 * Returns: the default #GdkScreen object for @display 281 * 282 * Since: 2.2 283 */ 284 public Screen getDefaultScreen() 285 { 286 auto p = gdk_display_get_default_screen(gdkDisplay); 287 288 if(p is null) 289 { 290 return null; 291 } 292 293 return ObjectG.getDObject!(Screen)(cast(GdkScreen*) p); 294 } 295 296 /** 297 * Returns the default #GdkSeat for this display. 298 * 299 * Returns: the default seat. 300 * 301 * Since: 3.20 302 */ 303 public Seat getDefaultSeat() 304 { 305 auto p = gdk_display_get_default_seat(gdkDisplay); 306 307 if(p is null) 308 { 309 return null; 310 } 311 312 return ObjectG.getDObject!(Seat)(cast(GdkSeat*) p); 313 } 314 315 /** 316 * Returns the #GdkDeviceManager associated to @display. 317 * 318 * Deprecated: Use gdk_display_get_default_seat() and #GdkSeat operations. 319 * 320 * Returns: A #GdkDeviceManager, or 321 * %NULL. This memory is owned by GDK and must not be freed 322 * or unreferenced. 323 * 324 * Since: 3.0 325 */ 326 public DeviceManager getDeviceManager() 327 { 328 auto p = gdk_display_get_device_manager(gdkDisplay); 329 330 if(p is null) 331 { 332 return null; 333 } 334 335 return ObjectG.getDObject!(DeviceManager)(cast(GdkDeviceManager*) p); 336 } 337 338 /** 339 * Gets the next #GdkEvent to be processed for @display, fetching events from the 340 * windowing system if necessary. 341 * 342 * Returns: the next #GdkEvent to be processed, or %NULL 343 * if no events are pending. The returned #GdkEvent should be freed 344 * with gdk_event_free(). 345 * 346 * Since: 2.2 347 */ 348 public Event getEvent() 349 { 350 auto p = gdk_display_get_event(gdkDisplay); 351 352 if(p is null) 353 { 354 return null; 355 } 356 357 return ObjectG.getDObject!(Event)(cast(GdkEvent*) p, true); 358 } 359 360 /** 361 * Gets the maximal size to use for cursors on @display. 362 * 363 * Params: 364 * width = the return location for the maximal cursor width 365 * height = the return location for the maximal cursor height 366 * 367 * Since: 2.4 368 */ 369 public void getMaximalCursorSize(out uint width, out uint height) 370 { 371 gdk_display_get_maximal_cursor_size(gdkDisplay, &width, &height); 372 } 373 374 /** 375 * Gets a monitor associated with this display. 376 * 377 * Params: 378 * monitorNum = number of the monitor 379 * 380 * Returns: the #GdkMonitor, or %NULL if 381 * @monitor_num is not a valid monitor number 382 * 383 * Since: 3.22 384 */ 385 public MonitorG getMonitor(int monitorNum) 386 { 387 auto p = gdk_display_get_monitor(gdkDisplay, monitorNum); 388 389 if(p is null) 390 { 391 return null; 392 } 393 394 return ObjectG.getDObject!(MonitorG)(cast(GdkMonitor*) p); 395 } 396 397 /** 398 * Gets the monitor in which the point (@x, @y) is located, 399 * or a nearby monitor if the point is not in any monitor. 400 * 401 * Params: 402 * x = the x coordinate of the point 403 * y = the y coordinate of the point 404 * 405 * Returns: the monitor containing the point 406 * 407 * Since: 3.22 408 */ 409 public MonitorG getMonitorAtPoint(int x, int y) 410 { 411 auto p = gdk_display_get_monitor_at_point(gdkDisplay, x, y); 412 413 if(p is null) 414 { 415 return null; 416 } 417 418 return ObjectG.getDObject!(MonitorG)(cast(GdkMonitor*) p); 419 } 420 421 /** 422 * Gets the monitor in which the largest area of @window 423 * resides, or a monitor close to @window if it is outside 424 * of all monitors. 425 * 426 * Params: 427 * window = a #GdkWindow 428 * 429 * Returns: the monitor with the largest overlap with @window 430 * 431 * Since: 3.22 432 */ 433 public MonitorG getMonitorAtWindow(Window window) 434 { 435 auto p = gdk_display_get_monitor_at_window(gdkDisplay, (window is null) ? null : window.getWindowStruct()); 436 437 if(p is null) 438 { 439 return null; 440 } 441 442 return ObjectG.getDObject!(MonitorG)(cast(GdkMonitor*) p); 443 } 444 445 /** 446 * Gets the number of monitors that belong to @display. 447 * 448 * The returned number is valid until the next emission of the 449 * #GdkDisplay::monitor-added or #GdkDisplay::monitor-removed signal. 450 * 451 * Returns: the number of monitors 452 * 453 * Since: 3.22 454 */ 455 public int getNMonitors() 456 { 457 return gdk_display_get_n_monitors(gdkDisplay); 458 } 459 460 /** 461 * Gets the number of screen managed by the @display. 462 * 463 * Deprecated: The number of screens is always 1. 464 * 465 * Returns: number of screens. 466 * 467 * Since: 2.2 468 */ 469 public int getNScreens() 470 { 471 return gdk_display_get_n_screens(gdkDisplay); 472 } 473 474 /** 475 * Gets the name of the display. 476 * 477 * Returns: a string representing the display name. This string is owned 478 * by GDK and should not be modified or freed. 479 * 480 * Since: 2.2 481 */ 482 public string getName() 483 { 484 return Str.toString(gdk_display_get_name(gdkDisplay)); 485 } 486 487 /** 488 * Gets the current location of the pointer and the current modifier 489 * mask for a given display. 490 * 491 * Deprecated: Use gdk_device_get_position() instead. 492 * 493 * Params: 494 * screen = location to store the screen that the 495 * cursor is on, or %NULL. 496 * x = location to store root window X coordinate of pointer, or %NULL. 497 * y = location to store root window Y coordinate of pointer, or %NULL. 498 * mask = location to store current modifier mask, or %NULL 499 * 500 * Since: 2.2 501 */ 502 public void getPointer(out Screen screen, out int x, out int y, out GdkModifierType mask) 503 { 504 GdkScreen* outscreen = null; 505 506 gdk_display_get_pointer(gdkDisplay, &outscreen, &x, &y, &mask); 507 508 screen = ObjectG.getDObject!(Screen)(outscreen); 509 } 510 511 /** 512 * Gets the primary monitor for the display. 513 * 514 * The primary monitor is considered the monitor where the “main desktop” 515 * lives. While normal application windows typically allow the window 516 * manager to place the windows, specialized desktop applications 517 * such as panels should place themselves on the primary monitor. 518 * 519 * Returns: the primary monitor, or %NULL if no primary 520 * monitor is configured by the user 521 * 522 * Since: 3.22 523 */ 524 public MonitorG getPrimaryMonitor() 525 { 526 auto p = gdk_display_get_primary_monitor(gdkDisplay); 527 528 if(p is null) 529 { 530 return null; 531 } 532 533 return ObjectG.getDObject!(MonitorG)(cast(GdkMonitor*) p); 534 } 535 536 /** 537 * Returns a screen object for one of the screens of the display. 538 * 539 * Deprecated: There is only one screen; use gdk_display_get_default_screen() to get it. 540 * 541 * Params: 542 * screenNum = the screen number 543 * 544 * Returns: the #GdkScreen object 545 * 546 * Since: 2.2 547 */ 548 public Screen getScreen(int screenNum) 549 { 550 auto p = gdk_display_get_screen(gdkDisplay, screenNum); 551 552 if(p is null) 553 { 554 return null; 555 } 556 557 return ObjectG.getDObject!(Screen)(cast(GdkScreen*) p); 558 } 559 560 /** 561 * Obtains the window underneath the mouse pointer, returning the location 562 * of the pointer in that window in @win_x, @win_y for @screen. Returns %NULL 563 * if the window under the mouse pointer is not known to GDK (for example, 564 * belongs to another application). 565 * 566 * Deprecated: Use gdk_device_get_window_at_position() instead. 567 * 568 * Params: 569 * winX = return location for x coordinate of the pointer location relative 570 * to the window origin, or %NULL 571 * winY = return location for y coordinate of the pointer location relative 572 * & to the window origin, or %NULL 573 * 574 * Returns: the window under the mouse 575 * pointer, or %NULL 576 * 577 * Since: 2.2 578 */ 579 public Window getWindowAtPointer(out int winX, out int winY) 580 { 581 auto p = gdk_display_get_window_at_pointer(gdkDisplay, &winX, &winY); 582 583 if(p is null) 584 { 585 return null; 586 } 587 588 return ObjectG.getDObject!(Window)(cast(GdkWindow*) p); 589 } 590 591 /** 592 * Returns whether the display has events that are waiting 593 * to be processed. 594 * 595 * Returns: %TRUE if there are events ready to be processed. 596 * 597 * Since: 3.0 598 */ 599 public bool hasPending() 600 { 601 return gdk_display_has_pending(gdkDisplay) != 0; 602 } 603 604 /** 605 * Finds out if the display has been closed. 606 * 607 * Returns: %TRUE if the display is closed. 608 * 609 * Since: 2.22 610 */ 611 public bool isClosed() 612 { 613 return gdk_display_is_closed(gdkDisplay) != 0; 614 } 615 616 /** 617 * Release any keyboard grab 618 * 619 * Deprecated: Use gdk_device_ungrab(), together with gdk_device_grab() 620 * instead. 621 * 622 * Params: 623 * time = a timestap (e.g #GDK_CURRENT_TIME). 624 * 625 * Since: 2.2 626 */ 627 public void keyboardUngrab(uint time) 628 { 629 gdk_display_keyboard_ungrab(gdkDisplay, time); 630 } 631 632 /** 633 * Returns the list of available input devices attached to @display. 634 * The list is statically allocated and should not be freed. 635 * 636 * Deprecated: Use gdk_device_manager_list_devices() instead. 637 * 638 * Returns: a list of #GdkDevice 639 * 640 * Since: 2.2 641 */ 642 public ListG listDevices() 643 { 644 auto p = gdk_display_list_devices(gdkDisplay); 645 646 if(p is null) 647 { 648 return null; 649 } 650 651 return new ListG(cast(GList*) p); 652 } 653 654 /** 655 * Returns the list of seats known to @display. 656 * 657 * Returns: the 658 * list of seats known to the #GdkDisplay 659 * 660 * Since: 3.20 661 */ 662 public ListG listSeats() 663 { 664 auto p = gdk_display_list_seats(gdkDisplay); 665 666 if(p is null) 667 { 668 return null; 669 } 670 671 return new ListG(cast(GList*) p); 672 } 673 674 /** 675 * Indicates to the GUI environment that the application has 676 * finished loading, using a given identifier. 677 * 678 * GTK+ will call this function automatically for #GtkWindow 679 * with custom startup-notification identifier unless 680 * gtk_window_set_auto_startup_notification() is called to 681 * disable that feature. 682 * 683 * Params: 684 * startupId = a startup-notification identifier, for which 685 * notification process should be completed 686 * 687 * Since: 3.0 688 */ 689 public void notifyStartupComplete(string startupId) 690 { 691 gdk_display_notify_startup_complete(gdkDisplay, Str.toStringz(startupId)); 692 } 693 694 /** 695 * Gets a copy of the first #GdkEvent in the @display’s event queue, without 696 * removing the event from the queue. (Note that this function will 697 * not get more events from the windowing system. It only checks the events 698 * that have already been moved to the GDK event queue.) 699 * 700 * Returns: a copy of the first #GdkEvent on the event 701 * queue, or %NULL if no events are in the queue. The returned 702 * #GdkEvent should be freed with gdk_event_free(). 703 * 704 * Since: 2.2 705 */ 706 public Event peekEvent() 707 { 708 auto p = gdk_display_peek_event(gdkDisplay); 709 710 if(p is null) 711 { 712 return null; 713 } 714 715 return ObjectG.getDObject!(Event)(cast(GdkEvent*) p, true); 716 } 717 718 /** 719 * Test if the pointer is grabbed. 720 * 721 * Deprecated: Use gdk_display_device_is_grabbed() instead. 722 * 723 * Returns: %TRUE if an active X pointer grab is in effect 724 * 725 * Since: 2.2 726 */ 727 public bool pointerIsGrabbed() 728 { 729 return gdk_display_pointer_is_grabbed(gdkDisplay) != 0; 730 } 731 732 /** 733 * Release any pointer grab. 734 * 735 * Deprecated: Use gdk_device_ungrab(), together with gdk_device_grab() 736 * instead. 737 * 738 * Params: 739 * time = a timestap (e.g. %GDK_CURRENT_TIME). 740 * 741 * Since: 2.2 742 */ 743 public void pointerUngrab(uint time) 744 { 745 gdk_display_pointer_ungrab(gdkDisplay, time); 746 } 747 748 /** 749 * Appends a copy of the given event onto the front of the event 750 * queue for @display. 751 * 752 * Params: 753 * event = a #GdkEvent. 754 * 755 * Since: 2.2 756 */ 757 public void putEvent(Event event) 758 { 759 gdk_display_put_event(gdkDisplay, (event is null) ? null : event.getEventStruct()); 760 } 761 762 /** 763 * Request #GdkEventOwnerChange events for ownership changes 764 * of the selection named by the given atom. 765 * 766 * Params: 767 * selection = the #GdkAtom naming the selection for which 768 * ownership change notification is requested 769 * 770 * Returns: whether #GdkEventOwnerChange events will 771 * be sent. 772 * 773 * Since: 2.6 774 */ 775 public bool requestSelectionNotification(GdkAtom selection) 776 { 777 return gdk_display_request_selection_notification(gdkDisplay, selection) != 0; 778 } 779 780 /** 781 * Sets the double click distance (two clicks within this distance 782 * count as a double click and result in a #GDK_2BUTTON_PRESS event). 783 * See also gdk_display_set_double_click_time(). 784 * Applications should not set this, it is a global 785 * user-configured setting. 786 * 787 * Params: 788 * distance = distance in pixels 789 * 790 * Since: 2.4 791 */ 792 public void setDoubleClickDistance(uint distance) 793 { 794 gdk_display_set_double_click_distance(gdkDisplay, distance); 795 } 796 797 /** 798 * Sets the double click time (two clicks within this time interval 799 * count as a double click and result in a #GDK_2BUTTON_PRESS event). 800 * Applications should not set this, it is a global 801 * user-configured setting. 802 * 803 * Params: 804 * msec = double click time in milliseconds (thousandths of a second) 805 * 806 * Since: 2.2 807 */ 808 public void setDoubleClickTime(uint msec) 809 { 810 gdk_display_set_double_click_time(gdkDisplay, msec); 811 } 812 813 /** 814 * Issues a request to the clipboard manager to store the 815 * clipboard data. On X11, this is a special program that works 816 * according to the 817 * [FreeDesktop Clipboard Specification](http://www.freedesktop.org/Standards/clipboard-manager-spec). 818 * 819 * Params: 820 * clipboardWindow = a #GdkWindow belonging to the clipboard owner 821 * time = a timestamp 822 * targets = an array of targets 823 * that should be saved, or %NULL 824 * if all available targets should be saved. 825 * 826 * Since: 2.6 827 */ 828 public void storeClipboard(Window clipboardWindow, uint time, GdkAtom[] targets) 829 { 830 gdk_display_store_clipboard(gdkDisplay, (clipboardWindow is null) ? null : clipboardWindow.getWindowStruct(), time, targets.ptr, cast(int)targets.length); 831 } 832 833 /** 834 * Returns whether the speicifed display supports clipboard 835 * persistance; i.e. if it’s possible to store the clipboard data after an 836 * application has quit. On X11 this checks if a clipboard daemon is 837 * running. 838 * 839 * Returns: %TRUE if the display supports clipboard persistance. 840 * 841 * Since: 2.6 842 */ 843 public bool supportsClipboardPersistence() 844 { 845 return gdk_display_supports_clipboard_persistence(gdkDisplay) != 0; 846 } 847 848 /** 849 * Returns %TRUE if gdk_window_set_composited() can be used 850 * to redirect drawing on the window using compositing. 851 * 852 * Currently this only works on X11 with XComposite and 853 * XDamage extensions available. 854 * 855 * Deprecated: Compositing is an outdated technology that 856 * only ever worked on X11. 857 * 858 * Returns: %TRUE if windows may be composited. 859 * 860 * Since: 2.12 861 */ 862 public bool supportsComposite() 863 { 864 return gdk_display_supports_composite(gdkDisplay) != 0; 865 } 866 867 /** 868 * Returns %TRUE if cursors can use an 8bit alpha channel 869 * on @display. Otherwise, cursors are restricted to bilevel 870 * alpha (i.e. a mask). 871 * 872 * Returns: whether cursors can have alpha channels. 873 * 874 * Since: 2.4 875 */ 876 public bool supportsCursorAlpha() 877 { 878 return gdk_display_supports_cursor_alpha(gdkDisplay) != 0; 879 } 880 881 /** 882 * Returns %TRUE if multicolored cursors are supported 883 * on @display. Otherwise, cursors have only a forground 884 * and a background color. 885 * 886 * Returns: whether cursors can have multiple colors. 887 * 888 * Since: 2.4 889 */ 890 public bool supportsCursorColor() 891 { 892 return gdk_display_supports_cursor_color(gdkDisplay) != 0; 893 } 894 895 /** 896 * Returns %TRUE if gdk_window_input_shape_combine_mask() can 897 * be used to modify the input shape of windows on @display. 898 * 899 * Returns: %TRUE if windows with modified input shape are supported 900 * 901 * Since: 2.10 902 */ 903 public bool supportsInputShapes() 904 { 905 return gdk_display_supports_input_shapes(gdkDisplay) != 0; 906 } 907 908 /** 909 * Returns whether #GdkEventOwnerChange events will be 910 * sent when the owner of a selection changes. 911 * 912 * Returns: whether #GdkEventOwnerChange events will 913 * be sent. 914 * 915 * Since: 2.6 916 */ 917 public bool supportsSelectionNotification() 918 { 919 return gdk_display_supports_selection_notification(gdkDisplay) != 0; 920 } 921 922 /** 923 * Returns %TRUE if gdk_window_shape_combine_mask() can 924 * be used to create shaped windows on @display. 925 * 926 * Returns: %TRUE if shaped windows are supported 927 * 928 * Since: 2.10 929 */ 930 public bool supportsShapes() 931 { 932 return gdk_display_supports_shapes(gdkDisplay) != 0; 933 } 934 935 /** 936 * Flushes any requests queued for the windowing system and waits until all 937 * requests have been handled. This is often used for making sure that the 938 * display is synchronized with the current state of the program. Calling 939 * gdk_display_sync() before gdk_error_trap_pop() makes sure that any errors 940 * generated from earlier requests are handled before the error trap is 941 * removed. 942 * 943 * This is most useful for X11. On windowing systems where requests are 944 * handled synchronously, this function will do nothing. 945 * 946 * Since: 2.2 947 */ 948 public void sync() 949 { 950 gdk_display_sync(gdkDisplay); 951 } 952 953 /** 954 * Warps the pointer of @display to the point @x,@y on 955 * the screen @screen, unless the pointer is confined 956 * to a window by a grab, in which case it will be moved 957 * as far as allowed by the grab. Warping the pointer 958 * creates events as if the user had moved the mouse 959 * instantaneously to the destination. 960 * 961 * Note that the pointer should normally be under the 962 * control of the user. This function was added to cover 963 * some rare use cases like keyboard navigation support 964 * for the color picker in the #GtkColorSelectionDialog. 965 * 966 * Deprecated: Use gdk_device_warp() instead. 967 * 968 * Params: 969 * screen = the screen of @display to warp the pointer to 970 * x = the x coordinate of the destination 971 * y = the y coordinate of the destination 972 * 973 * Since: 2.8 974 */ 975 public void warpPointer(Screen screen, int x, int y) 976 { 977 gdk_display_warp_pointer(gdkDisplay, (screen is null) ? null : screen.getScreenStruct(), x, y); 978 } 979 980 protected class OnClosedDelegateWrapper 981 { 982 void delegate(bool, Display) dlg; 983 gulong handlerId; 984 985 this(void delegate(bool, Display) dlg) 986 { 987 this.dlg = dlg; 988 onClosedListeners ~= this; 989 } 990 991 void remove(OnClosedDelegateWrapper source) 992 { 993 foreach(index, wrapper; onClosedListeners) 994 { 995 if (wrapper.handlerId == source.handlerId) 996 { 997 onClosedListeners[index] = null; 998 onClosedListeners = std.algorithm.remove(onClosedListeners, index); 999 break; 1000 } 1001 } 1002 } 1003 } 1004 OnClosedDelegateWrapper[] onClosedListeners; 1005 1006 /** 1007 * The ::closed signal is emitted when the connection to the windowing 1008 * system for @display is closed. 1009 * 1010 * Params: 1011 * isError = %TRUE if the display was closed due to an error 1012 * 1013 * Since: 2.2 1014 */ 1015 gulong addOnClosed(void delegate(bool, Display) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1016 { 1017 auto wrapper = new OnClosedDelegateWrapper(dlg); 1018 wrapper.handlerId = Signals.connectData( 1019 this, 1020 "closed", 1021 cast(GCallback)&callBackClosed, 1022 cast(void*)wrapper, 1023 cast(GClosureNotify)&callBackClosedDestroy, 1024 connectFlags); 1025 return wrapper.handlerId; 1026 } 1027 1028 extern(C) static void callBackClosed(GdkDisplay* displayStruct, bool isError, OnClosedDelegateWrapper wrapper) 1029 { 1030 wrapper.dlg(isError, wrapper.outer); 1031 } 1032 1033 extern(C) static void callBackClosedDestroy(OnClosedDelegateWrapper wrapper, GClosure* closure) 1034 { 1035 wrapper.remove(wrapper); 1036 } 1037 1038 protected class OnMonitorAddedDelegateWrapper 1039 { 1040 void delegate(MonitorG, Display) dlg; 1041 gulong handlerId; 1042 1043 this(void delegate(MonitorG, Display) dlg) 1044 { 1045 this.dlg = dlg; 1046 onMonitorAddedListeners ~= this; 1047 } 1048 1049 void remove(OnMonitorAddedDelegateWrapper source) 1050 { 1051 foreach(index, wrapper; onMonitorAddedListeners) 1052 { 1053 if (wrapper.handlerId == source.handlerId) 1054 { 1055 onMonitorAddedListeners[index] = null; 1056 onMonitorAddedListeners = std.algorithm.remove(onMonitorAddedListeners, index); 1057 break; 1058 } 1059 } 1060 } 1061 } 1062 OnMonitorAddedDelegateWrapper[] onMonitorAddedListeners; 1063 1064 /** 1065 * The ::monitor-added signal is emitted whenever a monitor is 1066 * added. 1067 * 1068 * Params: 1069 * monitor = the monitor that was just added 1070 * 1071 * Since: 3.22 1072 */ 1073 gulong addOnMonitorAdded(void delegate(MonitorG, Display) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1074 { 1075 auto wrapper = new OnMonitorAddedDelegateWrapper(dlg); 1076 wrapper.handlerId = Signals.connectData( 1077 this, 1078 "monitor-added", 1079 cast(GCallback)&callBackMonitorAdded, 1080 cast(void*)wrapper, 1081 cast(GClosureNotify)&callBackMonitorAddedDestroy, 1082 connectFlags); 1083 return wrapper.handlerId; 1084 } 1085 1086 extern(C) static void callBackMonitorAdded(GdkDisplay* displayStruct, GdkMonitor* monitor, OnMonitorAddedDelegateWrapper wrapper) 1087 { 1088 wrapper.dlg(ObjectG.getDObject!(MonitorG)(monitor), wrapper.outer); 1089 } 1090 1091 extern(C) static void callBackMonitorAddedDestroy(OnMonitorAddedDelegateWrapper wrapper, GClosure* closure) 1092 { 1093 wrapper.remove(wrapper); 1094 } 1095 1096 protected class OnMonitorRemovedDelegateWrapper 1097 { 1098 void delegate(MonitorG, Display) dlg; 1099 gulong handlerId; 1100 1101 this(void delegate(MonitorG, Display) dlg) 1102 { 1103 this.dlg = dlg; 1104 onMonitorRemovedListeners ~= this; 1105 } 1106 1107 void remove(OnMonitorRemovedDelegateWrapper source) 1108 { 1109 foreach(index, wrapper; onMonitorRemovedListeners) 1110 { 1111 if (wrapper.handlerId == source.handlerId) 1112 { 1113 onMonitorRemovedListeners[index] = null; 1114 onMonitorRemovedListeners = std.algorithm.remove(onMonitorRemovedListeners, index); 1115 break; 1116 } 1117 } 1118 } 1119 } 1120 OnMonitorRemovedDelegateWrapper[] onMonitorRemovedListeners; 1121 1122 /** 1123 * The ::monitor-removed signal is emitted whenever a monitor is 1124 * removed. 1125 * 1126 * Params: 1127 * monitor = the monitor that was just removed 1128 * 1129 * Since: 3.22 1130 */ 1131 gulong addOnMonitorRemoved(void delegate(MonitorG, Display) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1132 { 1133 auto wrapper = new OnMonitorRemovedDelegateWrapper(dlg); 1134 wrapper.handlerId = Signals.connectData( 1135 this, 1136 "monitor-removed", 1137 cast(GCallback)&callBackMonitorRemoved, 1138 cast(void*)wrapper, 1139 cast(GClosureNotify)&callBackMonitorRemovedDestroy, 1140 connectFlags); 1141 return wrapper.handlerId; 1142 } 1143 1144 extern(C) static void callBackMonitorRemoved(GdkDisplay* displayStruct, GdkMonitor* monitor, OnMonitorRemovedDelegateWrapper wrapper) 1145 { 1146 wrapper.dlg(ObjectG.getDObject!(MonitorG)(monitor), wrapper.outer); 1147 } 1148 1149 extern(C) static void callBackMonitorRemovedDestroy(OnMonitorRemovedDelegateWrapper wrapper, GClosure* closure) 1150 { 1151 wrapper.remove(wrapper); 1152 } 1153 1154 protected class OnOpenedDelegateWrapper 1155 { 1156 void delegate(Display) dlg; 1157 gulong handlerId; 1158 1159 this(void delegate(Display) dlg) 1160 { 1161 this.dlg = dlg; 1162 onOpenedListeners ~= this; 1163 } 1164 1165 void remove(OnOpenedDelegateWrapper source) 1166 { 1167 foreach(index, wrapper; onOpenedListeners) 1168 { 1169 if (wrapper.handlerId == source.handlerId) 1170 { 1171 onOpenedListeners[index] = null; 1172 onOpenedListeners = std.algorithm.remove(onOpenedListeners, index); 1173 break; 1174 } 1175 } 1176 } 1177 } 1178 OnOpenedDelegateWrapper[] onOpenedListeners; 1179 1180 /** 1181 * The ::opened signal is emitted when the connection to the windowing 1182 * system for @display is opened. 1183 */ 1184 gulong addOnOpened(void delegate(Display) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1185 { 1186 auto wrapper = new OnOpenedDelegateWrapper(dlg); 1187 wrapper.handlerId = Signals.connectData( 1188 this, 1189 "opened", 1190 cast(GCallback)&callBackOpened, 1191 cast(void*)wrapper, 1192 cast(GClosureNotify)&callBackOpenedDestroy, 1193 connectFlags); 1194 return wrapper.handlerId; 1195 } 1196 1197 extern(C) static void callBackOpened(GdkDisplay* displayStruct, OnOpenedDelegateWrapper wrapper) 1198 { 1199 wrapper.dlg(wrapper.outer); 1200 } 1201 1202 extern(C) static void callBackOpenedDestroy(OnOpenedDelegateWrapper wrapper, GClosure* closure) 1203 { 1204 wrapper.remove(wrapper); 1205 } 1206 1207 protected class OnSeatAddedDelegateWrapper 1208 { 1209 void delegate(Seat, Display) dlg; 1210 gulong handlerId; 1211 1212 this(void delegate(Seat, Display) dlg) 1213 { 1214 this.dlg = dlg; 1215 onSeatAddedListeners ~= this; 1216 } 1217 1218 void remove(OnSeatAddedDelegateWrapper source) 1219 { 1220 foreach(index, wrapper; onSeatAddedListeners) 1221 { 1222 if (wrapper.handlerId == source.handlerId) 1223 { 1224 onSeatAddedListeners[index] = null; 1225 onSeatAddedListeners = std.algorithm.remove(onSeatAddedListeners, index); 1226 break; 1227 } 1228 } 1229 } 1230 } 1231 OnSeatAddedDelegateWrapper[] onSeatAddedListeners; 1232 1233 /** 1234 * The ::seat-added signal is emitted whenever a new seat is made 1235 * known to the windowing system. 1236 * 1237 * Params: 1238 * seat = the seat that was just added 1239 * 1240 * Since: 3.20 1241 */ 1242 gulong addOnSeatAdded(void delegate(Seat, Display) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1243 { 1244 auto wrapper = new OnSeatAddedDelegateWrapper(dlg); 1245 wrapper.handlerId = Signals.connectData( 1246 this, 1247 "seat-added", 1248 cast(GCallback)&callBackSeatAdded, 1249 cast(void*)wrapper, 1250 cast(GClosureNotify)&callBackSeatAddedDestroy, 1251 connectFlags); 1252 return wrapper.handlerId; 1253 } 1254 1255 extern(C) static void callBackSeatAdded(GdkDisplay* displayStruct, GdkSeat* seat, OnSeatAddedDelegateWrapper wrapper) 1256 { 1257 wrapper.dlg(ObjectG.getDObject!(Seat)(seat), wrapper.outer); 1258 } 1259 1260 extern(C) static void callBackSeatAddedDestroy(OnSeatAddedDelegateWrapper wrapper, GClosure* closure) 1261 { 1262 wrapper.remove(wrapper); 1263 } 1264 1265 protected class OnSeatRemovedDelegateWrapper 1266 { 1267 void delegate(Seat, Display) dlg; 1268 gulong handlerId; 1269 1270 this(void delegate(Seat, Display) dlg) 1271 { 1272 this.dlg = dlg; 1273 onSeatRemovedListeners ~= this; 1274 } 1275 1276 void remove(OnSeatRemovedDelegateWrapper source) 1277 { 1278 foreach(index, wrapper; onSeatRemovedListeners) 1279 { 1280 if (wrapper.handlerId == source.handlerId) 1281 { 1282 onSeatRemovedListeners[index] = null; 1283 onSeatRemovedListeners = std.algorithm.remove(onSeatRemovedListeners, index); 1284 break; 1285 } 1286 } 1287 } 1288 } 1289 OnSeatRemovedDelegateWrapper[] onSeatRemovedListeners; 1290 1291 /** 1292 * The ::seat-removed signal is emitted whenever a seat is removed 1293 * by the windowing system. 1294 * 1295 * Params: 1296 * seat = the seat that was just removed 1297 * 1298 * Since: 3.20 1299 */ 1300 gulong addOnSeatRemoved(void delegate(Seat, Display) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1301 { 1302 auto wrapper = new OnSeatRemovedDelegateWrapper(dlg); 1303 wrapper.handlerId = Signals.connectData( 1304 this, 1305 "seat-removed", 1306 cast(GCallback)&callBackSeatRemoved, 1307 cast(void*)wrapper, 1308 cast(GClosureNotify)&callBackSeatRemovedDestroy, 1309 connectFlags); 1310 return wrapper.handlerId; 1311 } 1312 1313 extern(C) static void callBackSeatRemoved(GdkDisplay* displayStruct, GdkSeat* seat, OnSeatRemovedDelegateWrapper wrapper) 1314 { 1315 wrapper.dlg(ObjectG.getDObject!(Seat)(seat), wrapper.outer); 1316 } 1317 1318 extern(C) static void callBackSeatRemovedDestroy(OnSeatRemovedDelegateWrapper wrapper, GClosure* closure) 1319 { 1320 wrapper.remove(wrapper); 1321 } 1322 }