core/screen: Make logical monitor getters handle being headless

Don't crash or return invalid indices when we are headless.

https://bugzilla.gnome.org/show_bug.cgi?id=730551
This commit is contained in:
Jonas Ådahl 2017-04-12 14:24:25 +08:00
parent 7562eb6006
commit 24c91d95de

View File

@ -1515,6 +1515,9 @@ meta_screen_get_monitor_index_for_rect (MetaScreen *screen,
logical_monitor =
meta_monitor_manager_get_logical_monitor_from_rect (monitor_manager, rect);
if (!logical_monitor)
return -1;
return logical_monitor->number;
}
@ -1604,7 +1607,7 @@ meta_screen_get_primary_monitor (MetaScreen *screen)
if (logical_monitor)
return logical_monitor->number;
else
return 0;
return -1;
}
/**