mirror of
https://github.com/brl/mutter.git
synced 2025-02-23 08:24:09 +00:00
monitor-manager: Hook MetaOrientationManager to change the config
On orientation changes we'll apply the appropriate monitor transform to the current configuration if possible. https://bugzilla.gnome.org/show_bug.cgi?id=781906
This commit is contained in:
parent
26b66826dc
commit
6ae42f3845
@ -40,6 +40,7 @@
|
|||||||
#include "backends/meta-logical-monitor.h"
|
#include "backends/meta-logical-monitor.h"
|
||||||
#include "backends/meta-monitor.h"
|
#include "backends/meta-monitor.h"
|
||||||
#include "backends/meta-monitor-config-manager.h"
|
#include "backends/meta-monitor-config-manager.h"
|
||||||
|
#include "backends/meta-orientation-manager.h"
|
||||||
#include "backends/x11/meta-monitor-manager-xrandr.h"
|
#include "backends/x11/meta-monitor-manager-xrandr.h"
|
||||||
#include "meta-backend-private.h"
|
#include "meta-backend-private.h"
|
||||||
|
|
||||||
@ -631,6 +632,57 @@ done:
|
|||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
orientation_changed (MetaOrientationManager *orientation_manager,
|
||||||
|
MetaMonitorManager *manager)
|
||||||
|
{
|
||||||
|
MetaMonitorTransform transform;
|
||||||
|
|
||||||
|
switch (meta_orientation_manager_get_orientation (orientation_manager))
|
||||||
|
{
|
||||||
|
case META_ORIENTATION_NORMAL:
|
||||||
|
transform = META_MONITOR_TRANSFORM_NORMAL;
|
||||||
|
break;
|
||||||
|
case META_ORIENTATION_BOTTOM_UP:
|
||||||
|
transform = META_MONITOR_TRANSFORM_180;
|
||||||
|
break;
|
||||||
|
case META_ORIENTATION_LEFT_UP:
|
||||||
|
transform = META_MONITOR_TRANSFORM_90;
|
||||||
|
break;
|
||||||
|
case META_ORIENTATION_RIGHT_UP:
|
||||||
|
transform = META_MONITOR_TRANSFORM_270;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case META_ORIENTATION_UNDEFINED:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!meta_is_monitor_config_manager_enabled ())
|
||||||
|
{
|
||||||
|
meta_monitor_config_orientation_changed (manager->legacy_config, transform);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GError *error = NULL;
|
||||||
|
MetaMonitorsConfig *config =
|
||||||
|
meta_monitor_config_manager_create_for_orientation (manager->config_manager,
|
||||||
|
transform);
|
||||||
|
if (!config)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!meta_monitor_manager_apply_monitors_config (manager,
|
||||||
|
config,
|
||||||
|
META_MONITORS_CONFIG_METHOD_TEMPORARY,
|
||||||
|
&error))
|
||||||
|
{
|
||||||
|
g_warning ("Failed to use orientation monitor configuration: %s",
|
||||||
|
error->message);
|
||||||
|
g_error_free (error);
|
||||||
|
}
|
||||||
|
g_object_unref (config);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
experimental_features_changed (MetaSettings *settings,
|
experimental_features_changed (MetaSettings *settings,
|
||||||
MetaExperimentalFeature old_experimental_features,
|
MetaExperimentalFeature old_experimental_features,
|
||||||
@ -699,6 +751,11 @@ meta_monitor_manager_constructed (GObject *object)
|
|||||||
skeleton,
|
skeleton,
|
||||||
meta_is_monitor_config_manager_enabled ());
|
meta_is_monitor_config_manager_enabled ());
|
||||||
|
|
||||||
|
g_signal_connect_object (meta_backend_get_orientation_manager (backend),
|
||||||
|
"orientation-changed",
|
||||||
|
G_CALLBACK (orientation_changed),
|
||||||
|
manager, 0);
|
||||||
|
|
||||||
manager->in_init = TRUE;
|
manager->in_init = TRUE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user