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:
parent
7562eb6006
commit
24c91d95de
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user