DisplayConfig: Add logical monitor transforms
Add the transform as a logical monitor parameter, both when getting the current state and applying a new configuration. The transform is defined to be identical to MetaMonitorTransform. https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
parent
17c54c6e03
commit
0ac2eba4d3
2 changed files with 44 additions and 15 deletions
|
@ -1304,7 +1304,7 @@ meta_monitor_manager_legacy_handle_apply_configuration (MetaDBusDisplayConfig *
|
|||
#define MONITORS_FORMAT "a" MONITOR_FORMAT
|
||||
|
||||
#define LOGICAL_MONITOR_MONITORS_FORMAT "a" MONITOR_SPEC_FORMAT
|
||||
#define LOGICAL_MONITOR_FORMAT "(iidb" LOGICAL_MONITOR_MONITORS_FORMAT "a{sv})"
|
||||
#define LOGICAL_MONITOR_FORMAT "(iidub" LOGICAL_MONITOR_MONITORS_FORMAT "a{sv})"
|
||||
#define LOGICAL_MONITORS_FORMAT "a" LOGICAL_MONITOR_FORMAT
|
||||
|
||||
static gboolean
|
||||
|
@ -1422,6 +1422,7 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton,
|
|||
logical_monitor->rect.x,
|
||||
logical_monitor->rect.y,
|
||||
(double) logical_monitor->scale,
|
||||
logical_monitor->transform,
|
||||
logical_monitor->is_primary,
|
||||
&logical_monitor_monitors_builder,
|
||||
NULL);
|
||||
|
@ -1583,7 +1584,7 @@ find_monitor_spec (MetaMonitorManager *manager,
|
|||
#define MONITOR_CONFIG_FORMAT "(s" MONITOR_MODE_SPEC_FORMAT "a{sv})"
|
||||
#define MONITOR_CONFIGS_FORMAT "a" MONITOR_CONFIG_FORMAT
|
||||
|
||||
#define LOGICAL_MONITOR_CONFIG_FORMAT "(iidb" MONITOR_CONFIGS_FORMAT ")"
|
||||
#define LOGICAL_MONITOR_CONFIG_FORMAT "(iidub" MONITOR_CONFIGS_FORMAT ")"
|
||||
|
||||
static MetaMonitorConfig *
|
||||
create_monitor_config_from_variant (MetaMonitorManager *manager,
|
||||
|
@ -1647,13 +1648,15 @@ create_monitor_config_from_variant (MetaMonitorManager *manager,
|
|||
|
||||
static gboolean
|
||||
derive_logical_monitor_size (GList *monitor_configs,
|
||||
int *width,
|
||||
int *height,
|
||||
int *out_width,
|
||||
int *out_height,
|
||||
double scale,
|
||||
MetaMonitorTransform transform,
|
||||
MetaLogicalMonitorLayoutMode layout_mode,
|
||||
GError **error)
|
||||
{
|
||||
MetaMonitorConfig *monitor_config;
|
||||
int width, height;
|
||||
|
||||
if (!monitor_configs)
|
||||
{
|
||||
|
@ -1664,19 +1667,31 @@ derive_logical_monitor_size (GList *monitor_configs,
|
|||
|
||||
monitor_config = monitor_configs->data;
|
||||
|
||||
if (meta_monitor_transform_is_rotated (transform))
|
||||
{
|
||||
width = monitor_config->mode_spec->height;
|
||||
height = monitor_config->mode_spec->width;
|
||||
}
|
||||
else
|
||||
{
|
||||
width = monitor_config->mode_spec->width;
|
||||
height = monitor_config->mode_spec->height;
|
||||
}
|
||||
|
||||
switch (layout_mode)
|
||||
{
|
||||
case META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL:
|
||||
*width = monitor_config->mode_spec->width / scale;
|
||||
*height = monitor_config->mode_spec->height / scale;
|
||||
return TRUE;
|
||||
width /= scale;
|
||||
height /= scale;
|
||||
break;
|
||||
case META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL:
|
||||
*width = monitor_config->mode_spec->width;
|
||||
*height = monitor_config->mode_spec->height;
|
||||
return TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
g_assert_not_reached ();
|
||||
*out_width = width;
|
||||
*out_height = height;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static MetaLogicalMonitorConfig *
|
||||
|
@ -1688,6 +1703,7 @@ create_logical_monitor_config_from_variant (MetaMonitorManager *manager
|
|||
MetaLogicalMonitorConfig *logical_monitor_config;
|
||||
int x, y, width, height;
|
||||
double scale;
|
||||
MetaMonitorTransform transform;
|
||||
gboolean is_primary;
|
||||
GVariantIter *monitor_configs_iter;
|
||||
GList *monitor_configs = NULL;
|
||||
|
@ -1696,6 +1712,7 @@ create_logical_monitor_config_from_variant (MetaMonitorManager *manager
|
|||
&x,
|
||||
&y,
|
||||
&scale,
|
||||
&transform,
|
||||
&is_primary,
|
||||
&monitor_configs_iter);
|
||||
|
||||
|
@ -1725,7 +1742,7 @@ create_logical_monitor_config_from_variant (MetaMonitorManager *manager
|
|||
g_variant_iter_free (monitor_configs_iter);
|
||||
|
||||
if (!derive_logical_monitor_size (monitor_configs, &width, &height,
|
||||
scale, layout_mode, error))
|
||||
scale, transform, layout_mode, error))
|
||||
goto err;
|
||||
|
||||
logical_monitor_config = g_new0 (MetaLogicalMonitorConfig, 1);
|
||||
|
@ -1736,7 +1753,7 @@ create_logical_monitor_config_from_variant (MetaMonitorManager *manager
|
|||
.width = width,
|
||||
.height = height
|
||||
},
|
||||
.transform = META_MONITOR_TRANSFORM_NORMAL,
|
||||
.transform = transform,
|
||||
.scale = (int) scale,
|
||||
.is_primary = is_primary,
|
||||
.monitor_configs = monitor_configs
|
||||
|
|
|
@ -342,6 +342,7 @@
|
|||
* i x: x position
|
||||
* i y: y position
|
||||
* d scale: scale
|
||||
* u transform: transform (see below)
|
||||
* b primary: true if this is the primary logical monitor
|
||||
* a(sss) monitors: monitors displaying this logical monitor
|
||||
* connector: name of the connector (e.g. DP-1, eDP-1 etc)
|
||||
|
@ -350,6 +351,16 @@
|
|||
* serial: product serial
|
||||
* a{sv} properties: possibly other properties
|
||||
|
||||
Posisble transform values:
|
||||
0: normal
|
||||
1: 90°
|
||||
2: 180°
|
||||
3: 270°
|
||||
4: flipped
|
||||
5: 90° flipped
|
||||
6: 180° flipped
|
||||
7: 270° flipped
|
||||
|
||||
|
||||
@supported_scales is an ordered list of floating point numbers representing
|
||||
scale factors of logical monitors supported by the display server.
|
||||
|
@ -387,7 +398,7 @@
|
|||
<method name="GetCurrentState">
|
||||
<arg name="serial" direction="out" type="u" />
|
||||
<arg name="monitors" direction="out" type="a((ssss)a(iiddu)a{sv})" />
|
||||
<arg name="logical_monitors" direction="out" type="a(iidba(ssss)a{sv})" />
|
||||
<arg name="logical_monitors" direction="out" type="a(iiduba(ssss)a{sv})" />
|
||||
<arg name="supported_scales" direction="out" type="ad" />
|
||||
<arg name="properties" direction="out" type="a{sv}" />
|
||||
</method>
|
||||
|
@ -412,6 +423,7 @@
|
|||
* i: layout x position
|
||||
* i: layout y position
|
||||
* d: scale
|
||||
* u: transform (see GetCurrentState)
|
||||
* b primary: true if this is the primary logical monitor
|
||||
* a(siida{sv}): a list of monitors, each consisting of:
|
||||
* s: connector
|
||||
|
@ -432,7 +444,7 @@
|
|||
<method name="ApplyMonitorsConfig">
|
||||
<arg name="serial" direction="in" type="u" />
|
||||
<arg name="method" direction="in" type="u" />
|
||||
<arg name="logical_monitors" direction="in" type="a(iidba(s(iid)a{sv}))" />
|
||||
<arg name="logical_monitors" direction="in" type="a(iiduba(s(iid)a{sv}))" />
|
||||
<arg name="properties" direction="in" type="a{sv}" />
|
||||
</method>
|
||||
</interface>
|
||||
|
|
Loading…
Reference in a new issue