Commit 5c1d0915 authored by Matthias Clasen's avatar Matthias Clasen

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.
parent d92fda21
......@@ -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
......
......@@ -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.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment