[gtk+/wip/matthiasc/monitor] x11: Implement workarea vfunc
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/matthiasc/monitor] x11: Implement workarea vfunc
- Date: Mon, 4 Apr 2016 00:02:49 +0000 (UTC)
commit ab7698709938869268a38500ad6667a456a09498
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Apr 3 20:01:58 2016 -0400
x11: Implement workarea vfunc
gdk/x11/gdkscreen-x11.c | 35 +++++++++++++++++++++++++++++++----
1 files changed, 31 insertions(+), 4 deletions(-)
---
diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c
index 6d7a8b2..a022213 100644
--- a/gdk/x11/gdkscreen-x11.c
+++ b/gdk/x11/gdkscreen-x11.c
@@ -50,6 +50,9 @@ static void gdk_x11_screen_dispose (GObject *object);
static void gdk_x11_screen_finalize (GObject *object);
static void init_randr_support (GdkScreen *screen);
+static void gdk_x11_monitor_get_workarea (GdkMonitor *monitor,
+ GdkRectangle *workarea);
+
enum
{
WINDOW_MANAGER_CHANGED,
@@ -90,6 +93,7 @@ gdk_x11_monitor_init (GdkX11Monitor *monitor)
static void
gdk_x11_monitor_class_init (GdkX11MonitorClass *class)
{
+ GDK_MONITOR_CLASS (class)->get_workarea = gdk_x11_monitor_get_workarea;
}
static void
@@ -335,9 +339,9 @@ out:
}
static gboolean
-gdk_x11_screen_monitor_has_fullscreen_window (GdkScreen *screen,
- gint monitor)
+gdk_monitor_has_fullscreen_window (GdkMonitor *monitor)
{
+ GdkScreen *screen = gdk_display_get_default_screen (monitor->display);
GList *toplevels, *l;
GdkWindow *window;
gboolean has_fullscreen;
@@ -345,7 +349,6 @@ gdk_x11_screen_monitor_has_fullscreen_window (GdkScreen *screen,
toplevels = gdk_screen_get_toplevel_windows (screen);
has_fullscreen = FALSE;
-
for (l = toplevels; l; l = l->next)
{
window = l->data;
@@ -354,7 +357,7 @@ gdk_x11_screen_monitor_has_fullscreen_window (GdkScreen *screen,
continue;
if (gdk_window_get_fullscreen_mode (window) == GDK_FULLSCREEN_ON_ALL_MONITORS ||
- gdk_screen_get_monitor_at_window (screen, window) == monitor)
+ gdk_display_get_monitor_at_window (monitor->display, window) == monitor)
{
has_fullscreen = TRUE;
break;
@@ -366,6 +369,30 @@ gdk_x11_screen_monitor_has_fullscreen_window (GdkScreen *screen,
return has_fullscreen;
}
+static void
+gdk_x11_monitor_get_workarea (GdkMonitor *monitor,
+ GdkRectangle *dest)
+{
+ GdkScreen *screen = gdk_display_get_default_screen (monitor->display);
+ GdkRectangle workarea;
+
+ gdk_monitor_get_geometry (monitor, dest);
+
+ /* The EWMH constrains workarea to be a rectangle, so it
+ * can't adequately deal with L-shaped monitor arrangements.
+ * As a workaround, we ignore the workarea for anything
+ * but the primary monitor. Since that is where the 'desktop
+ * chrome' usually lives, this works ok in practice.
+ */
+ if (gdk_monitor_is_primary (monitor) &&
+ !gdk_monitor_has_fullscreen_window (monitor))
+ {
+ get_work_area (screen, &workarea);
+ if (gdk_rectangle_intersect (dest, &workarea, &workarea))
+ *dest = workarea;
+ }
+}
+
static GdkVisual *
gdk_x11_screen_get_rgba_visual (GdkScreen *screen)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]