mirror of
https://github.com/brl/mutter.git
synced 2025-07-05 10:31:18 +00:00
backends: Simplify MetaInputSettings vfunc
Rename the set_tablet_keep_aspect() vfunc into a set_tablet_aspect_ratio() one that takes an aspect ratio double, instead of leaking monitor info into subclasses to let them all figure out this number themselves. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403>
This commit is contained in:

committed by
Marge Bot

parent
1dc534ea9e
commit
b56d31ef48
@ -1012,6 +1012,7 @@ update_tablet_keep_aspect (MetaInputSettings *input_settings,
|
||||
MetaInputSettingsClass *input_settings_class;
|
||||
MetaLogicalMonitor *logical_monitor = NULL;
|
||||
gboolean keep_aspect;
|
||||
double aspect_ratio;
|
||||
|
||||
if (clutter_input_device_get_device_type (device) != CLUTTER_TABLET_DEVICE &&
|
||||
clutter_input_device_get_device_type (device) != CLUTTER_PEN_DEVICE &&
|
||||
@ -1037,8 +1038,34 @@ update_tablet_keep_aspect (MetaInputSettings *input_settings,
|
||||
meta_input_settings_find_monitor (input_settings, settings, device,
|
||||
NULL, &logical_monitor);
|
||||
|
||||
input_settings_class->set_tablet_keep_aspect (input_settings, device,
|
||||
logical_monitor, keep_aspect);
|
||||
if (keep_aspect)
|
||||
{
|
||||
int width, height;
|
||||
|
||||
if (logical_monitor)
|
||||
{
|
||||
width = logical_monitor->rect.width;
|
||||
height = logical_monitor->rect.height;
|
||||
}
|
||||
else
|
||||
{
|
||||
MetaMonitorManager *monitor_manager;
|
||||
MetaBackend *backend;
|
||||
|
||||
backend = meta_get_backend ();
|
||||
monitor_manager = meta_backend_get_monitor_manager (backend);
|
||||
meta_monitor_manager_get_screen_size (monitor_manager,
|
||||
&width, &height);
|
||||
}
|
||||
|
||||
aspect_ratio = (double) width / height;
|
||||
}
|
||||
else
|
||||
{
|
||||
aspect_ratio = 0;
|
||||
}
|
||||
|
||||
input_settings_class->set_tablet_aspect_ratio (input_settings, device, aspect_ratio);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user