monitor-manager: Store logical monitors in a GList

Instead of storing the logical monitors in an array and having users
either look up them in the array given an index or iterate using
indices, put it in a GList, and use GList iterators when iterating and
alternative API where array indices were previously used.

This allows for more liberty regarding the type of the logical monitor.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
Jonas Ådahl 2016-12-02 16:00:03 +08:00
parent 20b8743f21
commit 1fb0e8e9bb
9 changed files with 175 additions and 162 deletions

View File

@ -304,8 +304,7 @@ struct _MetaMonitorManager
MetaCRTC *crtcs;
unsigned int n_crtcs;
MetaLogicalMonitor *logical_monitors;
unsigned int n_logical_monitors;
GList *logical_monitors;
MetaLogicalMonitor *primary_logical_monitor;
int dbus_name_id;
@ -365,8 +364,7 @@ void meta_monitor_manager_rebuild_derived (MetaMonitorManager *
int meta_monitor_manager_get_num_logical_monitors (MetaMonitorManager *manager);
MetaLogicalMonitor *meta_monitor_manager_get_logical_monitors (MetaMonitorManager *manager,
unsigned int *n_logical_monitors);
GList * meta_monitor_manager_get_logical_monitors (MetaMonitorManager *manager);
MetaLogicalMonitor *meta_monitor_manager_get_logical_monitor_from_number (MetaMonitorManager *manager,
int number);

View File

@ -169,11 +169,11 @@ static void
make_logical_config (MetaMonitorManager *manager)
{
MetaMonitorManagerClass *manager_class = META_MONITOR_MANAGER_GET_CLASS (manager);
GArray *logical_monitors;
unsigned int i, j;
GList *logical_monitors = NULL;
int monitor_number;
unsigned int i;
logical_monitors = g_array_sized_new (FALSE, TRUE, sizeof (MetaLogicalMonitor),
manager->n_crtcs);
monitor_number = 0;
/* Walk the list of MetaCRTCs, and build a MetaLogicalMonitor
for each of them, unless they reference a rectangle that
@ -196,24 +196,26 @@ make_logical_config (MetaMonitorManager *manager)
logical_monitor = construct_tile_monitor (manager,
output,
logical_monitors->len);
monitor_number);
g_array_append_val (logical_monitors, logical_monitor);
logical_monitors = g_list_append (logical_monitors, logical_monitor);
monitor_number++;
}
}
for (i = 0; i < manager->n_crtcs; i++)
{
MetaCRTC *crtc = &manager->crtcs[i];
GList *l;
/* Ignore CRTCs not in use */
if (crtc->current_mode == NULL)
continue;
for (j = 0; j < logical_monitors->len; j++)
for (l = logical_monitors; l; l = l->next)
{
MetaLogicalMonitor *logical_monitor =
&g_array_index (logical_monitors, MetaLogicalMonitor, j);
MetaLogicalMonitor *logical_monitor = l->data;
if (meta_rectangle_contains_rect (&logical_monitor->rect,
&crtc->rect))
{
@ -224,29 +226,25 @@ make_logical_config (MetaMonitorManager *manager)
if (crtc->logical_monitor == NULL)
{
MetaLogicalMonitor logical_monitor;
MetaLogicalMonitor *logical_monitor = g_new0 (MetaLogicalMonitor, 1);
logical_monitor.number = logical_monitors->len;
logical_monitor.tile_group_id = 0;
logical_monitor.rect = crtc->rect;
logical_monitor.refresh_rate = crtc->current_mode->refresh_rate;
logical_monitor.scale = 1;
logical_monitor.is_primary = FALSE;
logical_monitor->number = monitor_number;
logical_monitor->rect = crtc->rect;
logical_monitor->refresh_rate = crtc->current_mode->refresh_rate;
logical_monitor->scale = 1;
logical_monitor->is_primary = FALSE;
/* This starts true because we want
is_presentation only if all outputs are
marked as such (while for primary it's enough
that any is marked)
*/
logical_monitor.is_presentation = TRUE;
logical_monitor.in_fullscreen = -1;
logical_monitor.winsys_id = 0;
logical_monitor.n_outputs = 0;
logical_monitor.monitor_winsys_xid = 0;
g_array_append_val (logical_monitors, logical_monitor);
logical_monitor->is_presentation = TRUE;
logical_monitor->in_fullscreen = -1;
crtc->logical_monitor = &g_array_index (logical_monitors,
MetaLogicalMonitor,
logical_monitor.number);
logical_monitors = g_list_append (logical_monitors, logical_monitor);
monitor_number++;
crtc->logical_monitor = logical_monitor;
}
}
@ -293,20 +291,26 @@ make_logical_config (MetaMonitorManager *manager)
manager->primary_logical_monitor = logical_monitor;
}
manager->n_logical_monitors = logical_monitors->len;
manager->logical_monitors = (void*)g_array_free (logical_monitors, FALSE);
manager->logical_monitors = logical_monitors;
/*
* If no monitor was marked as primary, fall back on marking the first
* logical monitor the primary one.
*/
if (!manager->primary_logical_monitor &&
manager->n_logical_monitors > 0)
manager->primary_logical_monitor = &manager->logical_monitors[0];
if (!manager->primary_logical_monitor && manager->logical_monitors)
manager->primary_logical_monitor = g_list_first (manager->logical_monitors)->data;
if (manager_class->add_monitor)
for (i = 0; i < manager->n_logical_monitors; i++)
manager_class->add_monitor (manager, &manager->logical_monitors[i]);
{
GList *l;
for (l = logical_monitors; l; l = l->next)
{
MetaLogicalMonitor *logical_monitor = l->data;
manager_class->add_monitor (manager, logical_monitor);
}
}
}
static void
@ -448,7 +452,7 @@ meta_monitor_manager_finalize (GObject *object)
meta_monitor_manager_free_output_array (manager->outputs, manager->n_outputs);
meta_monitor_manager_free_mode_array (manager->modes, manager->n_modes);
meta_monitor_manager_free_crtc_array (manager->crtcs, manager->n_crtcs);
g_free (manager->logical_monitors);
g_list_free_full (manager->logical_monitors, g_free);
G_OBJECT_CLASS (meta_monitor_manager_parent_class)->finalize (object);
}
@ -1308,15 +1312,12 @@ meta_monitor_manager_get (void)
int
meta_monitor_manager_get_num_logical_monitors (MetaMonitorManager *manager)
{
return (int) manager->n_logical_monitors;
return g_list_length (manager->logical_monitors);
}
MetaLogicalMonitor *
meta_monitor_manager_get_logical_monitors (MetaMonitorManager *manager,
unsigned int *n_logical_monitors)
GList *
meta_monitor_manager_get_logical_monitors (MetaMonitorManager *manager)
{
if (n_logical_monitors)
*n_logical_monitors = manager->n_logical_monitors;
return manager->logical_monitors;
}
@ -1324,9 +1325,9 @@ MetaLogicalMonitor *
meta_monitor_manager_get_logical_monitor_from_number (MetaMonitorManager *manager,
int number)
{
g_assert (number < (int) manager->n_logical_monitors);
g_assert ((unsigned int) number < g_list_length (manager->logical_monitors));
return &manager->logical_monitors[number];
return g_list_nth (manager->logical_monitors, number)->data;
}
MetaLogicalMonitor *
@ -1340,12 +1341,14 @@ meta_monitor_manager_get_logical_monitor_at (MetaMonitorManager *manager,
float x,
float y)
{
unsigned int i;
GList *l;
for (i = 0; i < manager->n_logical_monitors; i++)
for (l = manager->logical_monitors; l; l = l->next)
{
if (POINT_IN_RECT (x, y, manager->logical_monitors[i].rect))
return &manager->logical_monitors[i];
MetaLogicalMonitor *logical_monitor = l->data;
if (POINT_IN_RECT (x, y, logical_monitor->rect))
return logical_monitor;
}
return NULL;
@ -1357,14 +1360,14 @@ meta_monitor_manager_get_logical_monitor_from_rect (MetaMonitorManager *manager,
{
MetaLogicalMonitor *best_logical_monitor;
int best_logical_monitor_area;
unsigned int i;
GList *l;
best_logical_monitor = NULL;
best_logical_monitor_area = 0;
for (i = 0; i < manager->n_logical_monitors; i++)
for (l = manager->logical_monitors; l; l = l->next)
{
MetaLogicalMonitor *logical_monitor = &manager->logical_monitors[i];
MetaLogicalMonitor *logical_monitor = l->data;
MetaRectangle intersection;
int intersection_area;
@ -1397,11 +1400,11 @@ meta_monitor_manager_get_logical_monitor_neighbor (MetaMonitorManager *manager,
MetaLogicalMonitor *logical_monitor,
MetaScreenDirection direction)
{
unsigned int i;
GList *l;
for (i = 0; i < manager->n_logical_monitors; i++)
for (l = manager->logical_monitors; l; l = l->next)
{
MetaLogicalMonitor *other = &manager->logical_monitors[i];
MetaLogicalMonitor *other = l->data;
switch (direction)
{
@ -1522,29 +1525,34 @@ meta_monitor_manager_rebuild_derived (MetaMonitorManager *manager)
{
MetaBackend *backend = meta_get_backend ();
MetaMonitorManagerClass *manager_class = META_MONITOR_MANAGER_GET_CLASS (manager);
MetaLogicalMonitor *old_logical_monitors;
unsigned old_n_logical_monitors;
unsigned i, j;
old_logical_monitors = manager->logical_monitors;
old_n_logical_monitors = manager->n_logical_monitors;
GList *old_logical_monitors;
GList *old_l;
if (manager->in_init)
return;
old_logical_monitors = manager->logical_monitors;
make_logical_config (manager);
if (manager_class->delete_monitor)
{
for (i = 0; i < old_n_logical_monitors; i++)
for (old_l = old_logical_monitors; old_l; old_l = old_l->next)
{
int old_monitor_winsys_xid =
old_logical_monitors[i].monitor_winsys_xid;
gboolean delete_mon = TRUE;
MetaLogicalMonitor *old_logical_monitor = old_l->data;
int old_monitor_winsys_xid;
gboolean delete_mon;
GList *new_l;
for (j = 0; j < manager->n_logical_monitors; j++)
delete_mon = TRUE;
old_monitor_winsys_xid = old_logical_monitor->monitor_winsys_xid;
for (new_l = manager->logical_monitors; new_l; new_l = new_l->next)
{
int new_monitor_winsys_xid =
manager->logical_monitors[j].monitor_winsys_xid;
MetaLogicalMonitor *new_logical_monitor = new_l->data;
int new_monitor_winsys_xid;
new_monitor_winsys_xid = new_logical_monitor->monitor_winsys_xid;
if (new_monitor_winsys_xid == old_monitor_winsys_xid)
{
@ -1565,7 +1573,7 @@ meta_monitor_manager_rebuild_derived (MetaMonitorManager *manager)
g_signal_emit_by_name (manager, "monitors-changed");
g_free (old_logical_monitors);
g_list_free_full (old_logical_monitors, g_free);
}
void
@ -1715,7 +1723,7 @@ meta_monitor_manager_get_monitor_for_output (MetaMonitorManager *manager,
guint id)
{
MetaOutput *output;
guint i;
GList *l;
g_return_val_if_fail (META_IS_MONITOR_MANAGER (manager), -1);
g_return_val_if_fail (id < manager->n_outputs, -1);
@ -1724,10 +1732,14 @@ meta_monitor_manager_get_monitor_for_output (MetaMonitorManager *manager,
if (!output || !output->crtc)
return -1;
for (i = 0; i < manager->n_logical_monitors; i++)
if (meta_rectangle_contains_rect (&manager->logical_monitors[i].rect,
&output->crtc->rect))
return i;
for (l = manager->logical_monitors; l; l = l->next)
{
MetaLogicalMonitor *logical_monitor = l->data;
if (meta_rectangle_contains_rect (&logical_monitor->rect,
&output->crtc->rect))
return logical_monitor->number;
}
return -1;
}

View File

@ -57,22 +57,20 @@ meta_renderer_rebuild_views (MetaRenderer *renderer)
MetaBackend *backend = meta_get_backend ();
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend);
MetaLogicalMonitor *logical_monitors;
unsigned int n_logical_monitors;
unsigned int i;
GList *logical_monitors, *l;
g_list_free_full (priv->views, g_object_unref);
priv->views = NULL;
logical_monitors =
meta_monitor_manager_get_logical_monitors (monitor_manager,
&n_logical_monitors);
meta_monitor_manager_get_logical_monitors (monitor_manager);
for (i = 0; i < n_logical_monitors; i++)
for (l = logical_monitors; l; l = l->next)
{
MetaLogicalMonitor *logical_monitor = l->data;
MetaRendererView *view;
view = meta_renderer_create_view (renderer, &logical_monitors[i]);
view = meta_renderer_create_view (renderer, logical_monitor);
priv->views = g_list_append (priv->views, view);
}
}

View File

@ -181,14 +181,13 @@ constrain_to_client_constraint (ClutterInputDevice *device,
static void
constrain_all_screen_monitors (ClutterInputDevice *device,
MetaLogicalMonitor *logical_monitors,
unsigned int n_logical_monitors,
MetaMonitorManager *monitor_manager,
float *x,
float *y)
{
ClutterPoint current;
unsigned int i;
float cx, cy;
GList *logical_monitors, *l;
clutter_input_device_get_coords (device, NULL, &current);
@ -196,9 +195,12 @@ constrain_all_screen_monitors (ClutterInputDevice *device,
cy = current.y;
/* if we're trying to escape, clamp to the CRTC we're coming from */
for (i = 0; i < n_logical_monitors; i++)
logical_monitors =
meta_monitor_manager_get_logical_monitors (monitor_manager);
for (l = logical_monitors; l; l = l->next)
{
MetaLogicalMonitor *logical_monitor = &logical_monitors[i];
MetaLogicalMonitor *logical_monitor = l->data;
int left, right, top, bottom;
left = logical_monitor->rect.x;
@ -231,9 +233,9 @@ pointer_constrain_callback (ClutterInputDevice *device,
float *new_y,
gpointer user_data)
{
MetaMonitorManager *monitor_manager;
MetaLogicalMonitor *logical_monitors;
unsigned int n_logical_monitors;
MetaBackend *backend = meta_get_backend ();
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend);
/* Constrain to barriers */
constrain_to_barriers (device, time, new_x, new_y);
@ -241,20 +243,13 @@ pointer_constrain_callback (ClutterInputDevice *device,
/* Constrain to pointer lock */
constrain_to_client_constraint (device, time, prev_x, prev_y, new_x, new_y);
monitor_manager = meta_monitor_manager_get ();
logical_monitors =
meta_monitor_manager_get_logical_monitors (monitor_manager,
&n_logical_monitors);
/* if we're moving inside a monitor, we're fine */
if (meta_monitor_manager_get_logical_monitor_at (monitor_manager,
*new_x, *new_y))
return;
/* if we're trying to escape, clamp to the CRTC we're coming from */
constrain_all_screen_monitors (device,
logical_monitors, n_logical_monitors,
new_x, new_y);
constrain_all_screen_monitors (device, monitor_manager, new_x, new_y);
}
static ClutterBackend *

View File

@ -344,9 +344,7 @@ meta_screen_ensure_xinerama_indices (MetaScreen *screen)
MetaBackend *backend = meta_get_backend ();
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend);
MetaLogicalMonitor *logical_monitors;
unsigned int n_logical_monitors;
unsigned int i;
GList *logical_monitors, *l;
XineramaScreenInfo *infos;
int n_infos, j;
@ -366,18 +364,19 @@ meta_screen_ensure_xinerama_indices (MetaScreen *screen)
}
logical_monitors =
meta_monitor_manager_get_logical_monitors (monitor_manager,
&n_logical_monitors);
meta_monitor_manager_get_logical_monitors (monitor_manager);
for (i = 0; i < n_logical_monitors; ++i)
for (l = logical_monitors; l; l = l->next)
{
MetaLogicalMonitor *logical_monitor = l->data;
for (j = 0; j < n_infos; ++j)
{
if (logical_monitors[i].rect.x == infos[j].x_org &&
logical_monitors[i].rect.y == infos[j].y_org &&
logical_monitors[i].rect.width == infos[j].width &&
logical_monitors[i].rect.height == infos[j].height)
logical_monitors[i].xinerama_index = j;
if (logical_monitor->rect.x == infos[j].x_org &&
logical_monitor->rect.y == infos[j].y_org &&
logical_monitor->rect.width == infos[j].width &&
logical_monitor->rect.height == infos[j].height)
logical_monitor->xinerama_index = j;
}
}
@ -402,19 +401,20 @@ meta_screen_xinerama_index_to_logical_monitor (MetaScreen *screen,
MetaBackend *backend = meta_get_backend ();
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend);
MetaLogicalMonitor *logical_monitors;
unsigned int n_logical_monitors;
unsigned int i;
GList *logical_monitors, *l;
meta_screen_ensure_xinerama_indices (screen);
logical_monitors =
meta_monitor_manager_get_logical_monitors (monitor_manager,
&n_logical_monitors);
meta_monitor_manager_get_logical_monitors (monitor_manager);
for (i = 0; i < n_logical_monitors; i++)
if (logical_monitors[i].xinerama_index == xinerama_index)
return &logical_monitors[i];
for (l = logical_monitors; l; l = l->next)
{
MetaLogicalMonitor *logical_monitor = l->data;
if (logical_monitor->xinerama_index == xinerama_index)
return logical_monitor;
}
return NULL;
}
@ -1520,7 +1520,7 @@ meta_screen_get_monitor_geometry (MetaScreen *screen,
MetaBackend *backend = meta_get_backend ();
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend);
MetaLogicalMonitor *logical_monitors;
MetaLogicalMonitor *logical_monitor;
#ifndef G_DISABLE_CHECKS
int n_logical_monitors =
meta_monitor_manager_get_num_logical_monitors (monitor_manager);
@ -1530,10 +1530,10 @@ meta_screen_get_monitor_geometry (MetaScreen *screen,
g_return_if_fail (monitor >= 0 && monitor < n_logical_monitors);
g_return_if_fail (geometry != NULL);
logical_monitors = meta_monitor_manager_get_logical_monitors (monitor_manager,
NULL);
*geometry = logical_monitors[monitor].rect;
logical_monitor =
meta_monitor_manager_get_logical_monitor_from_number (monitor_manager,
monitor);
*geometry = logical_monitor->rect;
}
#define _NET_WM_ORIENTATION_HORZ 0
@ -2589,9 +2589,7 @@ check_fullscreen_func (gpointer data)
MetaBackend *backend = meta_get_backend ();
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend);
MetaLogicalMonitor *logical_monitors;
unsigned int n_logical_monitors;
unsigned int i;
GList *logical_monitors, *l;
MetaWindow *window;
GSList *fullscreen_monitors = NULL;
GSList *obscured_monitors = NULL;
@ -2600,8 +2598,7 @@ check_fullscreen_func (gpointer data)
screen->check_fullscreen_later = 0;
logical_monitors =
meta_monitor_manager_get_logical_monitors (monitor_manager,
&n_logical_monitors);
meta_monitor_manager_get_logical_monitors (monitor_manager);
/* We consider a monitor in fullscreen if it contains a fullscreen window;
* however we make an exception for maximized windows above the fullscreen
@ -2647,9 +2644,9 @@ check_fullscreen_func (gpointer data)
meta_window_get_frame_rect (window, &window_rect);
for (i = 0; i < n_logical_monitors; i++)
for (l = logical_monitors; l; l = l->next)
{
MetaLogicalMonitor *logical_monitor = &logical_monitors[i];
MetaLogicalMonitor *logical_monitor = l->data;
if (meta_rectangle_overlap (&window_rect,
&logical_monitor->rect) &&
@ -2663,9 +2660,9 @@ check_fullscreen_func (gpointer data)
g_slist_free (obscured_monitors);
for (i = 0; i < n_logical_monitors; i++)
for (l = logical_monitors; l; l = l->next)
{
MetaLogicalMonitor *logical_monitor = &logical_monitors[i];
MetaLogicalMonitor *logical_monitor = l->data;
gboolean in_fullscreen;
in_fullscreen = g_slist_find (fullscreen_monitors,
@ -2723,7 +2720,7 @@ meta_screen_get_monitor_in_fullscreen (MetaScreen *screen,
MetaBackend *backend = meta_get_backend ();
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend);
MetaLogicalMonitor *logical_monitors;
MetaLogicalMonitor *logical_monitor;
#ifndef G_DISABLE_CHECKS
int n_logical_monitors =
meta_monitor_manager_get_num_logical_monitors (monitor_manager);
@ -2733,11 +2730,12 @@ meta_screen_get_monitor_in_fullscreen (MetaScreen *screen,
g_return_val_if_fail (monitor >= 0 &&
monitor < n_logical_monitors, FALSE);
logical_monitors = meta_monitor_manager_get_logical_monitors (monitor_manager,
NULL);
logical_monitor =
meta_monitor_manager_get_logical_monitor_from_number (monitor_manager,
monitor);
/* We use -1 as a flag to mean "not known yet" for notification purposes */
return logical_monitors[monitor].in_fullscreen == TRUE;
return logical_monitor->in_fullscreen == TRUE;
}
gboolean

View File

@ -3517,17 +3517,14 @@ find_monitor_by_winsys_id (MetaWindow *window,
MetaBackend *backend = meta_get_backend ();
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend);
MetaLogicalMonitor *logical_monitors;
unsigned int n_logical_monitors;
unsigned int i;
GList *logical_monitors, *l;
logical_monitors =
meta_monitor_manager_get_logical_monitors (monitor_manager,
&n_logical_monitors);
meta_monitor_manager_get_logical_monitors (monitor_manager);
for (i = 0; i < n_logical_monitors; i++)
for (l = logical_monitors; l; l = l->next)
{
MetaLogicalMonitor *logical_monitor = &logical_monitors[i];
MetaLogicalMonitor *logical_monitor = l->data;
if (logical_monitor->winsys_id == winsys_id)
return logical_monitor;

View File

@ -56,6 +56,7 @@ struct _MetaWorkspace
MetaRectangle work_area_screen;
MetaRectangle *work_area_monitor;
gint n_work_area_monitor;
GList *screen_region;
GList **monitor_region;
gint n_monitor_regions;

View File

@ -754,9 +754,8 @@ ensure_work_areas_validated (MetaWorkspace *workspace)
meta_backend_get_monitor_manager (backend);
GList *windows;
GList *tmp;
MetaLogicalMonitor *logical_monitors;
unsigned int n_logical_monitors;
unsigned int i;
GList *logical_monitors, *l;
int i;
MetaRectangle work_area;
if (!workspace->work_areas_invalid)
@ -792,18 +791,23 @@ ensure_work_areas_validated (MetaWorkspace *workspace)
g_assert (workspace->screen_region == NULL);
logical_monitors =
meta_monitor_manager_get_logical_monitors (monitor_manager,
&n_logical_monitors);
meta_monitor_manager_get_logical_monitors (monitor_manager);
workspace->monitor_region = g_new (GList*, n_logical_monitors);
for (i = 0; i < n_logical_monitors; i++)
workspace->n_monitor_regions =
(int) meta_monitor_manager_get_num_logical_monitors (monitor_manager);
workspace->monitor_region = g_new (GList*, workspace->n_monitor_regions);
i = 0;
for (l = logical_monitors; l; l = l->next)
{
MetaLogicalMonitor *logical_monitor = l->data;
workspace->monitor_region[i] =
meta_rectangle_get_minimal_spanning_set_for_region (
&logical_monitors[i].rect,
&logical_monitor->rect,
workspace->all_struts);
i++;
}
workspace->n_monitor_regions = (int) n_logical_monitors;
workspace->screen_region =
meta_rectangle_get_minimal_spanning_set_for_region (
@ -868,11 +872,17 @@ ensure_work_areas_validated (MetaWorkspace *workspace)
/* Now find the work areas for each monitor */
g_free (workspace->work_area_monitor);
workspace->work_area_monitor = g_new (MetaRectangle, n_logical_monitors);
workspace->n_work_area_monitor =
meta_monitor_manager_get_num_logical_monitors (monitor_manager);
workspace->work_area_monitor = g_new (MetaRectangle,
workspace->n_work_area_monitor);
for (i = 0; i < n_logical_monitors; i++)
i = 0;
for (l = logical_monitors; l; l = l->next)
{
work_area = logical_monitors[i].rect;
MetaLogicalMonitor *logical_monitor = l->data;
work_area = logical_monitor->rect;
if (workspace->monitor_region[i] == NULL)
/* FIXME: constraints.c untested with this, but it might be nice for
@ -894,6 +904,8 @@ ensure_work_areas_validated (MetaWorkspace *workspace)
workspace->work_area_monitor[i].y,
workspace->work_area_monitor[i].width,
workspace->work_area_monitor[i].height);
i++;
}
/* STEP 4: Make sure the screen_region is nonempty (separate from step 2
@ -914,8 +926,12 @@ ensure_work_areas_validated (MetaWorkspace *workspace)
meta_rectangle_find_onscreen_edges (&workspace->screen->rect,
workspace->all_struts);
tmp = NULL;
for (i = 0; i < n_logical_monitors; i++)
tmp = g_list_prepend (tmp, &logical_monitors[i].rect);
for (l = logical_monitors; l; l = l->next)
{
MetaLogicalMonitor *logical_monitor = l->data;
tmp = g_list_prepend (tmp, &logical_monitor->rect);
}
workspace->monitor_edges =
meta_rectangle_find_nonintersected_monitor_edges (tmp,
workspace->all_struts);

View File

@ -204,21 +204,19 @@ meta_wayland_output_new (MetaWaylandCompositor *compositor,
static GHashTable *
meta_wayland_compositor_update_outputs (MetaWaylandCompositor *compositor,
MetaMonitorManager *monitors)
MetaMonitorManager *monitor_manager)
{
unsigned int i;
GHashTable *new_table;
MetaLogicalMonitor *logical_monitors;
unsigned int n_logical_monitors;
GList *logical_monitors, *l;
logical_monitors = meta_monitor_manager_get_logical_monitors (monitors,
&n_logical_monitors);
logical_monitors =
meta_monitor_manager_get_logical_monitors (monitor_manager);
new_table = g_hash_table_new_full (NULL, NULL, NULL,
wayland_output_destroy_notify);
for (i = 0; i < n_logical_monitors; i++)
for (l = logical_monitors; l; l = l->next)
{
MetaLogicalMonitor *logical_monitor = &logical_monitors[i];
MetaLogicalMonitor *logical_monitor = l->data;
MetaWaylandOutput *wayland_output;
if (logical_monitor->winsys_id == 0)