monitor-manager: Rename output_id to winsys_id

The output_id is more of an opaque identifier for the monitor, based on
its underlying ID from the windowing system. Since we also use the term
"output_id" for the output's index, rename our use of the opaque cookie
"output_id" to "winsys_id".
This commit is contained in:
Jasper St. Pierre 2014-07-01 13:23:05 -04:00
parent 42c972735e
commit af135c0b0b
10 changed files with 52 additions and 52 deletions

View File

@ -75,7 +75,7 @@ meta_monitor_manager_dummy_read_current (MetaMonitorManager *manager)
manager->n_outputs = 1; manager->n_outputs = 1;
manager->outputs[0].crtc = &manager->crtcs[0]; manager->outputs[0].crtc = &manager->crtcs[0];
manager->outputs[0].output_id = 1; manager->outputs[0].winsys_id = 1;
manager->outputs[0].name = g_strdup ("LVDS"); manager->outputs[0].name = g_strdup ("LVDS");
manager->outputs[0].vendor = g_strdup ("MetaProducts Inc."); manager->outputs[0].vendor = g_strdup ("MetaProducts Inc.");
manager->outputs[0].product = g_strdup ("unknown"); manager->outputs[0].product = g_strdup ("unknown");

View File

@ -125,7 +125,7 @@ make_logical_config (MetaMonitorManager *manager)
*/ */
info.is_presentation = TRUE; info.is_presentation = TRUE;
info.in_fullscreen = -1; info.in_fullscreen = -1;
info.output_id = 0; info.winsys_id = 0;
g_array_append_val (monitor_infos, info); g_array_append_val (monitor_infos, info);
@ -156,8 +156,8 @@ make_logical_config (MetaMonitorManager *manager)
info->is_primary = info->is_primary || output->is_primary; info->is_primary = info->is_primary || output->is_primary;
info->is_presentation = info->is_presentation && output->is_presentation; info->is_presentation = info->is_presentation && output->is_presentation;
if (output->is_primary || info->output_id == 0) if (output->is_primary || info->winsys_id == 0)
info->output_id = output->output_id; info->winsys_id = output->winsys_id;
if (info->is_primary) if (info->is_primary)
manager->primary_monitor_index = info->number; manager->primary_monitor_index = info->number;
@ -560,7 +560,7 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
g_variant_builder_add (&output_builder, "(uxiausauaua{sv})", g_variant_builder_add (&output_builder, "(uxiausauaua{sv})",
i, /* ID */ i, /* ID */
(gint64)output->output_id, (gint64)output->winsys_id,
(int)(output->crtc ? output->crtc - manager->crtcs : -1), (int)(output->crtc ? output->crtc - manager->crtcs : -1),
&crtcs, &crtcs,
output->name, output->name,

View File

@ -65,7 +65,7 @@ struct _MetaOutput
/* The CRTC driving this output, NULL if the output is not enabled */ /* The CRTC driving this output, NULL if the output is not enabled */
MetaCRTC *crtc; MetaCRTC *crtc;
/* The low-level ID of this output, used to apply back configuration */ /* The low-level ID of this output, used to apply back configuration */
glong output_id; glong winsys_id;
char *name; char *name;
char *vendor; char *vendor;
char *product; char *product;
@ -162,14 +162,14 @@ struct _MetaMonitorInfo
gboolean in_fullscreen; gboolean in_fullscreen;
/* The primary or first output for this monitor, 0 if we can't figure out. /* The primary or first output for this monitor, 0 if we can't figure out.
It can be matched to an output_id of a MetaOutput. It can be matched to a winsys_id of a MetaOutput.
This is used as an opaque token on reconfiguration when switching from This is used as an opaque token on reconfiguration when switching from
clone to extened, to decide on what output the windows should go next clone to extened, to decide on what output the windows should go next
(it's an attempt to keep windows on the same monitor, and preferably on (it's an attempt to keep windows on the same monitor, and preferably on
the primary one). the primary one).
*/ */
glong output_id; glong winsys_id;
}; };
/* /*

View File

@ -259,7 +259,7 @@ find_output_by_id (MetaOutput *outputs,
unsigned i; unsigned i;
for (i = 0; i < n_outputs; i++) for (i = 0; i < n_outputs; i++)
if (outputs[i].output_id == id) if (outputs[i].winsys_id == id)
return &outputs[i]; return &outputs[i];
return NULL; return NULL;
@ -408,7 +408,7 @@ meta_monitor_manager_kms_read_current (MetaMonitorManager *manager)
meta_output->driver_private = output_kms = g_slice_new0 (MetaOutputKms); meta_output->driver_private = output_kms = g_slice_new0 (MetaOutputKms);
meta_output->driver_notify = (GDestroyNotify)meta_output_destroy_notify; meta_output->driver_notify = (GDestroyNotify)meta_output_destroy_notify;
meta_output->output_id = connector->connector_id; meta_output->winsys_id = connector->connector_id;
meta_output->name = make_output_name (connector); meta_output->name = make_output_name (connector);
meta_output->width_mm = connector->mmWidth; meta_output->width_mm = connector->mmWidth;
meta_output->height_mm = connector->mmHeight; meta_output->height_mm = connector->mmHeight;
@ -491,7 +491,7 @@ meta_monitor_manager_kms_read_current (MetaMonitorManager *manager)
meta_output->crtc = NULL; meta_output->crtc = NULL;
old_output = find_output_by_id (old_outputs, n_old_outputs, old_output = find_output_by_id (old_outputs, n_old_outputs,
meta_output->output_id); meta_output->winsys_id);
if (old_output) if (old_output)
{ {
meta_output->is_primary = old_output->is_primary; meta_output->is_primary = old_output->is_primary;
@ -667,7 +667,7 @@ meta_monitor_manager_kms_set_power_save_mode (MetaMonitorManager *manager,
if (output_kms->dpms_prop_id != 0) if (output_kms->dpms_prop_id != 0)
{ {
int ok = drmModeConnectorSetProperty(manager_kms->fd, meta_output->output_id, int ok = drmModeConnectorSetProperty(manager_kms->fd, meta_output->winsys_id,
output_kms->dpms_prop_id, state); output_kms->dpms_prop_id, state);
if (ok < 0) if (ok < 0)
@ -748,7 +748,7 @@ meta_monitor_manager_kms_apply_configuration (MetaMonitorManager *manager,
{ {
MetaOutput *output = g_ptr_array_index (crtc_info->outputs, j); MetaOutput *output = g_ptr_array_index (crtc_info->outputs, j);
connectors[j] = output->output_id; connectors[j] = output->winsys_id;
output->is_dirty = TRUE; output->is_dirty = TRUE;
output->crtc = crtc; output->crtc = crtc;

View File

@ -150,7 +150,7 @@ output_get_presentation_xrandr (MetaMonitorManagerXrandr *manager_xrandr,
atom = XInternAtom (manager_xrandr->xdisplay, "_MUTTER_PRESENTATION_OUTPUT", False); atom = XInternAtom (manager_xrandr->xdisplay, "_MUTTER_PRESENTATION_OUTPUT", False);
XRRGetOutputProperty (manager_xrandr->xdisplay, XRRGetOutputProperty (manager_xrandr->xdisplay,
(XID)output->output_id, (XID)output->winsys_id,
atom, atom,
0, G_MAXLONG, False, False, XA_CARDINAL, 0, G_MAXLONG, False, False, XA_CARDINAL,
&actual_type, &actual_format, &actual_type, &actual_format,
@ -186,7 +186,7 @@ output_get_backlight_xrandr (MetaMonitorManagerXrandr *manager_xrandr,
atom = XInternAtom (manager_xrandr->xdisplay, "Backlight", False); atom = XInternAtom (manager_xrandr->xdisplay, "Backlight", False);
XRRGetOutputProperty (manager_xrandr->xdisplay, XRRGetOutputProperty (manager_xrandr->xdisplay,
(XID)output->output_id, (XID)output->winsys_id,
atom, atom,
0, G_MAXLONG, False, False, XA_INTEGER, 0, G_MAXLONG, False, False, XA_INTEGER,
&actual_type, &actual_format, &actual_type, &actual_format,
@ -211,7 +211,7 @@ output_get_backlight_limits_xrandr (MetaMonitorManagerXrandr *manager_xrandr,
atom = XInternAtom (manager_xrandr->xdisplay, "Backlight", False); atom = XInternAtom (manager_xrandr->xdisplay, "Backlight", False);
info = XRRQueryOutputProperty (manager_xrandr->xdisplay, info = XRRQueryOutputProperty (manager_xrandr->xdisplay,
(XID)output->output_id, (XID)output->winsys_id,
atom); atom);
if (info == NULL) if (info == NULL)
@ -278,25 +278,25 @@ get_edid_property (Display *dpy,
static GBytes * static GBytes *
read_output_edid (MetaMonitorManagerXrandr *manager_xrandr, read_output_edid (MetaMonitorManagerXrandr *manager_xrandr,
XID output_id) XID winsys_id)
{ {
Atom edid_atom; Atom edid_atom;
guint8 *result; guint8 *result;
gsize len; gsize len;
edid_atom = XInternAtom (manager_xrandr->xdisplay, "EDID", FALSE); edid_atom = XInternAtom (manager_xrandr->xdisplay, "EDID", FALSE);
result = get_edid_property (manager_xrandr->xdisplay, output_id, edid_atom, &len); result = get_edid_property (manager_xrandr->xdisplay, winsys_id, edid_atom, &len);
if (!result) if (!result)
{ {
edid_atom = XInternAtom (manager_xrandr->xdisplay, "EDID_DATA", FALSE); edid_atom = XInternAtom (manager_xrandr->xdisplay, "EDID_DATA", FALSE);
result = get_edid_property (manager_xrandr->xdisplay, output_id, edid_atom, &len); result = get_edid_property (manager_xrandr->xdisplay, winsys_id, edid_atom, &len);
} }
if (!result) if (!result)
{ {
edid_atom = XInternAtom (manager_xrandr->xdisplay, "XFree86_DDC_EDID1_RAWDATA", FALSE); edid_atom = XInternAtom (manager_xrandr->xdisplay, "XFree86_DDC_EDID1_RAWDATA", FALSE);
result = get_edid_property (manager_xrandr->xdisplay, output_id, edid_atom, &len); result = get_edid_property (manager_xrandr->xdisplay, winsys_id, edid_atom, &len);
} }
if (result) if (result)
@ -312,14 +312,14 @@ read_output_edid (MetaMonitorManagerXrandr *manager_xrandr,
static gboolean static gboolean
output_get_hotplug_mode_update (MetaMonitorManagerXrandr *manager_xrandr, output_get_hotplug_mode_update (MetaMonitorManagerXrandr *manager_xrandr,
XID output_id) XID winsys_id)
{ {
Atom atom; Atom atom;
XRRPropertyInfo *info; XRRPropertyInfo *info;
gboolean result = FALSE; gboolean result = FALSE;
atom = XInternAtom (manager_xrandr->xdisplay, "hotplug_mode_update", False); atom = XInternAtom (manager_xrandr->xdisplay, "hotplug_mode_update", False);
info = XRRQueryOutputProperty (manager_xrandr->xdisplay, output_id, info = XRRQueryOutputProperty (manager_xrandr->xdisplay, winsys_id,
atom); atom);
if (info) if (info)
@ -467,10 +467,10 @@ meta_monitor_manager_xrandr_read_current (MetaMonitorManager *manager)
GBytes *edid; GBytes *edid;
MonitorInfo *parsed_edid; MonitorInfo *parsed_edid;
meta_output->output_id = resources->outputs[i]; meta_output->winsys_id = resources->outputs[i];
meta_output->name = g_strdup (output->name); meta_output->name = g_strdup (output->name);
edid = read_output_edid (manager_xrandr, meta_output->output_id); edid = read_output_edid (manager_xrandr, meta_output->winsys_id);
if (edid) if (edid)
{ {
gsize len; gsize len;
@ -504,7 +504,7 @@ meta_monitor_manager_xrandr_read_current (MetaMonitorManager *manager)
meta_output->height_mm = output->mm_height; meta_output->height_mm = output->mm_height;
meta_output->subpixel_order = COGL_SUBPIXEL_ORDER_UNKNOWN; meta_output->subpixel_order = COGL_SUBPIXEL_ORDER_UNKNOWN;
meta_output->hotplug_mode_update = meta_output->hotplug_mode_update =
output_get_hotplug_mode_update (manager_xrandr, meta_output->output_id); output_get_hotplug_mode_update (manager_xrandr, meta_output->winsys_id);
meta_output->n_modes = output->nmode; meta_output->n_modes = output->nmode;
meta_output->modes = g_new0 (MetaMonitorMode *, meta_output->n_modes); meta_output->modes = g_new0 (MetaMonitorMode *, meta_output->n_modes);
@ -556,7 +556,7 @@ meta_monitor_manager_xrandr_read_current (MetaMonitorManager *manager)
meta_output->possible_clones[j] = GINT_TO_POINTER (output->clones[j]); meta_output->possible_clones[j] = GINT_TO_POINTER (output->clones[j]);
} }
meta_output->is_primary = ((XID)meta_output->output_id == primary_output); meta_output->is_primary = ((XID)meta_output->winsys_id == primary_output);
meta_output->is_presentation = output_get_presentation_xrandr (manager_xrandr, meta_output); meta_output->is_presentation = output_get_presentation_xrandr (manager_xrandr, meta_output);
output_get_backlight_limits_xrandr (manager_xrandr, meta_output); output_get_backlight_limits_xrandr (manager_xrandr, meta_output);
@ -589,7 +589,7 @@ meta_monitor_manager_xrandr_read_current (MetaMonitorManager *manager)
for (k = 0; k < manager->n_outputs; k++) for (k = 0; k < manager->n_outputs; k++)
{ {
if (clone == (XID)manager->outputs[k].output_id) if (clone == (XID)manager->outputs[k].winsys_id)
{ {
meta_output->possible_clones[j] = &manager->outputs[k]; meta_output->possible_clones[j] = &manager->outputs[k];
break; break;
@ -605,7 +605,7 @@ meta_monitor_manager_xrandr_read_edid (MetaMonitorManager *manager,
{ {
MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (manager); MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (manager);
return read_output_edid (manager_xrandr, output->output_id); return read_output_edid (manager_xrandr, output->winsys_id);
} }
static void static void
@ -672,7 +672,7 @@ output_set_presentation_xrandr (MetaMonitorManagerXrandr *manager_xrandr,
atom = XInternAtom (manager_xrandr->xdisplay, "_MUTTER_PRESENTATION_OUTPUT", False); atom = XInternAtom (manager_xrandr->xdisplay, "_MUTTER_PRESENTATION_OUTPUT", False);
XRRChangeOutputProperty (manager_xrandr->xdisplay, XRRChangeOutputProperty (manager_xrandr->xdisplay,
(XID)output->output_id, (XID)output->winsys_id,
atom, atom,
XA_CARDINAL, 32, PropModeReplace, XA_CARDINAL, 32, PropModeReplace,
(unsigned char*) &value, 1); (unsigned char*) &value, 1);
@ -828,7 +828,7 @@ meta_monitor_manager_xrandr_apply_configuration (MetaMonitorManager *manager,
output->crtc = crtc; output->crtc = crtc;
new_controlled_mask |= 1UL << j; new_controlled_mask |= 1UL << j;
outputs[j] = output->output_id; outputs[j] = output->winsys_id;
} }
if (crtc->current_mode == mode && if (crtc->current_mode == mode &&
@ -891,7 +891,7 @@ meta_monitor_manager_xrandr_apply_configuration (MetaMonitorManager *manager,
{ {
XRRSetOutputPrimary (manager_xrandr->xdisplay, XRRSetOutputPrimary (manager_xrandr->xdisplay,
DefaultRootWindow (manager_xrandr->xdisplay), DefaultRootWindow (manager_xrandr->xdisplay),
(XID)output_info->output->output_id); (XID)output_info->output->winsys_id);
} }
output_set_presentation_xrandr (manager_xrandr, output_set_presentation_xrandr (manager_xrandr,
@ -934,7 +934,7 @@ meta_monitor_manager_xrandr_change_backlight (MetaMonitorManager *manager,
atom = XInternAtom (manager_xrandr->xdisplay, "Backlight", False); atom = XInternAtom (manager_xrandr->xdisplay, "Backlight", False);
XRRChangeOutputProperty (manager_xrandr->xdisplay, XRRChangeOutputProperty (manager_xrandr->xdisplay,
(XID)output->output_id, (XID)output->winsys_id,
atom, atom,
XA_INTEGER, 32, PropModeReplace, XA_INTEGER, 32, PropModeReplace,
(unsigned char *) &hw_value, 1); (unsigned char *) &hw_value, 1);

View File

@ -109,7 +109,7 @@ meta_surface_actor_wayland_is_unredirected (MetaSurfaceActor *actor)
} }
static int static int
get_output_scale (int output_id) get_output_scale (int winsys_id)
{ {
MetaMonitorManager *monitor_manager = meta_monitor_manager_get (); MetaMonitorManager *monitor_manager = meta_monitor_manager_get ();
MetaOutput *outputs; MetaOutput *outputs;
@ -120,7 +120,7 @@ get_output_scale (int output_id)
for (i = 0; i < n_outputs; i++) for (i = 0; i < n_outputs; i++)
{ {
if (outputs[i].output_id == output_id) if (outputs[i].winsys_id == winsys_id)
{ {
output_scale = outputs[i].scale; output_scale = outputs[i].scale;
break; break;
@ -150,7 +150,7 @@ meta_surface_actor_wayland_get_scale (MetaSurfaceActorWayland *actor)
/* XXX: We do not handle x11 clients yet */ /* XXX: We do not handle x11 clients yet */
if (window && window->client_type != META_WINDOW_CLIENT_TYPE_X11) if (window && window->client_type != META_WINDOW_CLIENT_TYPE_X11)
output_scale = get_output_scale (window->monitor->output_id); output_scale = get_output_scale (window->monitor->winsys_id);
return (double)output_scale / (double)priv->surface->scale; return (double)output_scale / (double)priv->surface->scale;
} }

View File

@ -899,7 +899,7 @@ queue_send_frame_messages_timeout (MetaWindowActor *self)
outputs = meta_monitor_manager_get_outputs (monitor_manager, &n_outputs); outputs = meta_monitor_manager_get_outputs (monitor_manager, &n_outputs);
for (i = 0; i < n_outputs; i++) for (i = 0; i < n_outputs; i++)
{ {
if (outputs[i].output_id == window->monitor->output_id && outputs[i].crtc) if (outputs[i].winsys_id == window->monitor->winsys_id && outputs[i].crtc)
{ {
refresh_rate = outputs[i].crtc->current_mode->refresh_rate; refresh_rate = outputs[i].crtc->current_mode->refresh_rate;
break; break;

View File

@ -166,7 +166,7 @@ struct _MetaWindow
* that to toggle between normal/tiled or maximized/tiled states. */ * that to toggle between normal/tiled or maximized/tiled states. */
guint saved_maximize : 1; guint saved_maximize : 1;
int tile_monitor_number; int tile_monitor_number;
int preferred_output_id; int preferred_output_winsys_id;
/* Whether we're shaded */ /* Whether we're shaded */
guint shaded : 1; guint shaded : 1;

View File

@ -937,7 +937,7 @@ _meta_window_shared_new (MetaDisplay *display,
window->compositor_private = NULL; window->compositor_private = NULL;
window->monitor = meta_screen_get_monitor_for_window (window->screen, window); window->monitor = meta_screen_get_monitor_for_window (window->screen, window);
window->preferred_output_id = window->monitor->output_id; window->preferred_output_winsys_id = window->monitor->winsys_id;
window->tile_match = NULL; window->tile_match = NULL;
@ -3527,8 +3527,8 @@ meta_window_get_monitor (MetaWindow *window)
} }
static MetaMonitorInfo * static MetaMonitorInfo *
find_monitor_by_id (MetaWindow *window, find_monitor_by_winsys_id (MetaWindow *window,
guint id) guint winsys_id)
{ {
int i; int i;
@ -3536,7 +3536,7 @@ find_monitor_by_id (MetaWindow *window,
{ {
MetaMonitorInfo *info = &window->screen->monitor_infos[i]; MetaMonitorInfo *info = &window->screen->monitor_infos[i];
if (info->output_id == id) if (info->winsys_id == winsys_id)
return info; return info;
} }
@ -3562,11 +3562,11 @@ meta_window_update_for_monitors_changed (MetaWindow *window)
old = window->monitor; old = window->monitor;
/* Try the preferred output first */ /* Try the preferred output first */
new = find_monitor_by_id (window, window->preferred_output_id); new = find_monitor_by_winsys_id (window, window->preferred_output_winsys_id);
/* Otherwise, try to find the old output on a new monitor */ /* Otherwise, try to find the old output on a new monitor */
if (!new) if (!new)
new = find_monitor_by_id (window, old->output_id); new = find_monitor_by_winsys_id (window, old->winsys_id);
/* Fall back to primary if everything else failed */ /* Fall back to primary if everything else failed */
if (!new) if (!new)
@ -3649,7 +3649,7 @@ meta_window_move_resize_internal (MetaWindow *window,
*/ */
gboolean did_placement; gboolean did_placement;
guint old_output_id; guint old_output_winsys_id;
MetaRectangle unconstrained_rect; MetaRectangle unconstrained_rect;
MetaRectangle constrained_rect; MetaRectangle constrained_rect;
MetaMoveResizeResultFlags result = 0; MetaMoveResizeResultFlags result = 0;
@ -3734,13 +3734,13 @@ meta_window_move_resize_internal (MetaWindow *window,
did_placement); did_placement);
} }
old_output_id = window->monitor->output_id; old_output_winsys_id = window->monitor->winsys_id;
meta_window_update_monitor (window, flags & META_IS_USER_ACTION); meta_window_update_monitor (window, flags & META_IS_USER_ACTION);
if (old_output_id != window->monitor->output_id && if (old_output_winsys_id != window->monitor->winsys_id &&
flags & META_IS_MOVE_ACTION && flags & META_IS_USER_ACTION) flags & META_IS_MOVE_ACTION && flags & META_IS_USER_ACTION)
window->preferred_output_id = window->monitor->output_id; window->preferred_output_winsys_id = window->monitor->winsys_id;
if ((result & META_MOVE_RESIZE_RESULT_FRAME_SHAPE_CHANGED) && window->frame_bounds) if ((result & META_MOVE_RESIZE_RESULT_FRAME_SHAPE_CHANGED) && window->frame_bounds)
{ {
@ -3860,7 +3860,7 @@ meta_window_move_to_monitor (MetaWindow *window,
window->tile_monitor_number = monitor; window->tile_monitor_number = monitor;
meta_window_move_between_rects (window, &old_area, &new_area); meta_window_move_between_rects (window, &old_area, &new_area);
window->preferred_output_id = window->monitor->output_id; window->preferred_output_winsys_id = window->monitor->winsys_id;
if (window->fullscreen || window->override_redirect) if (window->fullscreen || window->override_redirect)
meta_screen_queue_check_fullscreen (window->screen); meta_screen_queue_check_fullscreen (window->screen);

View File

@ -236,15 +236,15 @@ meta_wayland_compositor_update_outputs (MetaWaylandCompositor *compositor,
/* wayland does not expose disabled outputs */ /* wayland does not expose disabled outputs */
if (output->crtc == NULL) if (output->crtc == NULL)
{ {
g_hash_table_remove (compositor->outputs, GSIZE_TO_POINTER (output->output_id)); g_hash_table_remove (compositor->outputs, GSIZE_TO_POINTER (output->winsys_id));
continue; continue;
} }
wayland_output = g_hash_table_lookup (compositor->outputs, GSIZE_TO_POINTER (output->output_id)); wayland_output = g_hash_table_lookup (compositor->outputs, GSIZE_TO_POINTER (output->winsys_id));
if (wayland_output) if (wayland_output)
{ {
g_hash_table_steal (compositor->outputs, GSIZE_TO_POINTER (output->output_id)); g_hash_table_steal (compositor->outputs, GSIZE_TO_POINTER (output->winsys_id));
} }
else else
{ {
@ -256,7 +256,7 @@ meta_wayland_compositor_update_outputs (MetaWaylandCompositor *compositor,
} }
wayland_output_update_for_output (wayland_output, output); wayland_output_update_for_output (wayland_output, output);
g_hash_table_insert (new_table, GSIZE_TO_POINTER (output->output_id), wayland_output); g_hash_table_insert (new_table, GSIZE_TO_POINTER (output->winsys_id), wayland_output);
} }
g_hash_table_destroy (compositor->outputs); g_hash_table_destroy (compositor->outputs);