2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = GdkDisplay.html
52 * - GdkDisplay* -> Display
53 * - GdkEvent* -> Event
54 * - GdkScreen* -> Screen
55 * - GdkWindow* -> Window
66 import tango
.io
.Stdout
; // use the tango loging?
70 private import gtkc
.gdktypes
;
72 private import gtkc
.gdk
;
75 private import glib
.Str
;
76 private import gdk
.Display
;
77 private import gdk
.Screen
;
78 private import glib
.ListG
;
79 private import gdk
.Event
;
80 private import gdk
.Window
;
87 * GdkDisplay objects purpose are two fold:
88 * To grab/ungrab keyboard focus and mouse pointer
89 * To manage and provide information about the GdkScreen(s)
90 * available for this GdkDisplay
91 * GdkDisplay objects are the GDK representation of the X Display which can be
92 * described as a workstation consisting of a keyboard a pointing
93 * device (such as a mouse) and one or more screens.
94 * It is used to open and keep track of various GdkScreen objects currently
95 * instanciated by the application. It is also used to grab and release the keyboard
96 * and the mouse pointer.
98 private import gobject
.ObjectG
;
99 public class Display
: ObjectG
102 /** the main Gtk struct */
103 protected GdkDisplay
* gdkDisplay
;
106 public GdkDisplay
* getDisplayStruct()
112 /** the main Gtk struct as a void* */
113 protected void* getStruct()
115 return cast(void*)gdkDisplay
;
119 * Sets our main struct and passes it to the parent class
121 public this (GdkDisplay
* gdkDisplay
)
125 if ( gdkDisplay
is null )
130 Stdout("struct gdkDisplay is null on constructor").newline
;
134 printf("struct gdkDisplay is null on constructor");
141 assert(gdkDisplay
!is null, "struct gdkDisplay is null on constructor");
143 super(cast(GObject
*)gdkDisplay
);
144 this.gdkDisplay
= gdkDisplay
;
150 // imports for the signal processing
151 private import gobject
.Signals
;
152 private import gtkc
.gdktypes
;
153 int[char[]] connectedSignals
;
155 void delegate(gboolean
, Display
)[] onClosedListeners
;
156 void addOnClosed(void delegate(gboolean
, Display
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
158 if ( !("closed" in connectedSignals
) )
163 cast(GCallback
)&callBackClosed
,
167 connectedSignals
["closed"] = 1;
169 onClosedListeners
~= dlg
;
171 extern(C
) static void callBackClosed(GdkDisplay
* displayStruct
, gboolean isError
, Display display
)
173 bool consumed
= false;
175 foreach ( void delegate(gboolean
, Display
) dlg
; display
.onClosedListeners
)
177 dlg(isError
, display
);
188 * the name of the display to open
190 * a GdkDisplay, or NULL if the display
191 * could not be opened.
194 public static Display
open(char[] displayName
)
196 // GdkDisplay* gdk_display_open (const gchar *display_name);
197 return new Display( gdk_display_open(Str
.toStringz(displayName
)) );
201 * Gets the default GdkDisplay. This is a convenience
203 * gdk_display_manager_get_default_display (gdk_display_manager_get ())
205 * a GdkDisplay, or NULL if there is no default
209 public static Display
getDefault()
211 // GdkDisplay* gdk_display_get_default (void);
212 return new Display( gdk_display_get_default() );
216 * Gets the name of the display.
220 * a string representing the display name. This string is owned
221 * by GDK and should not be modified or freed.
224 public char[] getName()
226 // const gchar* gdk_display_get_name (GdkDisplay *display);
227 return Str
.toString(gdk_display_get_name(gdkDisplay
) );
231 * Gets the number of screen managed by the display.
238 public int getNScreens()
240 // gint gdk_display_get_n_screens (GdkDisplay *display);
241 return gdk_display_get_n_screens(gdkDisplay
);
245 * Returns a screen object for one of the screens of the display.
251 * the GdkScreen object
254 public Screen
getScreen(int screenNum
)
256 // GdkScreen* gdk_display_get_screen (GdkDisplay *display, gint screen_num);
257 return new Screen( gdk_display_get_screen(gdkDisplay
, screenNum
) );
261 * Get the default GdkScreen for display.
265 * the default GdkScreen object for display
268 public Screen
getDefaultScreen()
270 // GdkScreen* gdk_display_get_default_screen (GdkDisplay *display);
271 return new Screen( gdk_display_get_default_screen(gdkDisplay
) );
275 * Release any pointer grab.
279 * a timestap (e.g. GDK_CURRENT_TIME).
282 public void pointerUngrab(uint time
)
284 // void gdk_display_pointer_ungrab (GdkDisplay *display, guint32 time_);
285 gdk_display_pointer_ungrab(gdkDisplay
, time
);
289 * Release any keyboard grab
293 * a timestap (e.g GDK_CURRENT_TIME).
296 public void keyboardUngrab(uint time
)
298 // void gdk_display_keyboard_ungrab (GdkDisplay *display, guint32 time_);
299 gdk_display_keyboard_ungrab(gdkDisplay
, time
);
303 * Test if the pointer is grabbed.
307 * TRUE if an active X pointer grab is in effect
310 public int pointerIsGrabbed()
312 // gboolean gdk_display_pointer_is_grabbed (GdkDisplay *display);
313 return gdk_display_pointer_is_grabbed(gdkDisplay
);
317 * Emits a short beep on display
324 // void gdk_display_beep (GdkDisplay *display);
325 gdk_display_beep(gdkDisplay
);
329 * Flushes any requests queued for the windowing system and waits until all
330 * requests have been handled. This is often used for making sure that the
331 * display is synchronized with the current state of the program. Calling
332 * gdk_display_sync() before gdk_error_trap_pop() makes sure that any errors
333 * generated from earlier requests are handled before the error trap is
335 * This is most useful for X11. On windowing systems where requests are
336 * handled synchronously, this function will do nothing.
343 // void gdk_display_sync (GdkDisplay *display);
344 gdk_display_sync(gdkDisplay
);
348 * Flushes any requests queued for the windowing system; this happens automatically
349 * when the main loop blocks waiting for new events, but if your application
350 * is drawing without returning control to the main loop, you may need
351 * to call this function explicitely. A common case where this function
352 * needs to be called is when an application is executing drawing commands
353 * from a thread other than the thread where the main loop is running.
354 * This is most useful for X11. On windowing systems where requests are
355 * handled synchronously, this function will do nothing.
362 // void gdk_display_flush (GdkDisplay *display);
363 gdk_display_flush(gdkDisplay
);
367 * Closes the connection to the windowing system for the given display,
368 * and cleans up associated resources.
375 // void gdk_display_close (GdkDisplay *display);
376 gdk_display_close(gdkDisplay
);
380 * Returns the list of available input devices attached to display.
381 * The list is statically allocated and should not be freed.
385 * a list of GdkDevice
388 public ListG
listDevices()
390 // GList* gdk_display_list_devices (GdkDisplay *display);
391 return new ListG( gdk_display_list_devices(gdkDisplay
) );
395 * Gets the next GdkEvent to be processed for display, fetching events from the
396 * windowing system if necessary.
400 * the next GdkEvent to be processed, or NULL if no events
401 * are pending. The returned GdkEvent should be freed with gdk_event_free().
404 public Event
getEvent()
406 // GdkEvent* gdk_display_get_event (GdkDisplay *display);
407 return new Event( gdk_display_get_event(gdkDisplay
) );
411 * Gets a copy of the first GdkEvent in the display's event queue, without
412 * removing the event from the queue. (Note that this function will
413 * not get more events from the windowing system. It only checks the events
414 * that have already been moved to the GDK event queue.)
418 * a copy of the first GdkEvent on the event queue, or NULL
419 * if no events are in the queue. The returned GdkEvent should be freed with
423 public Event
peekEvent()
425 // GdkEvent* gdk_display_peek_event (GdkDisplay *display);
426 return new Event( gdk_display_peek_event(gdkDisplay
) );
430 * Appends a copy of the given event onto the front of the event
438 public void putEvent(Event event
)
440 // void gdk_display_put_event (GdkDisplay *display, GdkEvent *event);
441 gdk_display_put_event(gdkDisplay
, (event
is null) ?
null : event
.getEventStruct());
445 * Adds a filter to be called when X ClientMessage events are received.
447 * a GdkDisplay for which this message filter applies
449 * the type of ClientMessage events to receive.
450 * This will be checked against the message_type field
451 * of the XClientMessage event struct.
453 * the function to call to process the event.
455 * user data to pass to func.
458 public void addClientMessageFilter(GdkAtom messageType
, GdkFilterFunc func
, void* data
)
460 // void gdk_display_add_client_message_filter (GdkDisplay *display, GdkAtom message_type, GdkFilterFunc func, gpointer data);
461 gdk_display_add_client_message_filter(gdkDisplay
, messageType
, func
, data
);
465 * Sets the double click time (two clicks within this time interval
466 * count as a double click and result in a GDK_2BUTTON_PRESS event).
467 * Applications should not set this, it is a global
468 * user-configured setting.
472 * double click time in milliseconds (thousandths of a second)
475 public void setDoubleClickTime(uint msec
)
477 // void gdk_display_set_double_click_time (GdkDisplay *display, guint msec);
478 gdk_display_set_double_click_time(gdkDisplay
, msec
);
482 * Sets the double click distance (two clicks within this distance
483 * count as a double click and result in a GDK_2BUTTON_PRESS event).
484 * See also gdk_display_set_double_click_time().
485 * Applications should not set this, it is a global
486 * user-configured setting.
493 public void setDoubleClickDistance(uint distance
)
495 // void gdk_display_set_double_click_distance (GdkDisplay *display, guint distance);
496 gdk_display_set_double_click_distance(gdkDisplay
, distance
);
500 * Gets the current location of the pointer and the current modifier
501 * mask for a given display.
505 * location to store the screen that the
506 * cursor is on, or NULL.
508 * location to store root window X coordinate of pointer, or NULL.
510 * location to store root window Y coordinate of pointer, or NULL.
512 * location to store current modifier mask, or NULL
515 public void getPointer(GdkScreen
** screen
, int* x
, int* y
, GdkModifierType
* mask
)
517 // void gdk_display_get_pointer (GdkDisplay *display, GdkScreen **screen, gint *x, gint *y, GdkModifierType *mask);
518 gdk_display_get_pointer(gdkDisplay
, screen
, x
, y
, mask
);
522 * Obtains the window underneath the mouse pointer, returning the location
523 * of that window in win_x, win_y for screen. Returns NULL if the window
524 * under the mouse pointer is not known to GDK (for example, belongs to
525 * another application).
529 * return location for origin of the window under the pointer
531 * return location for origin of the window under the pointer
533 * the window under the mouse pointer, or NULL
536 public Window
getWindowAtPointer(int* winX
, int* winY
)
538 // GdkWindow* gdk_display_get_window_at_pointer (GdkDisplay *display, gint *win_x, gint *win_y);
539 return new Window( gdk_display_get_window_at_pointer(gdkDisplay
, winX
, winY
) );
544 * This function allows for hooking into the operation
545 * of getting the current location of the pointer on a particular
546 * display. This is only useful for such low-level tools as an
547 * event recorder. Applications should never have any
548 * reason to use this facility.
552 * a table of pointers to functions for getting
553 * quantities related to the current pointer position,
554 * or NULL to restore the default table.
556 * the previous pointer hook table
559 public GdkDisplayPointerHooks
* setPointerHooks(GdkDisplayPointerHooks
* newHooks
)
561 // GdkDisplayPointerHooks* gdk_display_set_pointer_hooks (GdkDisplay *display, const GdkDisplayPointerHooks *new_hooks);
562 return gdk_display_set_pointer_hooks(gdkDisplay
, newHooks
);
566 * Warps the pointer of display to the point x,y on
567 * the screen screen, unless the pointer is confined
568 * to a window by a grab, in which case it will be moved
569 * as far as allowed by the grab. Warping the pointer
570 * creates events as if the user had moved the mouse
571 * instantaneously to the destination.
572 * Note that the pointer should normally be under the
573 * control of the user. This function was added to cover
574 * some rare use cases like keyboard navigation support
575 * for the color picker in the GtkColorSelectionDialog.
579 * the screen of display to warp the pointer to
581 * the x coordinate of the destination
583 * the y coordinate of the destination
586 public void warpPointer(Screen screen
, int x
, int y
)
588 // void gdk_display_warp_pointer (GdkDisplay *display, GdkScreen *screen, gint x, gint y);
589 gdk_display_warp_pointer(gdkDisplay
, (screen
is null) ?
null : screen
.getScreenStruct(), x
, y
);
593 * Returns TRUE if multicolored cursors are supported
594 * on display. Otherwise, cursors have only a forground
595 * and a background color.
599 * whether cursors can have multiple colors.
602 public int supportsCursorColor()
604 // gboolean gdk_display_supports_cursor_color (GdkDisplay *display);
605 return gdk_display_supports_cursor_color(gdkDisplay
);
609 * Returns TRUE if cursors can use an 8bit alpha channel
610 * on display. Otherwise, cursors are restricted to bilevel
611 * alpha (i.e. a mask).
615 * whether cursors can have alpha channels.
618 public int supportsCursorAlpha()
620 // gboolean gdk_display_supports_cursor_alpha (GdkDisplay *display);
621 return gdk_display_supports_cursor_alpha(gdkDisplay
);
625 * Returns the default size to use for cursors on display.
629 * the default cursor size.
632 public uint getDefaultCursorSize()
634 // guint gdk_display_get_default_cursor_size (GdkDisplay *display);
635 return gdk_display_get_default_cursor_size(gdkDisplay
);
639 * Gets the maximal size to use for cursors on display.
643 * the return location for the maximal cursor width
645 * the return location for the maximal cursor height
648 public void getMaximalCursorSize(uint* width
, uint* height
)
650 // void gdk_display_get_maximal_cursor_size (GdkDisplay *display, guint *width, guint *height);
651 gdk_display_get_maximal_cursor_size(gdkDisplay
, width
, height
);
655 * Returns the default group leader window for all toplevel windows
656 * on display. This window is implicitly created by GDK.
657 * See gdk_window_set_group().
661 * The default group leader window for display
664 public Window
getDefaultGroup()
666 // GdkWindow* gdk_display_get_default_group (GdkDisplay *display);
667 return new Window( gdk_display_get_default_group(gdkDisplay
) );
671 * Returns whether GdkEventOwnerChange events will be
672 * sent when the owner of a selection changes.
676 * whether GdkEventOwnerChange events will
680 public int supportsSelectionNotification()
682 // gboolean gdk_display_supports_selection_notification (GdkDisplay *display);
683 return gdk_display_supports_selection_notification(gdkDisplay
);
687 * Request GdkEventOwnerChange events for ownership changes
688 * of the selection named by the given atom.
692 * the GdkAtom naming the selection for which
693 * ownership change notification is requested
695 * whether GdkEventOwnerChange events will
699 public int requestSelectionNotification(GdkAtom selection
)
701 // gboolean gdk_display_request_selection_notification (GdkDisplay *display, GdkAtom selection);
702 return gdk_display_request_selection_notification(gdkDisplay
, selection
);
706 * Returns whether the speicifed display supports clipboard
707 * persistance; i.e. if it's possible to store the clipboard data after an
708 * application has quit. On X11 this checks if a clipboard daemon is
713 * TRUE if the display supports clipboard persistance.
716 public int supportsClipboardPersistence()
718 // gboolean gdk_display_supports_clipboard_persistence (GdkDisplay *display);
719 return gdk_display_supports_clipboard_persistence(gdkDisplay
);
723 * Issues a request to the clipboard manager to store the
724 * clipboard data. On X11, this is a special program that works
725 * according to the freedesktop clipboard specification, available at
726 * http://www.freedesktop.org/Standards/clipboard-manager-spec.
730 * a GdkWindow belonging to the clipboard owner
734 * an array of targets that should be saved, or NULL
735 * if all available targets should be saved.
737 * length of the targets array
740 public void storeClipboard(Window clipboardWindow
, uint time
, GdkAtom
* targets
, int nTargets
)
742 // void gdk_display_store_clipboard (GdkDisplay *display, GdkWindow *clipboard_window, guint32 time_, GdkAtom *targets, gint n_targets);
743 gdk_display_store_clipboard(gdkDisplay
, (clipboardWindow
is null) ?
null : clipboardWindow
.getWindowStruct(), time
, targets
, nTargets
);
747 * Returns TRUE if gdk_window_shape_combine_mask() can
748 * be used to create shaped windows on display.
752 * TRUE if shaped windows are supported
755 public int supportsShapes()
757 // gboolean gdk_display_supports_shapes (GdkDisplay *display);
758 return gdk_display_supports_shapes(gdkDisplay
);
762 * Returns TRUE if gdk_window_input_shape_combine_mask() can
763 * be used to modify the input shape of windows on display.
767 * TRUE if windows with modified input shape are supported
770 * The "closed" signal
771 * void user_function (GdkDisplay *display,
773 * gpointer user_data) : Run Last
774 * The ::closed signal is emitted when the connection to the windowing
775 * system for display is closed.
777 * the object on which the signal is emitted
779 * TRUE if the display was closed due to an error
781 * user data set when the signal handler was connected.
784 public int supportsInputShapes()
786 // gboolean gdk_display_supports_input_shapes (GdkDisplay *display);
787 return gdk_display_supports_input_shapes(gdkDisplay
);