mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 12:32:05 +00:00
monitor-config-manager: Put logical monitor size scaling into helper
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2479>
This commit is contained in:
parent
0d47b467f6
commit
b2ba653dd9
@ -716,6 +716,29 @@ get_monitor_transform (MetaMonitorManager *monitor_manager,
|
|||||||
return meta_monitor_transform_from_orientation (orientation);
|
return meta_monitor_transform_from_orientation (orientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
scale_logical_monitor_width (MetaLogicalMonitorLayoutMode layout_mode,
|
||||||
|
float scale,
|
||||||
|
int mode_width,
|
||||||
|
int mode_height,
|
||||||
|
int *width,
|
||||||
|
int *height)
|
||||||
|
{
|
||||||
|
switch (layout_mode)
|
||||||
|
{
|
||||||
|
case META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL:
|
||||||
|
*width = (int) roundf (mode_width / scale);
|
||||||
|
*height = (int) roundf (mode_height / scale);
|
||||||
|
return;
|
||||||
|
case META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL:
|
||||||
|
*width = mode_width;
|
||||||
|
*height = mode_height;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_assert_not_reached ();
|
||||||
|
}
|
||||||
|
|
||||||
static MetaLogicalMonitorConfig *
|
static MetaLogicalMonitorConfig *
|
||||||
create_preferred_logical_monitor_config (MetaMonitorManager *monitor_manager,
|
create_preferred_logical_monitor_config (MetaMonitorManager *monitor_manager,
|
||||||
MetaMonitor *monitor,
|
MetaMonitor *monitor,
|
||||||
@ -732,16 +755,8 @@ create_preferred_logical_monitor_config (MetaMonitorManager *monitor_ma
|
|||||||
|
|
||||||
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_logical_monitor_width (layout_mode, scale,
|
||||||
switch (layout_mode)
|
width, height, &width, &height);
|
||||||
{
|
|
||||||
case META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL:
|
|
||||||
width = (int) roundf (width / scale);
|
|
||||||
height = (int) roundf (height / scale);
|
|
||||||
break;
|
|
||||||
case META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
monitor_config = create_monitor_config (monitor, mode);
|
monitor_config = create_monitor_config (monitor, mode);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user