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(bool transferOwnership = false)
71 	{
72 		if (transferOwnership)
73 			ownedRef = false;
74 		return gdkDisplay;
75 	}
76 
77 	/** the main Gtk struct as a void* */
78 	protected override void* getStruct()
79 	{
80 		return cast(void*)gdkDisplay;
81 	}
82 
83 	protected override void setStruct(GObject* obj)
84 	{
85 		gdkDisplay = cast(GdkDisplay*)obj;
86 		super.setStruct(obj);
87 	}
88 
89 	/**
90 	 * Sets our main struct and passes it to the parent class.
91 	 */
92 	public this (GdkDisplay* gdkDisplay, bool ownedRef = false)
93 	{
94 		this.gdkDisplay = gdkDisplay;
95 		super(cast(GObject*)gdkDisplay, ownedRef);
96 	}
97 
98 
99 	/** */
100 	public static GType getType()
101 	{
102 		return gdk_display_get_type();
103 	}
104 
105 	/**
106 	 * Gets the default #GdkDisplay. This is a convenience
107 	 * function for:
108 	 * `gdk_display_manager_get_default_display (gdk_display_manager_get ())`.
109 	 *
110 	 * Returns: a #GdkDisplay, or %NULL if
111 	 *     there is no default display.
112 	 *
113 	 * Since: 2.2
114 	 */
115 	public static Display getDefault()
116 	{
117 		auto p = gdk_display_get_default();
118 		
119 		if(p is null)
120 		{
121 			return null;
122 		}
123 		
124 		return ObjectG.getDObject!(Display)(cast(GdkDisplay*) p);
125 	}
126 
127 	/**
128 	 * Opens a display.
129 	 *
130 	 * Params:
131 	 *     displayName = the name of the display to open
132 	 *
133 	 * Returns: a #GdkDisplay, or %NULL if the
134 	 *     display could not be opened
135 	 *
136 	 * Since: 2.2
137 	 */
138 	public static Display open(string displayName)
139 	{
140 		auto p = gdk_display_open(Str.toStringz(displayName));
141 		
142 		if(p is null)
143 		{
144 			return null;
145 		}
146 		
147 		return ObjectG.getDObject!(Display)(cast(GdkDisplay*) p);
148 	}
149 
150 	/**
151 	 * Opens the default display specified by command line arguments or
152 	 * environment variables, sets it as the default display, and returns
153 	 * it. gdk_parse_args() must have been called first. If the default
154 	 * display has previously been set, simply returns that. An internal
155 	 * function that should not be used by applications.
156 	 *
157 	 * Deprecated: This symbol was never meant to be used outside
158 	 * of GTK+
159 	 *
160 	 * Returns: the default display, if it
161 	 *     could be opened, otherwise %NULL.
162 	 */
163 	public static Display openDefaultLibgtkOnly()
164 	{
165 		auto p = gdk_display_open_default_libgtk_only();
166 		
167 		if(p is null)
168 		{
169 			return null;
170 		}
171 		
172 		return ObjectG.getDObject!(Display)(cast(GdkDisplay*) p);
173 	}
174 
175 	/**
176 	 * Emits a short beep on @display
177 	 *
178 	 * Since: 2.2
179 	 */
180 	public void beep()
181 	{
182 		gdk_display_beep(gdkDisplay);
183 	}
184 
185 	/**
186 	 * Closes the connection to the windowing system for the given display,
187 	 * and cleans up associated resources.
188 	 *
189 	 * Since: 2.2
190 	 */
191 	public void close()
192 	{
193 		gdk_display_close(gdkDisplay);
194 	}
195 
196 	/**
197 	 * Returns %TRUE if there is an ongoing grab on @device for @display.
198 	 *
199 	 * Params:
200 	 *     device = a #GdkDevice
201 	 *
202 	 * Returns: %TRUE if there is a grab in effect for @device.
203 	 */
204 	public bool deviceIsGrabbed(Device device)
205 	{
206 		return gdk_display_device_is_grabbed(gdkDisplay, (device is null) ? null : device.getDeviceStruct()) != 0;
207 	}
208 
209 	/**
210 	 * Flushes any requests queued for the windowing system; this happens automatically
211 	 * when the main loop blocks waiting for new events, but if your application
212 	 * is drawing without returning control to the main loop, you may need
213 	 * to call this function explicitly. A common case where this function
214 	 * needs to be called is when an application is executing drawing commands
215 	 * from a thread other than the thread where the main loop is running.
216 	 *
217 	 * This is most useful for X11. On windowing systems where requests are
218 	 * handled synchronously, this function will do nothing.
219 	 *
220 	 * Since: 2.4
221 	 */
222 	public void flush()
223 	{
224 		gdk_display_flush(gdkDisplay);
225 	}
226 
227 	/**
228 	 * Returns a #GdkAppLaunchContext suitable for launching
229 	 * applications on the given display.
230 	 *
231 	 * Returns: a new #GdkAppLaunchContext for @display.
232 	 *     Free with g_object_unref() when done
233 	 *
234 	 * Since: 3.0
235 	 */
236 	public AppLaunchContext getAppLaunchContext()
237 	{
238 		auto p = gdk_display_get_app_launch_context(gdkDisplay);
239 		
240 		if(p is null)
241 		{
242 			return null;
243 		}
244 		
245 		return ObjectG.getDObject!(AppLaunchContext)(cast(GdkAppLaunchContext*) p, true);
246 	}
247 
248 	/**
249 	 * Returns the default size to use for cursors on @display.
250 	 *
251 	 * Returns: the default cursor size.
252 	 *
253 	 * Since: 2.4
254 	 */
255 	public uint getDefaultCursorSize()
256 	{
257 		return gdk_display_get_default_cursor_size(gdkDisplay);
258 	}
259 
260 	/**
261 	 * Returns the default group leader window for all toplevel windows
262 	 * on @display. This window is implicitly created by GDK.
263 	 * See gdk_window_set_group().
264 	 *
265 	 * Returns: The default group leader window
266 	 *     for @display
267 	 *
268 	 * Since: 2.4
269 	 */
270 	public Window getDefaultGroup()
271 	{
272 		auto p = gdk_display_get_default_group(gdkDisplay);
273 		
274 		if(p is null)
275 		{
276 			return null;
277 		}
278 		
279 		return ObjectG.getDObject!(Window)(cast(GdkWindow*) p);
280 	}
281 
282 	/**
283 	 * Get the default #GdkScreen for @display.
284 	 *
285 	 * Returns: the default #GdkScreen object for @display
286 	 *
287 	 * Since: 2.2
288 	 */
289 	public Screen getDefaultScreen()
290 	{
291 		auto p = gdk_display_get_default_screen(gdkDisplay);
292 		
293 		if(p is null)
294 		{
295 			return null;
296 		}
297 		
298 		return ObjectG.getDObject!(Screen)(cast(GdkScreen*) p);
299 	}
300 
301 	/**
302 	 * Returns the default #GdkSeat for this display.
303 	 *
304 	 * Returns: the default seat.
305 	 *
306 	 * Since: 3.20
307 	 */
308 	public Seat getDefaultSeat()
309 	{
310 		auto p = gdk_display_get_default_seat(gdkDisplay);
311 		
312 		if(p is null)
313 		{
314 			return null;
315 		}
316 		
317 		return ObjectG.getDObject!(Seat)(cast(GdkSeat*) p);
318 	}
319 
320 	/**
321 	 * Returns the #GdkDeviceManager associated to @display.
322 	 *
323 	 * Deprecated: Use gdk_display_get_default_seat() and #GdkSeat operations.
324 	 *
325 	 * Returns: A #GdkDeviceManager, or
326 	 *     %NULL. This memory is owned by GDK and must not be freed
327 	 *     or unreferenced.
328 	 *
329 	 * Since: 3.0
330 	 */
331 	public DeviceManager getDeviceManager()
332 	{
333 		auto p = gdk_display_get_device_manager(gdkDisplay);
334 		
335 		if(p is null)
336 		{
337 			return null;
338 		}
339 		
340 		return ObjectG.getDObject!(DeviceManager)(cast(GdkDeviceManager*) p);
341 	}
342 
343 	/**
344 	 * Gets the next #GdkEvent to be processed for @display, fetching events from the
345 	 * windowing system if necessary.
346 	 *
347 	 * Returns: the next #GdkEvent to be processed, or %NULL
348 	 *     if no events are pending. The returned #GdkEvent should be freed
349 	 *     with gdk_event_free().
350 	 *
351 	 * Since: 2.2
352 	 */
353 	public Event getEvent()
354 	{
355 		auto p = gdk_display_get_event(gdkDisplay);
356 		
357 		if(p is null)
358 		{
359 			return null;
360 		}
361 		
362 		return ObjectG.getDObject!(Event)(cast(GdkEvent*) p, true);
363 	}
364 
365 	/**
366 	 * Gets the maximal size to use for cursors on @display.
367 	 *
368 	 * Params:
369 	 *     width = the return location for the maximal cursor width
370 	 *     height = the return location for the maximal cursor height
371 	 *
372 	 * Since: 2.4
373 	 */
374 	public void getMaximalCursorSize(out uint width, out uint height)
375 	{
376 		gdk_display_get_maximal_cursor_size(gdkDisplay, &width, &height);
377 	}
378 
379 	/**
380 	 * Gets a monitor associated with this display.
381 	 *
382 	 * Params:
383 	 *     monitorNum = number of the monitor
384 	 *
385 	 * Returns: the #GdkMonitor, or %NULL if
386 	 *     @monitor_num is not a valid monitor number
387 	 *
388 	 * Since: 3.22
389 	 */
390 	public MonitorG getMonitor(int monitorNum)
391 	{
392 		auto p = gdk_display_get_monitor(gdkDisplay, monitorNum);
393 		
394 		if(p is null)
395 		{
396 			return null;
397 		}
398 		
399 		return ObjectG.getDObject!(MonitorG)(cast(GdkMonitor*) p);
400 	}
401 
402 	/**
403 	 * Gets the monitor in which the point (@x, @y) is located,
404 	 * or a nearby monitor if the point is not in any monitor.
405 	 *
406 	 * Params:
407 	 *     x = the x coordinate of the point
408 	 *     y = the y coordinate of the point
409 	 *
410 	 * Returns: the monitor containing the point
411 	 *
412 	 * Since: 3.22
413 	 */
414 	public MonitorG getMonitorAtPoint(int x, int y)
415 	{
416 		auto p = gdk_display_get_monitor_at_point(gdkDisplay, x, y);
417 		
418 		if(p is null)
419 		{
420 			return null;
421 		}
422 		
423 		return ObjectG.getDObject!(MonitorG)(cast(GdkMonitor*) p);
424 	}
425 
426 	/**
427 	 * Gets the monitor in which the largest area of @window
428 	 * resides, or a monitor close to @window if it is outside
429 	 * of all monitors.
430 	 *
431 	 * Params:
432 	 *     window = a #GdkWindow
433 	 *
434 	 * Returns: the monitor with the largest overlap with @window
435 	 *
436 	 * Since: 3.22
437 	 */
438 	public MonitorG getMonitorAtWindow(Window window)
439 	{
440 		auto p = gdk_display_get_monitor_at_window(gdkDisplay, (window is null) ? null : window.getWindowStruct());
441 		
442 		if(p is null)
443 		{
444 			return null;
445 		}
446 		
447 		return ObjectG.getDObject!(MonitorG)(cast(GdkMonitor*) p);
448 	}
449 
450 	/**
451 	 * Gets the number of monitors that belong to @display.
452 	 *
453 	 * The returned number is valid until the next emission of the
454 	 * #GdkDisplay::monitor-added or #GdkDisplay::monitor-removed signal.
455 	 *
456 	 * Returns: the number of monitors
457 	 *
458 	 * Since: 3.22
459 	 */
460 	public int getNMonitors()
461 	{
462 		return gdk_display_get_n_monitors(gdkDisplay);
463 	}
464 
465 	/**
466 	 * Gets the number of screen managed by the @display.
467 	 *
468 	 * Deprecated: The number of screens is always 1.
469 	 *
470 	 * Returns: number of screens.
471 	 *
472 	 * Since: 2.2
473 	 */
474 	public int getNScreens()
475 	{
476 		return gdk_display_get_n_screens(gdkDisplay);
477 	}
478 
479 	/**
480 	 * Gets the name of the display.
481 	 *
482 	 * Returns: a string representing the display name. This string is owned
483 	 *     by GDK and should not be modified or freed.
484 	 *
485 	 * Since: 2.2
486 	 */
487 	public string getName()
488 	{
489 		return Str.toString(gdk_display_get_name(gdkDisplay));
490 	}
491 
492 	/**
493 	 * Gets the current location of the pointer and the current modifier
494 	 * mask for a given display.
495 	 *
496 	 * Deprecated: Use gdk_device_get_position() instead.
497 	 *
498 	 * Params:
499 	 *     screen = location to store the screen that the
500 	 *         cursor is on, or %NULL.
501 	 *     x = location to store root window X coordinate of pointer, or %NULL.
502 	 *     y = location to store root window Y coordinate of pointer, or %NULL.
503 	 *     mask = location to store current modifier mask, or %NULL
504 	 *
505 	 * Since: 2.2
506 	 */
507 	public void getPointer(out Screen screen, out int x, out int y, out GdkModifierType mask)
508 	{
509 		GdkScreen* outscreen = null;
510 		
511 		gdk_display_get_pointer(gdkDisplay, &outscreen, &x, &y, &mask);
512 		
513 		screen = ObjectG.getDObject!(Screen)(outscreen);
514 	}
515 
516 	/**
517 	 * Gets the primary monitor for the display.
518 	 *
519 	 * The primary monitor is considered the monitor where the “main desktop”
520 	 * lives. While normal application windows typically allow the window
521 	 * manager to place the windows, specialized desktop applications
522 	 * such as panels should place themselves on the primary monitor.
523 	 *
524 	 * Returns: the primary monitor, or %NULL if no primary
525 	 *     monitor is configured by the user
526 	 *
527 	 * Since: 3.22
528 	 */
529 	public MonitorG getPrimaryMonitor()
530 	{
531 		auto p = gdk_display_get_primary_monitor(gdkDisplay);
532 		
533 		if(p is null)
534 		{
535 			return null;
536 		}
537 		
538 		return ObjectG.getDObject!(MonitorG)(cast(GdkMonitor*) p);
539 	}
540 
541 	/**
542 	 * Returns a screen object for one of the screens of the display.
543 	 *
544 	 * Deprecated: There is only one screen; use gdk_display_get_default_screen() to get it.
545 	 *
546 	 * Params:
547 	 *     screenNum = the screen number
548 	 *
549 	 * Returns: the #GdkScreen object
550 	 *
551 	 * Since: 2.2
552 	 */
553 	public Screen getScreen(int screenNum)
554 	{
555 		auto p = gdk_display_get_screen(gdkDisplay, screenNum);
556 		
557 		if(p is null)
558 		{
559 			return null;
560 		}
561 		
562 		return ObjectG.getDObject!(Screen)(cast(GdkScreen*) p);
563 	}
564 
565 	/**
566 	 * Obtains the window underneath the mouse pointer, returning the location
567 	 * of the pointer in that window in @win_x, @win_y for @screen. Returns %NULL
568 	 * if the window under the mouse pointer is not known to GDK (for example,
569 	 * belongs to another application).
570 	 *
571 	 * Deprecated: Use gdk_device_get_window_at_position() instead.
572 	 *
573 	 * Params:
574 	 *     winX = return location for x coordinate of the pointer location relative
575 	 *         to the window origin, or %NULL
576 	 *     winY = return location for y coordinate of the pointer location relative
577 	 *         &    to the window origin, or %NULL
578 	 *
579 	 * Returns: the window under the mouse
580 	 *     pointer, or %NULL
581 	 *
582 	 * Since: 2.2
583 	 */
584 	public Window getWindowAtPointer(out int winX, out int winY)
585 	{
586 		auto p = gdk_display_get_window_at_pointer(gdkDisplay, &winX, &winY);
587 		
588 		if(p is null)
589 		{
590 			return null;
591 		}
592 		
593 		return ObjectG.getDObject!(Window)(cast(GdkWindow*) p);
594 	}
595 
596 	/**
597 	 * Returns whether the display has events that are waiting
598 	 * to be processed.
599 	 *
600 	 * Returns: %TRUE if there are events ready to be processed.
601 	 *
602 	 * Since: 3.0
603 	 */
604 	public bool hasPending()
605 	{
606 		return gdk_display_has_pending(gdkDisplay) != 0;
607 	}
608 
609 	/**
610 	 * Finds out if the display has been closed.
611 	 *
612 	 * Returns: %TRUE if the display is closed.
613 	 *
614 	 * Since: 2.22
615 	 */
616 	public bool isClosed()
617 	{
618 		return gdk_display_is_closed(gdkDisplay) != 0;
619 	}
620 
621 	/**
622 	 * Release any keyboard grab
623 	 *
624 	 * Deprecated: Use gdk_device_ungrab(), together with gdk_device_grab()
625 	 * instead.
626 	 *
627 	 * Params:
628 	 *     time = a timestap (e.g #GDK_CURRENT_TIME).
629 	 *
630 	 * Since: 2.2
631 	 */
632 	public void keyboardUngrab(uint time)
633 	{
634 		gdk_display_keyboard_ungrab(gdkDisplay, time);
635 	}
636 
637 	/**
638 	 * Returns the list of available input devices attached to @display.
639 	 * The list is statically allocated and should not be freed.
640 	 *
641 	 * Deprecated: Use gdk_device_manager_list_devices() instead.
642 	 *
643 	 * Returns: a list of #GdkDevice
644 	 *
645 	 * Since: 2.2
646 	 */
647 	public ListG listDevices()
648 	{
649 		auto p = gdk_display_list_devices(gdkDisplay);
650 		
651 		if(p is null)
652 		{
653 			return null;
654 		}
655 		
656 		return new ListG(cast(GList*) p);
657 	}
658 
659 	/**
660 	 * Returns the list of seats known to @display.
661 	 *
662 	 * Returns: the
663 	 *     list of seats known to the #GdkDisplay
664 	 *
665 	 * Since: 3.20
666 	 */
667 	public ListG listSeats()
668 	{
669 		auto p = gdk_display_list_seats(gdkDisplay);
670 		
671 		if(p is null)
672 		{
673 			return null;
674 		}
675 		
676 		return new ListG(cast(GList*) p);
677 	}
678 
679 	/**
680 	 * Indicates to the GUI environment that the application has
681 	 * finished loading, using a given identifier.
682 	 *
683 	 * GTK+ will call this function automatically for #GtkWindow
684 	 * with custom startup-notification identifier unless
685 	 * gtk_window_set_auto_startup_notification() is called to
686 	 * disable that feature.
687 	 *
688 	 * Params:
689 	 *     startupId = a startup-notification identifier, for which
690 	 *         notification process should be completed
691 	 *
692 	 * Since: 3.0
693 	 */
694 	public void notifyStartupComplete(string startupId)
695 	{
696 		gdk_display_notify_startup_complete(gdkDisplay, Str.toStringz(startupId));
697 	}
698 
699 	/**
700 	 * Gets a copy of the first #GdkEvent in the @display’s event queue, without
701 	 * removing the event from the queue.  (Note that this function will
702 	 * not get more events from the windowing system.  It only checks the events
703 	 * that have already been moved to the GDK event queue.)
704 	 *
705 	 * Returns: a copy of the first #GdkEvent on the event
706 	 *     queue, or %NULL if no events are in the queue. The returned
707 	 *     #GdkEvent should be freed with gdk_event_free().
708 	 *
709 	 * Since: 2.2
710 	 */
711 	public Event peekEvent()
712 	{
713 		auto p = gdk_display_peek_event(gdkDisplay);
714 		
715 		if(p is null)
716 		{
717 			return null;
718 		}
719 		
720 		return ObjectG.getDObject!(Event)(cast(GdkEvent*) p, true);
721 	}
722 
723 	/**
724 	 * Test if the pointer is grabbed.
725 	 *
726 	 * Deprecated: Use gdk_display_device_is_grabbed() instead.
727 	 *
728 	 * Returns: %TRUE if an active X pointer grab is in effect
729 	 *
730 	 * Since: 2.2
731 	 */
732 	public bool pointerIsGrabbed()
733 	{
734 		return gdk_display_pointer_is_grabbed(gdkDisplay) != 0;
735 	}
736 
737 	/**
738 	 * Release any pointer grab.
739 	 *
740 	 * Deprecated: Use gdk_device_ungrab(), together with gdk_device_grab()
741 	 * instead.
742 	 *
743 	 * Params:
744 	 *     time = a timestap (e.g. %GDK_CURRENT_TIME).
745 	 *
746 	 * Since: 2.2
747 	 */
748 	public void pointerUngrab(uint time)
749 	{
750 		gdk_display_pointer_ungrab(gdkDisplay, time);
751 	}
752 
753 	/**
754 	 * Appends a copy of the given event onto the front of the event
755 	 * queue for @display.
756 	 *
757 	 * Params:
758 	 *     event = a #GdkEvent.
759 	 *
760 	 * Since: 2.2
761 	 */
762 	public void putEvent(Event event)
763 	{
764 		gdk_display_put_event(gdkDisplay, (event is null) ? null : event.getEventStruct());
765 	}
766 
767 	/**
768 	 * Request #GdkEventOwnerChange events for ownership changes
769 	 * of the selection named by the given atom.
770 	 *
771 	 * Params:
772 	 *     selection = the #GdkAtom naming the selection for which
773 	 *         ownership change notification is requested
774 	 *
775 	 * Returns: whether #GdkEventOwnerChange events will
776 	 *     be sent.
777 	 *
778 	 * Since: 2.6
779 	 */
780 	public bool requestSelectionNotification(GdkAtom selection)
781 	{
782 		return gdk_display_request_selection_notification(gdkDisplay, selection) != 0;
783 	}
784 
785 	/**
786 	 * Sets the double click distance (two clicks within this distance
787 	 * count as a double click and result in a #GDK_2BUTTON_PRESS event).
788 	 * See also gdk_display_set_double_click_time().
789 	 * Applications should not set this, it is a global
790 	 * user-configured setting.
791 	 *
792 	 * Params:
793 	 *     distance = distance in pixels
794 	 *
795 	 * Since: 2.4
796 	 */
797 	public void setDoubleClickDistance(uint distance)
798 	{
799 		gdk_display_set_double_click_distance(gdkDisplay, distance);
800 	}
801 
802 	/**
803 	 * Sets the double click time (two clicks within this time interval
804 	 * count as a double click and result in a #GDK_2BUTTON_PRESS event).
805 	 * Applications should not set this, it is a global
806 	 * user-configured setting.
807 	 *
808 	 * Params:
809 	 *     msec = double click time in milliseconds (thousandths of a second)
810 	 *
811 	 * Since: 2.2
812 	 */
813 	public void setDoubleClickTime(uint msec)
814 	{
815 		gdk_display_set_double_click_time(gdkDisplay, msec);
816 	}
817 
818 	/**
819 	 * Issues a request to the clipboard manager to store the
820 	 * clipboard data. On X11, this is a special program that works
821 	 * according to the
822 	 * [FreeDesktop Clipboard Specification](http://www.freedesktop.org/Standards/clipboard-manager-spec).
823 	 *
824 	 * Params:
825 	 *     clipboardWindow = a #GdkWindow belonging to the clipboard owner
826 	 *     time = a timestamp
827 	 *     targets = an array of targets
828 	 *         that should be saved, or %NULL
829 	 *         if all available targets should be saved.
830 	 *     nTargets = length of the @targets array
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 }