[gtk+] x11: Bring back fullscreen-on-all-monitors support
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] x11: Bring back fullscreen-on-all-monitors support
- Date: Thu, 28 Apr 2016 03:19:19 +0000 (UTC)
commit 5c1d0915afd1e1e5a84523da7a9597f9ad68df99
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Apr 27 23:08:25 2016 -0400
x11: Bring back fullscreen-on-all-monitors support
It is unfortunate the EWMH requires Xinerama here - lets do this
without the caching that was previously there, I don't think it is
needed.
gdk/x11/gdkscreen-x11.c | 45 +++++++++++++++++++++++++++++++++------------
gdk/x11/gdkwindow-x11.c | 14 ++++++--------
2 files changed, 39 insertions(+), 20 deletions(-)
---
diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c
index 7dfe373..3e608bf 100644
--- a/gdk/x11/gdkscreen-x11.c
+++ b/gdk/x11/gdkscreen-x11.c
@@ -34,6 +34,10 @@
#include <X11/Xatom.h>
+#ifdef HAVE_XFREE_XINERAMA
+#include <X11/extensions/Xinerama.h>
+#endif
+
#ifdef HAVE_RANDR
#include <X11/extensions/Xrandr.h>
#endif
@@ -1071,35 +1075,52 @@ _gdk_x11_screen_get_edge_monitors (GdkScreen *screen,
gint bottom_most_pos = 0;
gint right_most_pos = 0;
gint i;
+#ifdef HAVE_XFREE_XINERAMA
+ XineramaScreenInfo *x_monitors;
+ int x_n_monitors;
+#endif
+
+ *top = *bottom = *left = *right = -1;
+
+#ifdef HAVE_XFREE_XINERAMA
+ if (!XineramaIsActive (x11_screen->xdisplay))
+ return;
- for (i = 0; i < x11_screen->monitors->len; i++)
+ x_monitors = XineramaQueryScreens (x11_screen->xdisplay, &x_n_monitors);
+ if (x_n_monitors <= 0 || x_monitors == NULL)
{
- GdkMonitor *monitor = x11_screen->monitors->pdata[i];
- GdkRectangle geometry;
+ if (x_monitors)
+ XFree (x_monitors);
- gdk_monitor_get_geometry (monitor, &geometry);
+ return;
+ }
- if (left && left_most_pos > geometry.x)
+ for (i = 0; i < x_n_monitors; i++)
+ {
+ if (left && left_most_pos > x_monitors[i].x_org)
{
- left_most_pos = geometry.x;
+ left_most_pos = x_monitors[i].x_org;
*left = i;
}
- if (right && right_most_pos < geometry.x + geometry.width)
+ if (right && right_most_pos < x_monitors[i].x_org + x_monitors[i].width)
{
- right_most_pos = geometry.x + geometry.width;
+ right_most_pos = x_monitors[i].x_org + x_monitors[i].width;
*right = i;
}
- if (top && top_most_pos > geometry.y)
+ if (top && top_most_pos > x_monitors[i].y_org)
{
- top_most_pos = geometry.y;
+ top_most_pos = x_monitors[i].y_org;
*top = i;
}
- if (bottom && bottom_most_pos < geometry.y + geometry.height)
+ if (bottom && bottom_most_pos < x_monitors[i].y_org + x_monitors[i].height)
{
- bottom_most_pos = geometry.y + geometry.height;
+ bottom_most_pos = x_monitors[i].y_org + x_monitors[i].height;
*bottom = i;
}
}
+
+ XFree (x_monitors);
+#endif
}
void
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index 3aa4038..fe311a7 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -4167,7 +4167,7 @@ gdk_x11_window_apply_fullscreen_mode (GdkWindow *window)
if (GDK_WINDOW_IS_MAPPED (window))
{
XClientMessageEvent xclient;
- gint gdk_monitors[4];
+ gint monitors[4];
gint i;
memset (&xclient, 0, sizeof (xclient));
@@ -4208,16 +4208,14 @@ gdk_x11_window_apply_fullscreen_mode (GdkWindow *window)
case GDK_FULLSCREEN_ON_ALL_MONITORS:
_gdk_x11_screen_get_edge_monitors (GDK_WINDOW_SCREEN (window),
- &gdk_monitors[0],
- &gdk_monitors[1],
- &gdk_monitors[2],
- &gdk_monitors[3]);
+ &monitors[0],
+ &monitors[1],
+ &monitors[2],
+ &monitors[3]);
/* Translate all 4 monitors from the GDK set into XINERAMA indices */
for (i = 0; i < 4; ++i)
{
- /* FIXME
- xclient.data.l[i] = _gdk_x11_screen_ge_xinerama_index (GDK_WINDOW_SCREEN (window),
gdk_monitors[i]); */
- xclient.data.l[i] = 0;
+ xclient.data.l[i] = monitors[i];
/* Sanity check, if XINERAMA is not available, we could have invalid
* negative values for the XINERAMA indices.
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]