mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 17:40:40 -05:00
meta-monitor-config: Pass logical monitor scale via config
The default (calculated) scale is derived from the output, but ultimately set via the monitor scale. This will enable config files to override the scale. Yet to be done is handling when a scale is not supported by a backend (i.e. the X11 backend). https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
parent
409c92a68f
commit
753e9c65a1
@ -78,7 +78,7 @@ meta_logical_monitor_new (MetaMonitorManager *monitor_manager,
|
|||||||
|
|
||||||
logical_monitor->number = monitor_number;
|
logical_monitor->number = monitor_number;
|
||||||
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 = logical_monitor_config->scale,
|
||||||
logical_monitor->in_fullscreen = -1;
|
logical_monitor->in_fullscreen = -1;
|
||||||
logical_monitor->rect = logical_monitor_config->layout;
|
logical_monitor->rect = logical_monitor_config->layout;
|
||||||
|
|
||||||
|
@ -467,11 +467,14 @@ create_preferred_logical_monitor_config (MetaMonitor *monitor,
|
|||||||
{
|
{
|
||||||
MetaMonitorMode *mode;
|
MetaMonitorMode *mode;
|
||||||
int width, height;
|
int width, height;
|
||||||
|
int scale;
|
||||||
MetaMonitorConfig *monitor_config;
|
MetaMonitorConfig *monitor_config;
|
||||||
MetaLogicalMonitorConfig *logical_monitor_config;
|
MetaLogicalMonitorConfig *logical_monitor_config;
|
||||||
|
|
||||||
mode = meta_monitor_get_preferred_mode (monitor);
|
mode = meta_monitor_get_preferred_mode (monitor);
|
||||||
meta_monitor_mode_get_resolution (mode, &width, &height);
|
meta_monitor_mode_get_resolution (mode, &width, &height);
|
||||||
|
scale = meta_monitor_get_calculated_scale (monitor);
|
||||||
|
|
||||||
monitor_config = create_monitor_config (monitor, mode);
|
monitor_config = create_monitor_config (monitor, mode);
|
||||||
|
|
||||||
logical_monitor_config = g_new0 (MetaLogicalMonitorConfig, 1);
|
logical_monitor_config = g_new0 (MetaLogicalMonitorConfig, 1);
|
||||||
@ -482,6 +485,7 @@ create_preferred_logical_monitor_config (MetaMonitor *monitor,
|
|||||||
.width = width,
|
.width = width,
|
||||||
.height = height
|
.height = height
|
||||||
},
|
},
|
||||||
|
.scale = scale,
|
||||||
.monitor_configs = g_list_append (NULL, monitor_config)
|
.monitor_configs = g_list_append (NULL, monitor_config)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@ typedef struct _MetaLogicalMonitorConfig
|
|||||||
{
|
{
|
||||||
MetaRectangle layout;
|
MetaRectangle layout;
|
||||||
GList *monitor_configs;
|
GList *monitor_configs;
|
||||||
|
int scale;
|
||||||
gboolean is_primary;
|
gboolean is_primary;
|
||||||
gboolean is_presentation;
|
gboolean is_presentation;
|
||||||
} MetaLogicalMonitorConfig;
|
} MetaLogicalMonitorConfig;
|
||||||
|
@ -405,6 +405,14 @@ static gboolean
|
|||||||
verify_logical_monitor_config (MetaLogicalMonitorConfig *logical_monitor_config,
|
verify_logical_monitor_config (MetaLogicalMonitorConfig *logical_monitor_config,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
|
if (logical_monitor_config->scale < 1)
|
||||||
|
{
|
||||||
|
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||||
|
"Invalid logical monitor config scale %d",
|
||||||
|
logical_monitor_config->scale);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (logical_monitor_config->layout.x < 0 ||
|
if (logical_monitor_config->layout.x < 0 ||
|
||||||
logical_monitor_config->layout.y < 0)
|
logical_monitor_config->layout.y < 0)
|
||||||
{
|
{
|
||||||
@ -614,6 +622,8 @@ handle_end_element (GMarkupParseContext *context,
|
|||||||
|
|
||||||
g_assert (g_str_equal (element_name, "logicalmonitor"));
|
g_assert (g_str_equal (element_name, "logicalmonitor"));
|
||||||
|
|
||||||
|
logical_monitor_config->scale = 1;
|
||||||
|
|
||||||
if (!verify_logical_monitor_config (logical_monitor_config, error))
|
if (!verify_logical_monitor_config (logical_monitor_config, error))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -196,6 +196,16 @@ meta_monitor_is_underscanning (MetaMonitor *monitor)
|
|||||||
return output->is_underscanning;
|
return output->is_underscanning;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
meta_monitor_get_calculated_scale (MetaMonitor *monitor)
|
||||||
|
{
|
||||||
|
MetaOutput *output;
|
||||||
|
|
||||||
|
output = meta_monitor_get_main_output (monitor);
|
||||||
|
|
||||||
|
return output->scale;
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
meta_monitor_is_laptop_panel (MetaMonitor *monitor)
|
meta_monitor_is_laptop_panel (MetaMonitor *monitor)
|
||||||
{
|
{
|
||||||
|
@ -97,6 +97,8 @@ gboolean meta_monitor_is_underscanning (MetaMonitor *monitor);
|
|||||||
|
|
||||||
gboolean meta_monitor_is_laptop_panel (MetaMonitor *monitor);
|
gboolean meta_monitor_is_laptop_panel (MetaMonitor *monitor);
|
||||||
|
|
||||||
|
int meta_monitor_get_calculated_scale (MetaMonitor *monitor);
|
||||||
|
|
||||||
GList * meta_monitor_get_outputs (MetaMonitor *monitor);
|
GList * meta_monitor_get_outputs (MetaMonitor *monitor);
|
||||||
|
|
||||||
void meta_monitor_get_current_resolution (MetaMonitor *monitor,
|
void meta_monitor_get_current_resolution (MetaMonitor *monitor,
|
||||||
|
Loading…
Reference in New Issue
Block a user