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