2 * This file is part of duit.
4 * duit 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 * duit 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 duit; 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 = GdkScreen.html
44 * - cairoLib.cairoLibtypes
58 * - GdkColormap* -> Colormap
59 * - GdkDisplay* -> Display
60 * - GdkEvent* -> Event
61 * - GdkRectangle* -> Rectangle
62 * - GdkScreen* -> Screen
63 * - GdkVisual* -> Visual
64 * - GdkWindow* -> Window
70 private import gdk
.gdktypes
;
72 private import lib
.gdk
;
74 private import cairoLib
.cairoLibtypes
;
75 private import glib
.Str
;
76 private import gdk
.Screen
;
77 private import gdk
.Colormap
;
78 private import gdk
.Visual
;
79 private import gdk
.Window
;
80 private import gdk
.Display
;
81 private import glib
.ListG
;
82 private import gdk
.Rectangle
;
83 private import gdk
.Event
;
84 private import gobject
.Value
;
88 * GdkScreen objects are the GDK representation of a physical screen. It is used
89 * throughout GDK and GTK+ to specify which screen the top level windows
90 * are to be displayed on.
91 * It is also used to query the screen specification and default settings such as
92 * the default colormap (gdk_screen_get_default_colormap()),
93 * the screen width (gdk_screen_get_width()), etc.
94 * Note that a screen may consist of multiple monitors which are merged to
95 * form a large screen area.
97 private import gobject
.ObjectG
;
98 public class Screen
: ObjectG
101 /** the main Gtk struct */
102 protected GdkScreen
* gdkScreen
;
105 public GdkScreen
* getScreenStruct()
111 /** the main Gtk struct as a void* */
112 protected void* getStruct()
114 return cast(void*)gdkScreen
;
118 * Sets our main struct and passes it to the parent class
120 public this (GdkScreen
* gdkScreen
)
122 super(cast(GObject
*)gdkScreen
);
123 this.gdkScreen
= gdkScreen
;
129 // imports for the signal processing
130 private import gobject
.Signals
;
131 private import gdk
.gdktypes
;
132 int[char[]] connectedSignals
;
134 void delegate(Screen
)[] onCompositedChangedListeners
;
135 void addOnCompositedChanged(void delegate(Screen
) dlg
)
137 if ( !("composited-changed" in connectedSignals
) )
141 "composited-changed",
142 cast(GCallback
)&callBackCompositedChanged
,
145 cast(ConnectFlags
)0);
146 connectedSignals
["composited-changed"] = 1;
148 onCompositedChangedListeners
~= dlg
;
150 extern(C
) static void callBackCompositedChanged(GdkScreen
* screenStruct
, Screen screen
)
152 bit consumed
= false;
154 foreach ( void delegate(Screen
) dlg
; screen
.onCompositedChangedListeners
)
162 void delegate(Screen
)[] onSizeChangedListeners
;
163 void addOnSizeChanged(void delegate(Screen
) dlg
)
165 if ( !("size-changed" in connectedSignals
) )
170 cast(GCallback
)&callBackSizeChanged
,
173 cast(ConnectFlags
)0);
174 connectedSignals
["size-changed"] = 1;
176 onSizeChangedListeners
~= dlg
;
178 extern(C
) static void callBackSizeChanged(GdkScreen
* screenStruct
, Screen screen
)
180 bit consumed
= false;
182 foreach ( void delegate(Screen
) dlg
; screen
.onSizeChangedListeners
)
193 * Gets the default screen for the default display. (See
194 * gdk_display_get_default()).
196 * a GdkScreen, or NULL if there is no default display.
199 public static Screen
getDefault()
201 // GdkScreen* gdk_screen_get_default (void);
202 return new Screen( gdk_screen_get_default() );
206 * Gets the default colormap for screen.
210 * the default GdkColormap.
213 public Colormap
getDefaultColormap()
215 // GdkColormap* gdk_screen_get_default_colormap (GdkScreen *screen);
216 return new Colormap( gdk_screen_get_default_colormap(gdkScreen
) );
220 * Sets the default colormap for screen.
227 public void setDefaultColormap(Colormap colormap
)
229 // void gdk_screen_set_default_colormap (GdkScreen *screen, GdkColormap *colormap);
230 gdk_screen_set_default_colormap(gdkScreen
, (colormap
is null) ?
null : colormap
.getColormapStruct());
234 * Gets the system's default colormap for screen
238 * the default colormap for screen.
241 public Colormap
getSystemColormap()
243 // GdkColormap* gdk_screen_get_system_colormap (GdkScreen *screen);
244 return new Colormap( gdk_screen_get_system_colormap(gdkScreen
) );
248 * Get the system's default visual for screen.
249 * This is the visual for the root window of the display.
250 * The return value should not be freed.
257 public Visual
getSystemVisual()
259 // GdkVisual* gdk_screen_get_system_visual (GdkScreen *screen);
260 return new Visual( gdk_screen_get_system_visual(gdkScreen
) );
264 * Gets the preferred colormap for rendering image data on screen.
265 * Not a very useful function; historically, GDK could only render RGB
266 * image data to one colormap and visual, but in the current version
267 * it can render to any colormap and visual. So there's no need to
268 * call this function.
272 * the preferred colormap
275 public Colormap
getRgbColormap()
277 // GdkColormap* gdk_screen_get_rgb_colormap (GdkScreen *screen);
278 return new Colormap( gdk_screen_get_rgb_colormap(gdkScreen
) );
282 * Gets a "preferred visual" chosen by GdkRGB for rendering image data
283 * on screen. In previous versions of
284 * GDK, this was the only visual GdkRGB could use for rendering. In
285 * current versions, it's simply the visual GdkRGB would have chosen as
286 * the optimal one in those previous versions. GdkRGB can now render to
287 * drawables with any visual.
291 * The GdkVisual chosen by GdkRGB.
294 public Visual
getRgbVisual()
296 // GdkVisual* gdk_screen_get_rgb_visual (GdkScreen *screen);
297 return new Visual( gdk_screen_get_rgb_visual(gdkScreen
) );
301 * Gets a colormap to use for creating windows or pixmaps with an
302 * alpha channel. The windowing system on which GTK+ is running
303 * may not support this capability, in which case NULL will
304 * be returned. Even if a non-NULL value is returned, its
305 * possible that the window's alpha channel won't be honored
306 * when displaying the window on the screen: in particular, for
307 * X an appropriate windowing manager and compositing manager
308 * must be running to provide appropriate display.
312 * a colormap to use for windows with an alpha channel
313 * or NULL if the capability is not available.
316 public Colormap
getRgbaColormap()
318 // GdkColormap* gdk_screen_get_rgba_colormap (GdkScreen *screen);
319 return new Colormap( gdk_screen_get_rgba_colormap(gdkScreen
) );
323 * Gets a visual to use for creating windows or pixmaps with an
324 * alpha channel. See the docs for gdk_screen_get_rgba_colormap()
329 * a visual to use for windows with an alpha channel
330 * or NULL if the capability is not available.
333 public Visual
getRgbaVisual()
335 // GdkVisual* gdk_screen_get_rgba_visual (GdkScreen *screen);
336 return new Visual( gdk_screen_get_rgba_visual(gdkScreen
) );
340 * Returns whether windows with an RGBA visual can reasonably
341 * be expected to have their alpha channel drawn correctly on
343 * On X11 this function returns whether a compositing manager is
344 * compositing screen.
348 * Whether windows with RGBA visuals can reasonably be
349 * expected to have their alpha channels drawn correctly on the screen.
352 public int isComposited()
354 // gboolean gdk_screen_is_composited (GdkScreen *screen);
355 return gdk_screen_is_composited(gdkScreen
);
359 * Gets the root window of screen.
366 public Window
getRootWindow()
368 // GdkWindow* gdk_screen_get_root_window (GdkScreen *screen);
369 return new Window( gdk_screen_get_root_window(gdkScreen
) );
373 * Gets the display to which the screen belongs.
377 * the display to which screen belongs
380 public Display
getDisplay()
382 // GdkDisplay* gdk_screen_get_display (GdkScreen *screen);
383 return new Display( gdk_screen_get_display(gdkScreen
) );
387 * Gets the index of screen among the screens in the display
388 * to which it belongs. (See gdk_screen_get_display())
395 public int getNumber()
397 // gint gdk_screen_get_number (GdkScreen *screen);
398 return gdk_screen_get_number(gdkScreen
);
402 * Gets the width of screen in pixels
406 * the width of screen in pixels.
409 public int getWidth()
411 // gint gdk_screen_get_width (GdkScreen *screen);
412 return gdk_screen_get_width(gdkScreen
);
416 * Gets the height of screen in pixels
420 * the height of screen in pixels.
423 public int getHeight()
425 // gint gdk_screen_get_height (GdkScreen *screen);
426 return gdk_screen_get_height(gdkScreen
);
430 * Gets the width of screen in millimeters.
431 * Note that on some X servers this value will not be correct.
435 * the width of screen in millimeters.
438 public int getWidthMm()
440 // gint gdk_screen_get_width_mm (GdkScreen *screen);
441 return gdk_screen_get_width_mm(gdkScreen
);
445 * Returns the height of screen in millimeters.
446 * Note that on some X servers this value will not be correct.
450 * the heigth of screen in millimeters.
453 public int getHeightMm()
455 // gint gdk_screen_get_height_mm (GdkScreen *screen);
456 return gdk_screen_get_height_mm(gdkScreen
);
460 * Lists the available visuals for the specified screen.
461 * A visual describes a hardware image data format.
462 * For example, a visual might support 24-bit color, or 8-bit color,
463 * and might expect pixels to be in a certain format.
464 * Call g_list_free() on the return value when you're finished with it.
466 * the relevant GdkScreen.
468 * a list of visuals; the list must be freed, but not its
472 public ListG
listVisuals()
474 // GList* gdk_screen_list_visuals (GdkScreen *screen);
475 return new ListG( gdk_screen_list_visuals(gdkScreen
) );
479 * Obtains a list of all toplevel windows known to GDK on the screen screen.
480 * A toplevel window is a child of the root window (see
481 * gdk_get_default_root_window()).
482 * The returned list should be freed with g_list_free(), but
483 * its elements need not be freed.
485 * The GdkScreen where the toplevels are located.
487 * list of toplevel windows, free with g_list_free()
490 public ListG
getToplevelWindows()
492 // GList* gdk_screen_get_toplevel_windows (GdkScreen *screen);
493 return new ListG( gdk_screen_get_toplevel_windows(gdkScreen
) );
497 * Determines the name to pass to gdk_display_open() to get
498 * a GdkDisplay with this screen as the default screen.
502 * a newly allocated string, free with g_free()
505 public char[] makeDisplayName()
507 // gchar* gdk_screen_make_display_name (GdkScreen *screen);
508 return Str
.toString(gdk_screen_make_display_name(gdkScreen
) );
512 * Returns the number of monitors which screen consists of.
516 * number of monitors which screen consists of.
519 public int getNMonitors()
521 // gint gdk_screen_get_n_monitors (GdkScreen *screen);
522 return gdk_screen_get_n_monitors(gdkScreen
);
526 * Retrieves the GdkRectangle representing the size and position of
527 * the individual monitor within the entire screen area.
528 * Note that the size of the entire screen area can be retrieved via
529 * gdk_screen_get_width() and gdk_screen_get_height().
533 * the monitor number.
535 * a GdkRectangle to be filled with the monitor geometry
538 public void getMonitorGeometry(int monitorNum
, Rectangle dest
)
540 // void gdk_screen_get_monitor_geometry (GdkScreen *screen, gint monitor_num, GdkRectangle *dest);
541 gdk_screen_get_monitor_geometry(gdkScreen
, monitorNum
, (dest
is null) ?
null : dest
.getRectangleStruct());
545 * Returns the monitor number in which the point (x,y) is located.
549 * the x coordinate in the virtual screen.
551 * the y coordinate in the virtual screen.
553 * the monitor number in which the point (x,y) lies, or
554 * a monitor close to (x,y) if the point is not in any monitor.
557 public int getMonitorAtPoint(int x
, int y
)
559 // gint gdk_screen_get_monitor_at_point (GdkScreen *screen, gint x, gint y);
560 return gdk_screen_get_monitor_at_point(gdkScreen
, x
, y
);
564 * Returns the number of the monitor in which the largest area of the
565 * bounding rectangle of window resides.
571 * the monitor number in which most of window is located,
572 * or if window does not intersect any monitors, a monitor,
576 public int getMonitorAtWindow(Window window
)
578 // gint gdk_screen_get_monitor_at_window (GdkScreen *screen, GdkWindow *window);
579 return gdk_screen_get_monitor_at_window(gdkScreen
, (window
is null) ?
null : window
.getWindowStruct());
583 * On X11, sends an X ClientMessage event to all toplevel windows on
585 * Toplevel windows are determined by checking for the WM_STATE property,
586 * as described in the Inter-Client Communication Conventions Manual (ICCCM).
587 * If no windows are found with the WM_STATE property set, the message is
588 * sent to all children of the root window.
589 * On Windows, broadcasts a message registered with the name
590 * GDK_WIN32_CLIENT_MESSAGE to all top-level windows. The amount of
591 * data is limited to one long, i.e. four bytes.
593 * the GdkScreen where the event will be broadcasted.
598 public void broadcastClientMessage(Event event
)
600 // void gdk_screen_broadcast_client_message (GdkScreen *screen, GdkEvent *event);
601 gdk_screen_broadcast_client_message(gdkScreen
, (event
is null) ?
null : event
.getEventStruct());
605 * Retrieves a desktop-wide setting such as double-click time
606 * for the GdkScreen screen.
607 * FIXME needs a list of valid settings here, or a link to
610 * the GdkScreen where the setting is located
612 * the name of the setting
614 * location to store the value of the setting
616 * TRUE if the setting existed and a value was stored
617 * in value, FALSE otherwise.
620 public int getSetting(char[] name
, Value value
)
622 // gboolean gdk_screen_get_setting (GdkScreen *screen, const gchar *name, GValue *value);
623 return gdk_screen_get_setting(gdkScreen
, Str
.toStringz(name
), (value
is null) ?
null : value
.getValueStruct());
627 * Gets any options previously set with gdk_screen_set_font_options().
631 * the current font options, or NULL if no default
632 * font options have been set.
635 public cairo_font_options_t
* getFontOptions()
637 // const cairo_font_options_t* gdk_screen_get_font_options (GdkScreen *screen);
638 return gdk_screen_get_font_options(gdkScreen
);
642 * Sets the default font options for the screen. These
643 * options will be set on any PangoContext's newly created
644 * with gdk_pango_context_get_for_screen(). Changing the
645 * default set of font options does not affect contexts that
646 * have already been created.
650 * a cairo_font_options_t, or NULL to unset any
651 * previously set default font options.
654 public void setFontOptions(cairo_font_options_t
* options
)
656 // void gdk_screen_set_font_options (GdkScreen *screen, const cairo_font_options_t *options);
657 gdk_screen_set_font_options(gdkScreen
, options
);
661 * Gets the resolution for font handling on the screen; see
662 * gdk_screen_set_resolution() for full details.
666 * the current resolution, or -1 if no resolution
670 public double getResolution()
672 // gdouble gdk_screen_get_resolution (GdkScreen *screen);
673 return gdk_screen_get_resolution(gdkScreen
);
677 * Sets the resolution for font handling on the screen. This is a
678 * scale factor between points specified in a PangoFontDescription
679 * and cairo units. The default value is 96, meaning that a 10 point
680 * font will be 13 units high. (10 * 96. / 72. = 13.3).
684 * the resolution in "dots per inch". (Physical inches aren't actually
685 * involved; the terminology is conventional.)
688 public void setResolution(double dpi
)
690 // void gdk_screen_set_resolution (GdkScreen *screen, gdouble dpi);
691 gdk_screen_set_resolution(gdkScreen
, dpi
);
695 * Returns the screen's currently active window.
696 * On X11, this is done by inspecting the _NET_ACTIVE_WINDOW property
697 * on the root window, as described in the Extended Window
698 * Manager Hints. If there is no currently currently active
699 * window, or the window manager does not support the
700 * _NET_ACTIVE_WINDOW hint, this function returns NULL.
701 * On other platforms, this function may return NULL, depending on whether
702 * it is implementable on that platform.
703 * The returned window should be unrefed using g_object_unref() when
708 * the currently active window, or NULL.
711 public Window
getActiveWindow()
713 // GdkWindow* gdk_screen_get_active_window (GdkScreen *screen);
714 return new Window( gdk_screen_get_active_window(gdkScreen
) );
718 * Returns a GList of GdkWindows representing the current
720 * On X11, this is done by inspecting the _NET_CLIENT_LIST_STACKING
721 * property on the root window, as described in the Extended Window
722 * Manager Hints. If the window manager does not support the
723 * _NET_CLIENT_LIST_STACKING hint, this function returns NULL.
724 * On other platforms, this function may return NULL, depending on whether
725 * it is implementable on that platform.
726 * The returned list is newly allocated and owns references to the
727 * windows it contains, so it should be freed using g_list_free() and
728 * its windows unrefed using g_object_unref() when no longer needed.
732 * a list of GdkWindows for the current window stack,
736 public ListG
getWindowStack()
738 // GList* gdk_screen_get_window_stack (GdkScreen *screen);
739 return new ListG( gdk_screen_get_window_stack(gdkScreen
) );
743 * Like g_spawn_async(), except the child process is spawned in such
744 * an environment that on calling gdk_display_open() it would be
745 * returned a GdkDisplay with screen as the default screen.
746 * This is useful for applications which wish to launch an application
747 * on a specific screen.
751 * child's current working directory, or NULL to
754 * child's argument vector
756 * child's environment, or NULL to inherit parent's
758 * flags from GSpawnFlags
760 * function to run in the child just before exec()
762 * user data for child_setup
764 * return location for child process ID, or NULL
766 * return location for error
768 * TRUE on success, FALSE if error is set
771 public int gdkSpawnOnScreen(char[] workingDirectory
, char** argv
, char** envp
, GSpawnFlags flags
, GSpawnChildSetupFunc childSetup
, void* userData
, int* childPid
, GError
** error
)
773 // gboolean gdk_spawn_on_screen (GdkScreen *screen, const gchar *working_directory, gchar **argv, gchar **envp, GSpawnFlags flags, GSpawnChildSetupFunc child_setup, gpointer user_data, gint *child_pid, GError **error);
774 return gdk_spawn_on_screen(gdkScreen
, Str
.toStringz(workingDirectory
), argv
, envp
, flags
, childSetup
, userData
, childPid
, error
);
778 * Like g_spawn_async_with_pipes(), except the child process is
779 * spawned in such an environment that on calling gdk_display_open()
780 * it would be returned a GdkDisplay with screen as the default
782 * This is useful for applications which wish to launch an application
783 * on a specific screen.
787 * child's current working directory, or NULL to
790 * child's argument vector
792 * child's environment, or NULL to inherit parent's
794 * flags from GSpawnFlags
796 * function to run in the child just before exec()
798 * user data for child_setup
800 * return location for child process ID, or NULL
802 * return location for file descriptor to write to
803 * child's stdin, or NULL
805 * return location for file descriptor to read child's
808 * return location for file descriptor to read child's
811 * return location for error
813 * TRUE on success, FALSE if an error was set
816 public int gdkSpawnOnScreenWithPipes(char[] workingDirectory
, char** argv
, char** envp
, GSpawnFlags flags
, GSpawnChildSetupFunc childSetup
, void* userData
, int* childPid
, int* standardInput
, int* standardOutput
, int* standardError
, GError
** error
)
818 // gboolean gdk_spawn_on_screen_with_pipes (GdkScreen *screen, const gchar *working_directory, gchar **argv, gchar **envp, GSpawnFlags flags, GSpawnChildSetupFunc child_setup, gpointer user_data, gint *child_pid, gint *standard_input, gint *standard_output, gint *standard_error, GError **error);
819 return gdk_spawn_on_screen_with_pipes(gdkScreen
, Str
.toStringz(workingDirectory
), argv
, envp
, flags
, childSetup
, userData
, childPid
, standardInput
, standardOutput
, standardError
, error
);
823 * Like g_spawn_command_line_async(), except the child process is
824 * spawned in such an environment that on calling gdk_display_open()
825 * it would be returned a GdkDisplay with screen as the default
827 * This is useful for applications which wish to launch an application
828 * on a specific screen.
834 * return location for errors
836 * TRUE on success, FALSE if error is set.
839 * The "font-options" property
840 * "font-options" gpointer : Read / Write
841 * The default font options for the screen.
843 public int gdkSpawnCommandLineOnScreen(char[] commandLine
, GError
** error
)
845 // gboolean gdk_spawn_command_line_on_screen (GdkScreen *screen, const gchar *command_line, GError **error);
846 return gdk_spawn_command_line_on_screen(gdkScreen
, Str
.toStringz(commandLine
), error
);