From af135c0b0b1ffd8d82ee5e567a22fdb2a25e126d Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Tue, 1 Jul 2014 13:23:05 -0400 Subject: [PATCH] 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". --- src/backends/meta-monitor-manager-dummy.c | 2 +- src/backends/meta-monitor-manager.c | 8 ++-- src/backends/meta-monitor-manager.h | 6 +-- .../native/meta-monitor-manager-kms.c | 10 ++--- .../x11/meta-monitor-manager-xrandr.c | 38 +++++++++---------- src/compositor/meta-surface-actor-wayland.c | 6 +-- src/compositor/meta-window-actor.c | 2 +- src/core/window-private.h | 2 +- src/core/window.c | 22 +++++------ src/wayland/meta-wayland-outputs.c | 8 ++-- 10 files changed, 52 insertions(+), 52 deletions(-) diff --git a/src/backends/meta-monitor-manager-dummy.c b/src/backends/meta-monitor-manager-dummy.c index 46cea9396..a9c9928f9 100644 --- a/src/backends/meta-monitor-manager-dummy.c +++ b/src/backends/meta-monitor-manager-dummy.c @@ -75,7 +75,7 @@ meta_monitor_manager_dummy_read_current (MetaMonitorManager *manager) manager->n_outputs = 1; 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].vendor = g_strdup ("MetaProducts Inc."); manager->outputs[0].product = g_strdup ("unknown"); diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c index e3179528b..16c9666f6 100644 --- a/src/backends/meta-monitor-manager.c +++ b/src/backends/meta-monitor-manager.c @@ -125,7 +125,7 @@ make_logical_config (MetaMonitorManager *manager) */ info.is_presentation = TRUE; info.in_fullscreen = -1; - info.output_id = 0; + info.winsys_id = 0; 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_presentation = info->is_presentation && output->is_presentation; - if (output->is_primary || info->output_id == 0) - info->output_id = output->output_id; + if (output->is_primary || info->winsys_id == 0) + info->winsys_id = output->winsys_id; if (info->is_primary) 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})", i, /* ID */ - (gint64)output->output_id, + (gint64)output->winsys_id, (int)(output->crtc ? output->crtc - manager->crtcs : -1), &crtcs, output->name, diff --git a/src/backends/meta-monitor-manager.h b/src/backends/meta-monitor-manager.h index b5bc927a5..fc50224f6 100644 --- a/src/backends/meta-monitor-manager.h +++ b/src/backends/meta-monitor-manager.h @@ -65,7 +65,7 @@ struct _MetaOutput /* The CRTC driving this output, NULL if the output is not enabled */ MetaCRTC *crtc; /* The low-level ID of this output, used to apply back configuration */ - glong output_id; + glong winsys_id; char *name; char *vendor; char *product; @@ -162,14 +162,14 @@ struct _MetaMonitorInfo gboolean in_fullscreen; /* 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 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 the primary one). */ - glong output_id; + glong winsys_id; }; /* diff --git a/src/backends/native/meta-monitor-manager-kms.c b/src/backends/native/meta-monitor-manager-kms.c index a8af37596..10604e5c6 100644 --- a/src/backends/native/meta-monitor-manager-kms.c +++ b/src/backends/native/meta-monitor-manager-kms.c @@ -259,7 +259,7 @@ find_output_by_id (MetaOutput *outputs, unsigned i; for (i = 0; i < n_outputs; i++) - if (outputs[i].output_id == id) + if (outputs[i].winsys_id == id) return &outputs[i]; 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_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->width_mm = connector->mmWidth; meta_output->height_mm = connector->mmHeight; @@ -491,7 +491,7 @@ meta_monitor_manager_kms_read_current (MetaMonitorManager *manager) meta_output->crtc = NULL; old_output = find_output_by_id (old_outputs, n_old_outputs, - meta_output->output_id); + meta_output->winsys_id); if (old_output) { 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) { - 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); 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); - connectors[j] = output->output_id; + connectors[j] = output->winsys_id; output->is_dirty = TRUE; output->crtc = crtc; diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c index 0c640b75f..e85e26242 100644 --- a/src/backends/x11/meta-monitor-manager-xrandr.c +++ b/src/backends/x11/meta-monitor-manager-xrandr.c @@ -150,7 +150,7 @@ output_get_presentation_xrandr (MetaMonitorManagerXrandr *manager_xrandr, atom = XInternAtom (manager_xrandr->xdisplay, "_MUTTER_PRESENTATION_OUTPUT", False); XRRGetOutputProperty (manager_xrandr->xdisplay, - (XID)output->output_id, + (XID)output->winsys_id, atom, 0, G_MAXLONG, False, False, XA_CARDINAL, &actual_type, &actual_format, @@ -186,7 +186,7 @@ output_get_backlight_xrandr (MetaMonitorManagerXrandr *manager_xrandr, atom = XInternAtom (manager_xrandr->xdisplay, "Backlight", False); XRRGetOutputProperty (manager_xrandr->xdisplay, - (XID)output->output_id, + (XID)output->winsys_id, atom, 0, G_MAXLONG, False, False, XA_INTEGER, &actual_type, &actual_format, @@ -211,7 +211,7 @@ output_get_backlight_limits_xrandr (MetaMonitorManagerXrandr *manager_xrandr, atom = XInternAtom (manager_xrandr->xdisplay, "Backlight", False); info = XRRQueryOutputProperty (manager_xrandr->xdisplay, - (XID)output->output_id, + (XID)output->winsys_id, atom); if (info == NULL) @@ -278,25 +278,25 @@ get_edid_property (Display *dpy, static GBytes * read_output_edid (MetaMonitorManagerXrandr *manager_xrandr, - XID output_id) + XID winsys_id) { Atom edid_atom; guint8 *result; gsize len; 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) { 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) { 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) @@ -312,14 +312,14 @@ read_output_edid (MetaMonitorManagerXrandr *manager_xrandr, static gboolean output_get_hotplug_mode_update (MetaMonitorManagerXrandr *manager_xrandr, - XID output_id) + XID winsys_id) { Atom atom; XRRPropertyInfo *info; gboolean result = 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); if (info) @@ -467,10 +467,10 @@ meta_monitor_manager_xrandr_read_current (MetaMonitorManager *manager) GBytes *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); - edid = read_output_edid (manager_xrandr, meta_output->output_id); + edid = read_output_edid (manager_xrandr, meta_output->winsys_id); if (edid) { gsize len; @@ -504,7 +504,7 @@ meta_monitor_manager_xrandr_read_current (MetaMonitorManager *manager) meta_output->height_mm = output->mm_height; meta_output->subpixel_order = COGL_SUBPIXEL_ORDER_UNKNOWN; 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->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->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); 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++) { - if (clone == (XID)manager->outputs[k].output_id) + if (clone == (XID)manager->outputs[k].winsys_id) { meta_output->possible_clones[j] = &manager->outputs[k]; break; @@ -605,7 +605,7 @@ meta_monitor_manager_xrandr_read_edid (MetaMonitorManager *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 @@ -672,7 +672,7 @@ output_set_presentation_xrandr (MetaMonitorManagerXrandr *manager_xrandr, atom = XInternAtom (manager_xrandr->xdisplay, "_MUTTER_PRESENTATION_OUTPUT", False); XRRChangeOutputProperty (manager_xrandr->xdisplay, - (XID)output->output_id, + (XID)output->winsys_id, atom, XA_CARDINAL, 32, PropModeReplace, (unsigned char*) &value, 1); @@ -828,7 +828,7 @@ meta_monitor_manager_xrandr_apply_configuration (MetaMonitorManager *manager, output->crtc = crtc; new_controlled_mask |= 1UL << j; - outputs[j] = output->output_id; + outputs[j] = output->winsys_id; } if (crtc->current_mode == mode && @@ -891,7 +891,7 @@ meta_monitor_manager_xrandr_apply_configuration (MetaMonitorManager *manager, { XRRSetOutputPrimary (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, @@ -934,7 +934,7 @@ meta_monitor_manager_xrandr_change_backlight (MetaMonitorManager *manager, atom = XInternAtom (manager_xrandr->xdisplay, "Backlight", False); XRRChangeOutputProperty (manager_xrandr->xdisplay, - (XID)output->output_id, + (XID)output->winsys_id, atom, XA_INTEGER, 32, PropModeReplace, (unsigned char *) &hw_value, 1); diff --git a/src/compositor/meta-surface-actor-wayland.c b/src/compositor/meta-surface-actor-wayland.c index 7846b29ed..31be26f8a 100644 --- a/src/compositor/meta-surface-actor-wayland.c +++ b/src/compositor/meta-surface-actor-wayland.c @@ -109,7 +109,7 @@ meta_surface_actor_wayland_is_unredirected (MetaSurfaceActor *actor) } static int -get_output_scale (int output_id) +get_output_scale (int winsys_id) { MetaMonitorManager *monitor_manager = meta_monitor_manager_get (); MetaOutput *outputs; @@ -120,7 +120,7 @@ get_output_scale (int output_id) 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; break; @@ -150,7 +150,7 @@ meta_surface_actor_wayland_get_scale (MetaSurfaceActorWayland *actor) /* XXX: We do not handle x11 clients yet */ 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; } diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c index 363c98068..4f1e23885 100644 --- a/src/compositor/meta-window-actor.c +++ b/src/compositor/meta-window-actor.c @@ -899,7 +899,7 @@ queue_send_frame_messages_timeout (MetaWindowActor *self) outputs = meta_monitor_manager_get_outputs (monitor_manager, &n_outputs); 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; break; diff --git a/src/core/window-private.h b/src/core/window-private.h index 3cd326332..330f22635 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -166,7 +166,7 @@ struct _MetaWindow * that to toggle between normal/tiled or maximized/tiled states. */ guint saved_maximize : 1; int tile_monitor_number; - int preferred_output_id; + int preferred_output_winsys_id; /* Whether we're shaded */ guint shaded : 1; diff --git a/src/core/window.c b/src/core/window.c index e1300b22f..1c05621b7 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -937,7 +937,7 @@ _meta_window_shared_new (MetaDisplay *display, window->compositor_private = NULL; 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; @@ -3527,8 +3527,8 @@ meta_window_get_monitor (MetaWindow *window) } static MetaMonitorInfo * -find_monitor_by_id (MetaWindow *window, - guint id) +find_monitor_by_winsys_id (MetaWindow *window, + guint winsys_id) { int i; @@ -3536,7 +3536,7 @@ find_monitor_by_id (MetaWindow *window, { MetaMonitorInfo *info = &window->screen->monitor_infos[i]; - if (info->output_id == id) + if (info->winsys_id == winsys_id) return info; } @@ -3562,11 +3562,11 @@ meta_window_update_for_monitors_changed (MetaWindow *window) old = window->monitor; /* 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 */ 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 */ if (!new) @@ -3649,7 +3649,7 @@ meta_window_move_resize_internal (MetaWindow *window, */ gboolean did_placement; - guint old_output_id; + guint old_output_winsys_id; MetaRectangle unconstrained_rect; MetaRectangle constrained_rect; MetaMoveResizeResultFlags result = 0; @@ -3734,13 +3734,13 @@ meta_window_move_resize_internal (MetaWindow *window, 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); - 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) - 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) { @@ -3860,7 +3860,7 @@ meta_window_move_to_monitor (MetaWindow *window, window->tile_monitor_number = monitor; 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) meta_screen_queue_check_fullscreen (window->screen); diff --git a/src/wayland/meta-wayland-outputs.c b/src/wayland/meta-wayland-outputs.c index 0eb26f21f..e17e9df68 100644 --- a/src/wayland/meta-wayland-outputs.c +++ b/src/wayland/meta-wayland-outputs.c @@ -236,15 +236,15 @@ meta_wayland_compositor_update_outputs (MetaWaylandCompositor *compositor, /* wayland does not expose disabled outputs */ 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; } - 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) { - 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 { @@ -256,7 +256,7 @@ meta_wayland_compositor_update_outputs (MetaWaylandCompositor *compositor, } 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);