1
0
Fork 0

window: don't set _NET_WM_FULLSCREEN_MONITORS to bogus values

Prior to the DisplayConfig merge, we would set _NET_WM_FULLSCREEN_MONITORS
to (unsigned)-1 when unset. After that, we would have invalid
reads inside meta_screen_monitor_index_to_xinerama_index() (called
with -1).
The way I read the specification, the proper way to indicate
that the window is back to fullscreen on all monitors is to
remove the property, so do that.

Also, add an assertion that meta_screne_monitor_index_to_xinerama_index()
is doing the right thing.

https://bugzilla.gnome.org/show_bug.cgi?id=724258
This commit is contained in:
Giovanni Campagna 2013-12-14 14:24:27 +01:00
parent 2be5401b1e
commit 0c5a6ad775
2 changed files with 30 additions and 16 deletions

View file

@ -389,6 +389,8 @@ int
meta_screen_monitor_index_to_xinerama_index (MetaScreen *screen,
int index)
{
g_return_val_if_fail (index >= 0 && index < screen->n_monitor_infos, -1);
meta_screen_ensure_xinerama_indices (screen);
return screen->monitor_infos[index].xinerama_index;

View file

@ -126,6 +126,8 @@ meta_window_x11_set_net_wm_state (MetaWindow *window)
meta_error_trap_pop (window->display);
if (window->fullscreen)
{
if (window->fullscreen_monitors[0] >= 0)
{
data[0] = meta_screen_monitor_index_to_xinerama_index (window->screen,
window->fullscreen_monitors[0]);
@ -145,6 +147,16 @@ meta_window_x11_set_net_wm_state (MetaWindow *window)
(guchar*) data, 4);
meta_error_trap_pop (window->display);
}
else
{
meta_verbose ("Clearing _NET_WM_FULLSCREEN_MONITORS\n");
meta_error_trap_push (window->display);
XDeleteProperty (window->display->xdisplay,
window->xwindow,
window->display->atom__NET_WM_FULLSCREEN_MONITORS);
meta_error_trap_pop (window->display);
}
}
}
void