Move logical monitor neighbor API into monitor manager

Move the last piece of monitor grid getter API to the monitor manager
away from MetaScreen. The public facing API are still there, but are
thin wrappers around the MetaMonitorManager API.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
Jonas Ådahl
2016-12-01 15:15:52 +08:00
parent 98ee85ce82
commit a422d6fe08
8 changed files with 84 additions and 63 deletions

View File

@ -965,37 +965,43 @@ meta_workspace_set_builtin_struts (MetaWorkspace *workspace,
{
MetaStrut *strut = l->data;
MetaLogicalMonitor *logical_monitor;
int idx;
logical_monitor =
meta_monitor_manager_get_logical_monitor_from_rect (monitor_manager,
&strut->rect);
idx = logical_monitor->number;
switch (strut->side)
{
case META_SIDE_TOP:
if (meta_screen_get_monitor_neighbor (screen, idx, META_SCREEN_UP))
if (meta_monitor_manager_get_logical_monitor_neighbor (monitor_manager,
logical_monitor,
META_SCREEN_UP))
continue;
strut->rect.height += strut->rect.y;
strut->rect.y = 0;
break;
case META_SIDE_BOTTOM:
if (meta_screen_get_monitor_neighbor (screen, idx, META_SCREEN_DOWN))
if (meta_monitor_manager_get_logical_monitor_neighbor (monitor_manager,
logical_monitor,
META_SCREEN_DOWN))
continue;
strut->rect.height = screen->rect.height - strut->rect.y;
break;
case META_SIDE_LEFT:
if (meta_screen_get_monitor_neighbor (screen, idx, META_SCREEN_LEFT))
if (meta_monitor_manager_get_logical_monitor_neighbor (monitor_manager,
logical_monitor,
META_SCREEN_LEFT))
continue;
strut->rect.width += strut->rect.x;
strut->rect.x = 0;
break;
case META_SIDE_RIGHT:
if (meta_screen_get_monitor_neighbor (screen, idx, META_SCREEN_RIGHT))
if (meta_monitor_manager_get_logical_monitor_neighbor (monitor_manager,
logical_monitor,
META_SCREEN_RIGHT))
continue;
strut->rect.width = screen->rect.width - strut->rect.x;