MetaMonitorInfo: Provide scale information
Tracking back from the monitor to the output every time we need to figure out the scale of a window on a monitor is inconvenient, so propagate the scale from the output to the monitor it is associated with. https://bugzilla.gnome.org/show_bug.cgi?id=744934
This commit is contained in:
parent
208da2316d
commit
441efd17ce
@ -217,6 +217,7 @@ struct _MetaMonitorInfo
|
||||
gboolean is_primary;
|
||||
gboolean is_presentation; /* XXX: not yet used */
|
||||
gboolean in_fullscreen;
|
||||
int scale;
|
||||
|
||||
/* The primary or first output for this monitor, 0 if we can't figure out.
|
||||
It can be matched to a winsys_id of a MetaOutput.
|
||||
|
@ -220,6 +220,7 @@ make_logical_config (MetaMonitorManager *manager)
|
||||
info.tile_group_id = 0;
|
||||
info.rect = crtc->rect;
|
||||
info.refresh_rate = crtc->current_mode->refresh_rate;
|
||||
info.scale = 1;
|
||||
info.is_primary = FALSE;
|
||||
/* This starts true because we want
|
||||
is_presentation only if all outputs are
|
||||
@ -270,7 +271,10 @@ make_logical_config (MetaMonitorManager *manager)
|
||||
info->n_outputs = 1;
|
||||
|
||||
if (output->is_primary || info->winsys_id == 0)
|
||||
info->winsys_id = output->winsys_id;
|
||||
{
|
||||
info->scale = output->scale;
|
||||
info->winsys_id = output->winsys_id;
|
||||
}
|
||||
|
||||
if (info->is_primary)
|
||||
manager->primary_monitor_index = info->number;
|
||||
|
@ -415,23 +415,7 @@ should_do_pending_move (MetaWindowWayland *wl_window,
|
||||
int
|
||||
meta_window_wayland_get_main_monitor_scale (MetaWindow *window)
|
||||
{
|
||||
MetaMonitorManager *monitor_manager = meta_monitor_manager_get ();
|
||||
MetaOutput *outputs;
|
||||
guint n_outputs, i;
|
||||
int output_scale = 1;
|
||||
|
||||
outputs = meta_monitor_manager_get_outputs (monitor_manager, &n_outputs);
|
||||
|
||||
for (i = 0; i < n_outputs; i++)
|
||||
{
|
||||
if (outputs[i].winsys_id == window->monitor->winsys_id)
|
||||
{
|
||||
output_scale = outputs[i].scale;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return output_scale;
|
||||
return window->monitor->scale;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user