Skip to content
Snippets Groups Projects
Commit 0c7bc537 authored by Olivier Fourdan's avatar Olivier Fourdan :tools:
Browse files

screen: Fix broken monitor index

Bug: 13608

Commit 58955779 (Use ximerama indices for _NET_WM_FULLSCREEN_MONITORS)
introduced a regression because the monitor index was wrongly compared
against the total number of monitors, which would falsely assume that
the Xrandr query failed whereas it actually worked.

Fix the false comparison and also use the screen size as fallback values
in case the Xrandr really failed so that we don't end up using random
uninitialized values.
parent b393814d
No related branches found
No related tags found
No related merge requests found
......@@ -828,9 +828,17 @@ myScreenGetXineramaMonitorGeometry (ScreenInfo *screen_info, gint monitor_num, G
g_return_if_fail (XineramaIsActive (myScreenGetXDisplay (screen_info)));
infos = XineramaQueryScreens (myScreenGetXDisplay (screen_info), &n);
if (infos == NULL || n <= 0 || monitor_num < n || monitor_num > n)
if (infos == NULL || n <= 0 || monitor_num > n)
{
g_warning ("Cannot query Xinerama!");
XFree (infos);
/* Using screen size as fallback, safer than some random values */
rect->x = 0;
rect->y = 0;
rect->width = screen_info->width;
rect->height = screen_info->height;
return;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment