logical-monitor: Don't mirror refresh rate

Let the callers figure out how to associate a logical monitor with a
refresh rate, instead of exposing an arbitrary one.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
Jonas Ådahl 2016-12-13 22:08:17 +08:00
parent 5d66a13397
commit 3c6d688c87
4 changed files with 9 additions and 5 deletions

View File

@ -43,7 +43,6 @@ meta_logical_monitor_new (MetaMonitor *monitor,
main_output = meta_monitor_get_main_output (monitor); main_output = meta_monitor_get_main_output (monitor);
logical_monitor->number = number; logical_monitor->number = number;
logical_monitor->refresh_rate = main_output->crtc->current_mode->refresh_rate;
logical_monitor->winsys_id = main_output->winsys_id; logical_monitor->winsys_id = main_output->winsys_id;
logical_monitor->scale = main_output->scale; logical_monitor->scale = main_output->scale;
logical_monitor->in_fullscreen = -1; logical_monitor->in_fullscreen = -1;

View File

@ -37,7 +37,6 @@ struct _MetaLogicalMonitor
int number; int number;
MetaRectangle rect; MetaRectangle rect;
/* for tiled monitors these are calculated, from untiled just copied */ /* for tiled monitors these are calculated, from untiled just copied */
float refresh_rate;
gboolean is_primary; gboolean is_primary;
gboolean is_presentation; /* XXX: not yet used */ gboolean is_presentation; /* XXX: not yet used */
gboolean in_fullscreen; gboolean in_fullscreen;

View File

@ -77,12 +77,16 @@ send_output_events (struct wl_resource *resource,
MetaLogicalMonitor *old_logical_monitor; MetaLogicalMonitor *old_logical_monitor;
guint old_mode_flags; guint old_mode_flags;
gint old_scale; gint old_scale;
float old_refresh_rate;
float refresh_rate;
old_logical_monitor = wayland_output->logical_monitor; old_logical_monitor = wayland_output->logical_monitor;
old_mode_flags = wayland_output->mode_flags; old_mode_flags = wayland_output->mode_flags;
old_scale = wayland_output->scale; old_scale = wayland_output->scale;
old_refresh_rate = wayland_output->refresh_rate;
output = pick_main_output (logical_monitor); output = pick_main_output (logical_monitor);
refresh_rate = output->crtc->current_mode->refresh_rate;
gboolean need_done = FALSE; gboolean need_done = FALSE;
@ -114,14 +118,14 @@ send_output_events (struct wl_resource *resource,
if (need_all_events || if (need_all_events ||
old_logical_monitor->rect.width != logical_monitor->rect.width || old_logical_monitor->rect.width != logical_monitor->rect.width ||
old_logical_monitor->rect.height != logical_monitor->rect.height || old_logical_monitor->rect.height != logical_monitor->rect.height ||
old_logical_monitor->refresh_rate != logical_monitor->refresh_rate || old_refresh_rate != refresh_rate ||
old_mode_flags != mode_flags) old_mode_flags != mode_flags)
{ {
wl_output_send_mode (resource, wl_output_send_mode (resource,
mode_flags, mode_flags,
logical_monitor->rect.width, logical_monitor->rect.width,
logical_monitor->rect.height, logical_monitor->rect.height,
(int32_t) (logical_monitor->refresh_rate * 1000)); (int32_t) (refresh_rate * 1000));
need_done = TRUE; need_done = TRUE;
} }
@ -161,7 +165,7 @@ bind_output (struct wl_client *client,
logical_monitor, output->name, logical_monitor, output->name,
logical_monitor->rect.x, logical_monitor->rect.y, logical_monitor->rect.x, logical_monitor->rect.y,
logical_monitor->rect.width, logical_monitor->rect.height, logical_monitor->rect.width, logical_monitor->rect.height,
logical_monitor->refresh_rate); wayland_output->refresh_rate);
send_output_events (resource, wayland_output, logical_monitor, TRUE); send_output_events (resource, wayland_output, logical_monitor, TRUE);
} }
@ -188,6 +192,7 @@ meta_wayland_output_set_logical_monitor (MetaWaylandOutput *wayland_output,
if (output->crtc->current_mode == output->preferred_mode) if (output->crtc->current_mode == output->preferred_mode)
wayland_output->mode_flags |= WL_OUTPUT_MODE_PREFERRED; wayland_output->mode_flags |= WL_OUTPUT_MODE_PREFERRED;
wayland_output->scale = output->scale; wayland_output->scale = output->scale;
wayland_output->refresh_rate = output->crtc->current_mode->refresh_rate;
} }
static void static void

View File

@ -39,6 +39,7 @@ struct _MetaWaylandOutput
struct wl_global *global; struct wl_global *global;
MetaLogicalMonitor *logical_monitor; MetaLogicalMonitor *logical_monitor;
guint mode_flags; guint mode_flags;
float refresh_rate;
gint scale; gint scale;
GList *resources; GList *resources;