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