summaryrefslogtreecommitdiff
path: root/gdk/gdkscreen.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2011-12-18 14:02:55 -0500
committerMatthias Clasen <mclasen@redhat.com>2011-12-18 14:29:16 -0500
commitc6df2828b7ca6b65b7ab3c328ebb96bd78c087ee (patch)
tree19922b74f44281c5d4ec3733437523d6b0340e11 /gdk/gdkscreen.c
parent74cff292d505f8855e78ab0fc37c6ff380d447ca (diff)
downloadgtk+-c6df2828b7ca6b65b7ab3c328ebb96bd78c087ee.tar.gz
Add gdk_screen_get_monitor_workarea
The function returns the part of a monitors area that should be used for positioning popups, menus, etc. The only non-trivial implementation atm is in the X backend, all the other backends just return the full monitor area. The X implementation is currently suboptimal, since it requires roundtrips to collect the necessary information. It should be changed to monitor the properties for changes, when XFixes allows to monitor individual properties. https://bugzilla.gnome.org/show_bug.cgi?id=641999
Diffstat (limited to 'gdk/gdkscreen.c')
-rw-r--r--gdk/gdkscreen.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/gdk/gdkscreen.c b/gdk/gdkscreen.c
index c1de0f64e9..9493e168ff 100644
--- a/gdk/gdkscreen.c
+++ b/gdk/gdkscreen.c
@@ -750,12 +750,16 @@ gdk_screen_get_monitor_plug_name (GdkScreen *screen,
/**
* gdk_screen_get_monitor_geometry:
* @screen: a #GdkScreen
- * @monitor_num: the monitor number, between 0 and gdk_screen_get_n_monitors (screen)
- * @dest: (out) (allow-none): a #GdkRectangle to be filled with the monitor geometry
+ * @monitor_num: the monitor number
+ * @dest: (out) (allow-none): a #GdkRectangle to be filled with
+ * the monitor geometry
*
* Retrieves the #GdkRectangle representing the size and position of
* the individual monitor within the entire screen area.
*
+ * Monitor numbers start at 0. To obtain the number of monitors of
+ * @screen, use gdk_screen_get_n_monitors().
+ *
* Note that the size of the entire screen area can be retrieved via
* gdk_screen_get_width() and gdk_screen_get_height().
*
@@ -770,6 +774,33 @@ gdk_screen_get_monitor_geometry (GdkScreen *screen,
}
/**
+ * gdk_screen_get_monitor_workarea:
+ * @screen: a #GdkScreen
+ * @monitor_num: the monitor number
+ * @dest: (out) (allow-none): a #GdkRectangle to be filled with
+ * the monitor workarea
+ *
+ * Retrieves the #GdkRectangle representing the size and position of
+ * the "work area" on a monitor within the entire screen area.
+ *
+ * The work area should be considered when positioning menus and
+ * similar popups, to avoid placing them below panels, docks or other
+ * desktop components.
+ *
+ * Monitor numbers start at 0. To obtain the number of monitors of
+ * @screen, use gdk_screen_get_n_monitors().
+ *
+ * Since: 3.4
+ */
+void
+gdk_screen_get_monitor_workarea (GdkScreen *screen,
+ gint monitor_num,
+ GdkRectangle *dest)
+{
+ GDK_SCREEN_GET_CLASS(screen)->get_monitor_workarea (screen, monitor_num, dest);
+}
+
+/**
* gdk_screen_list_visuals:
* @screen: the relevant #GdkScreen.
*