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