backends: Move monitor_transform_from_orientation to orientation manager
This removes the dependency on MetaOrientation from MetaMonitorTransform which makes it possible to move MetaMonitorTransform to Mtk. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3930>
This commit is contained in:
parent
f88b54502c
commit
54b2abfe1b
7 changed files with 26 additions and 24 deletions
|
@ -713,7 +713,7 @@ get_monitor_transform (MetaMonitorManager *monitor_manager,
|
||||||
orientation_manager = meta_backend_get_orientation_manager (backend);
|
orientation_manager = meta_backend_get_orientation_manager (backend);
|
||||||
orientation = meta_orientation_manager_get_orientation (orientation_manager);
|
orientation = meta_orientation_manager_get_orientation (orientation_manager);
|
||||||
|
|
||||||
return meta_monitor_transform_from_orientation (orientation);
|
return meta_orientation_to_transform (orientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -902,7 +902,7 @@ handle_orientation_change (MetaOrientationManager *orientation_manager,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
orientation = meta_orientation_manager_get_orientation (orientation_manager);
|
orientation = meta_orientation_manager_get_orientation (orientation_manager);
|
||||||
transform = meta_monitor_transform_from_orientation (orientation);
|
transform = meta_orientation_to_transform (orientation);
|
||||||
|
|
||||||
laptop_logical_monitor = meta_monitor_get_logical_monitor (laptop_panel);
|
laptop_logical_monitor = meta_monitor_get_logical_monitor (laptop_panel);
|
||||||
panel_transform =
|
panel_transform =
|
||||||
|
|
|
@ -19,24 +19,6 @@
|
||||||
|
|
||||||
#include "backends/meta-monitor-transform.h"
|
#include "backends/meta-monitor-transform.h"
|
||||||
|
|
||||||
MetaMonitorTransform
|
|
||||||
meta_monitor_transform_from_orientation (MetaOrientation orientation)
|
|
||||||
{
|
|
||||||
switch (orientation)
|
|
||||||
{
|
|
||||||
case META_ORIENTATION_BOTTOM_UP:
|
|
||||||
return META_MONITOR_TRANSFORM_180;
|
|
||||||
case META_ORIENTATION_LEFT_UP:
|
|
||||||
return META_MONITOR_TRANSFORM_90;
|
|
||||||
case META_ORIENTATION_RIGHT_UP:
|
|
||||||
return META_MONITOR_TRANSFORM_270;
|
|
||||||
case META_ORIENTATION_UNDEFINED:
|
|
||||||
case META_ORIENTATION_NORMAL:
|
|
||||||
default:
|
|
||||||
return META_MONITOR_TRANSFORM_NORMAL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MetaMonitorTransform
|
MetaMonitorTransform
|
||||||
meta_monitor_transform_invert (MetaMonitorTransform transform)
|
meta_monitor_transform_invert (MetaMonitorTransform transform)
|
||||||
{
|
{
|
||||||
|
|
|
@ -53,9 +53,6 @@ meta_monitor_transform_is_flipped (MetaMonitorTransform transform)
|
||||||
return (transform >= META_MONITOR_TRANSFORM_FLIPPED);
|
return (transform >= META_MONITOR_TRANSFORM_FLIPPED);
|
||||||
}
|
}
|
||||||
|
|
||||||
META_EXPORT_TEST
|
|
||||||
MetaMonitorTransform meta_monitor_transform_from_orientation (MetaOrientation orientation);
|
|
||||||
|
|
||||||
META_EXPORT_TEST
|
META_EXPORT_TEST
|
||||||
MetaMonitorTransform meta_monitor_transform_invert (MetaMonitorTransform transform);
|
MetaMonitorTransform meta_monitor_transform_invert (MetaMonitorTransform transform);
|
||||||
|
|
||||||
|
|
|
@ -75,6 +75,24 @@ G_DEFINE_TYPE (MetaOrientationManager, meta_orientation_manager, G_TYPE_OBJECT)
|
||||||
#define CONF_SCHEMA "org.gnome.settings-daemon.peripherals.touchscreen"
|
#define CONF_SCHEMA "org.gnome.settings-daemon.peripherals.touchscreen"
|
||||||
#define ORIENTATION_LOCK_KEY "orientation-lock"
|
#define ORIENTATION_LOCK_KEY "orientation-lock"
|
||||||
|
|
||||||
|
MetaMonitorTransform
|
||||||
|
meta_orientation_to_transform (MetaOrientation orientation)
|
||||||
|
{
|
||||||
|
switch (orientation)
|
||||||
|
{
|
||||||
|
case META_ORIENTATION_BOTTOM_UP:
|
||||||
|
return META_MONITOR_TRANSFORM_180;
|
||||||
|
case META_ORIENTATION_LEFT_UP:
|
||||||
|
return META_MONITOR_TRANSFORM_90;
|
||||||
|
case META_ORIENTATION_RIGHT_UP:
|
||||||
|
return META_MONITOR_TRANSFORM_270;
|
||||||
|
case META_ORIENTATION_UNDEFINED:
|
||||||
|
case META_ORIENTATION_NORMAL:
|
||||||
|
default:
|
||||||
|
return META_MONITOR_TRANSFORM_NORMAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static MetaOrientation
|
static MetaOrientation
|
||||||
orientation_from_string (const char *orientation)
|
orientation_from_string (const char *orientation)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
|
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
|
||||||
|
#include "backends/meta-monitor-transform.h"
|
||||||
|
#include "core/util-private.h"
|
||||||
#include "meta/common.h"
|
#include "meta/common.h"
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
@ -47,3 +49,6 @@ MetaOrientation meta_orientation_manager_get_orientation (MetaOrientationManager
|
||||||
|
|
||||||
META_EXPORT
|
META_EXPORT
|
||||||
gboolean meta_orientation_manager_has_accelerometer (MetaOrientationManager *self);
|
gboolean meta_orientation_manager_has_accelerometer (MetaOrientationManager *self);
|
||||||
|
|
||||||
|
META_EXPORT_TEST
|
||||||
|
MetaMonitorTransform meta_orientation_to_transform (MetaOrientation orientation);
|
||||||
|
|
|
@ -4086,7 +4086,7 @@ check_monitor_configuration_per_orientation (MonitorTestCase *test_case,
|
||||||
MonitorTestCaseSetup *setup = &test_case->setup;
|
MonitorTestCaseSetup *setup = &test_case->setup;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
transform = meta_monitor_transform_from_orientation (orientation);
|
transform = meta_orientation_to_transform (orientation);
|
||||||
output_transform = setup->outputs[monitor_index].panel_orientation_transform;
|
output_transform = setup->outputs[monitor_index].panel_orientation_transform;
|
||||||
expect.logical_monitors[monitor_index].transform =
|
expect.logical_monitors[monitor_index].transform =
|
||||||
meta_monitor_transform_transform (transform,
|
meta_monitor_transform_transform (transform,
|
||||||
|
|
Loading…
Reference in a new issue