Remove old monitor configuration system

Remove the old MetaMonitorConfig system and mark the new one as
non-experimental. This also removes the D-Bus property.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
Jonas Ådahl 2017-03-24 15:36:12 +08:00
parent 9ac87b36c1
commit e8a62861c9
21 changed files with 113 additions and 3387 deletions

View File

@ -103,7 +103,7 @@
</key>
<key name="experimental-features" type="as">
<default>['monitor-config-manager']</default>
<default>[]</default>
<summary>Enable experimental features</summary>
<description>
To enable experimental features, add the feature keyword to the list.
@ -114,22 +114,12 @@
Currently possible keywords:
• “monitor-config-manager” — use the new monitor configuration
system, aimed to replace the old one.
This enables a higher level configuration
API to be used by configuration
applications, as well as the ability to
configure per logical monitor scale.
• “scale-monitor-framebuffer” — makes mutter default to layout logical
monitors in a logical pixel coordinate
space, while scaling monitor
framebuffers instead of window content,
to manage HiDPI monitors. Does not
require a restart.
Also enabling “monitor-config-manager”
is required for this feature to be
enabled.
</description>
</key>

View File

@ -109,8 +109,6 @@ libmutter_@LIBMUTTER_API_VERSION@_la_SOURCES = \
backends/meta-input-settings-private.h \
backends/meta-logical-monitor.c \
backends/meta-logical-monitor.h \
backends/meta-monitor-config.c \
backends/meta-monitor-config.h \
backends/meta-monitor-config-manager.c \
backends/meta-monitor-config-manager.h \
backends/meta-monitor-config-store.c \

View File

@ -102,8 +102,6 @@ struct _MetaBackendClass
void meta_init_backend (GType backend_gtype);
void meta_backend_x11_display_opened (MetaBackend *backend);
ClutterBackend * meta_backend_get_clutter_backend (MetaBackend *backend);
MetaIdleMonitor * meta_backend_get_idle_monitor (MetaBackend *backend,

View File

@ -52,7 +52,6 @@ enum
KEYMAP_CHANGED,
KEYMAP_LAYOUT_GROUP_CHANGED,
LAST_DEVICE_CHANGED,
X11_DISPLAY_OPENED,
N_SIGNALS
};
@ -499,13 +498,6 @@ meta_backend_class_init (MetaBackendClass *klass)
0,
NULL, NULL, NULL,
G_TYPE_NONE, 1, G_TYPE_INT);
signals[X11_DISPLAY_OPENED] =
g_signal_new ("x11-display-opened",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
mutter_stage_views = g_getenv ("MUTTER_STAGE_VIEWS");
stage_views_disabled = g_strcmp0 (mutter_stage_views, "0") == 0;
@ -944,12 +936,6 @@ meta_clutter_init (void)
meta_backend_post_init (_backend);
}
void
meta_backend_x11_display_opened (MetaBackend *backend)
{
g_signal_emit (backend, signals[X11_DISPLAY_OPENED], 0);
}
gboolean
meta_is_stage_views_enabled (void)
{

View File

@ -45,6 +45,12 @@ G_DEFINE_TYPE (MetaMonitorConfigManager, meta_monitor_config_manager,
G_DEFINE_TYPE (MetaMonitorsConfig, meta_monitors_config,
G_TYPE_OBJECT)
static void
meta_crtc_info_free (MetaCrtcInfo *info);
static void
meta_output_info_free (MetaOutputInfo *info);
MetaMonitorConfigManager *
meta_monitor_config_manager_new (MetaMonitorManager *monitor_manager)
{
@ -1146,6 +1152,19 @@ meta_monitors_config_class_init (MetaMonitorsConfigClass *klass)
object_class->finalize = meta_monitors_config_finalize;
}
static void
meta_crtc_info_free (MetaCrtcInfo *info)
{
g_ptr_array_free (info->outputs, TRUE);
g_slice_free (MetaCrtcInfo, info);
}
static void
meta_output_info_free (MetaOutputInfo *info)
{
g_slice_free (MetaOutputInfo, info);
}
gboolean
meta_verify_monitor_mode_spec (MetaMonitorModeSpec *monitor_mode_spec,
GError **error)

File diff suppressed because it is too large Load Diff

View File

@ -1,60 +0,0 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2001 Havoc Pennington
* Copyright (C) 2003 Rob Adams
* Copyright (C) 2004-2006 Elijah Newren
* Copyright (C) 2013 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef META_MONITOR_CONFIG_H
#define META_MONITOR_CONFIG_H
#include "meta-monitor-manager-private.h"
#define META_TYPE_MONITOR_CONFIG (meta_monitor_config_get_type ())
G_DECLARE_FINAL_TYPE (MetaMonitorConfig, meta_monitor_config,
META, MONITOR_CONFIG, GObject)
MetaMonitorConfig *meta_monitor_config_new (MetaMonitorManager *manager);
gboolean meta_monitor_config_apply_stored (MetaMonitorConfig *config,
MetaMonitorManager *manager);
void meta_monitor_config_make_default (MetaMonitorConfig *config,
MetaMonitorManager *manager);
void meta_monitor_config_update_current (MetaMonitorConfig *config,
MetaMonitorManager *manager);
void meta_monitor_config_make_persistent (MetaMonitorConfig *config);
void meta_monitor_config_restore_previous (MetaMonitorConfig *config,
MetaMonitorManager *manager);
gboolean meta_monitor_config_get_is_builtin_display_on (MetaMonitorConfig *config);
void meta_monitor_config_lid_is_closed_changed (MetaMonitorConfig *self,
MetaMonitorManager *manager);
void meta_monitor_config_orientation_changed (MetaMonitorConfig *self,
MetaMonitorTransform transform);
void meta_monitor_config_rotate_monitor (MetaMonitorConfig *self);
gboolean meta_monitor_config_switch_config (MetaMonitorConfig *self,
MetaMonitorSwitchConfigType config_type);
#endif /* META_MONITOR_CONFIG_H */

View File

@ -350,10 +350,8 @@ meta_monitor_manager_dummy_ensure_initial_config (MetaMonitorManager *manager)
config = meta_monitor_manager_ensure_configured (manager);
if (meta_is_monitor_config_manager_enabled ())
{
meta_monitor_manager_update_logical_state (manager, config);
}
if (meta_is_stage_views_enabled ())
meta_monitor_manager_update_logical_state (manager, config);
else
{
MetaMonitorManagerDeriveFlag flags =
@ -541,41 +539,6 @@ meta_monitor_manager_dummy_apply_monitors_config (MetaMonitorManager *manag
return TRUE;
}
static void
legacy_calculate_screen_size (MetaMonitorManager *manager)
{
unsigned int i;
int width = 0, height = 0;
for (i = 0; i < manager->n_crtcs; i++)
{
MetaCrtc *crtc = &manager->crtcs[i];
width = MAX (width, crtc->rect.x + crtc->rect.width);
height = MAX (height, crtc->rect.y + crtc->rect.height);
}
manager->screen_width = width;
manager->screen_height = height;
}
static void
meta_monitor_manager_dummy_apply_config (MetaMonitorManager *manager,
MetaCrtcInfo **crtcs,
unsigned int n_crtcs,
MetaOutputInfo **outputs,
unsigned int n_outputs)
{
MetaMonitorManagerDeriveFlag flags =
META_MONITOR_MANAGER_DERIVE_FLAG_NONE;
apply_crtc_assignments (manager, crtcs, n_crtcs, outputs, n_outputs);
legacy_calculate_screen_size (manager);
meta_monitor_manager_rebuild_derived (manager, flags);
}
static gboolean
meta_monitor_manager_dummy_is_transform_handled (MetaMonitorManager *manager,
MetaCrtc *crtc,
@ -687,7 +650,6 @@ meta_monitor_manager_dummy_class_init (MetaMonitorManagerDummyClass *klass)
manager_class->read_current = meta_monitor_manager_dummy_read_current;
manager_class->ensure_initial_config = meta_monitor_manager_dummy_ensure_initial_config;
manager_class->apply_monitors_config = meta_monitor_manager_dummy_apply_monitors_config;
manager_class->apply_configuration = meta_monitor_manager_dummy_apply_config;
manager_class->is_transform_handled = meta_monitor_manager_dummy_is_transform_handled;
manager_class->calculate_monitor_mode_scale = meta_monitor_manager_dummy_calculate_monitor_mode_scale;
manager_class->calculate_supported_scales = meta_monitor_manager_dummy_calculate_supported_scales;

View File

@ -48,7 +48,6 @@
#include "meta-dbus-display-config.h"
#include "meta-cursor.h"
typedef struct _MetaMonitorConfig MetaMonitorConfig;
typedef struct _MetaMonitorConfigManager MetaMonitorConfigManager;
typedef struct _MetaMonitorConfigStore MetaMonitorConfigStore;
typedef struct _MetaMonitorsConfig MetaMonitorsConfig;
@ -261,11 +260,9 @@ struct _MetaCrtcMode
/*
* MetaCrtcInfo:
* This represents the writable part of a CRTC, as deserialized from DBus
* or built by MetaMonitorConfig
*
* Note: differently from the other structures in this file, MetaCrtcInfo
* is handled by pointer. This is to accomodate the usage in MetaMonitorConfig
* A representation of a CRTC configuration, generated by
* MetaMonitorConfigManager.
*/
struct _MetaCrtcInfo
{
@ -279,7 +276,9 @@ struct _MetaCrtcInfo
/*
* MetaOutputInfo:
* this is the same as MetaCrtcInfo, but for outputs
*
* A representation of a connector configuration, generated by
* MetaMonitorConfigManager.
*/
struct _MetaOutputInfo
{
@ -289,12 +288,6 @@ struct _MetaOutputInfo
gboolean is_underscanning;
};
typedef enum _MetaMonitorConfigSystem
{
META_MONITOR_CONFIG_SYSTEM_LEGACY,
META_MONITOR_CONFIG_SYSTEM_MANAGER
} MetaMonitorConfigSystem;
#define META_TYPE_MONITOR_MANAGER (meta_monitor_manager_get_type ())
#define META_MONITOR_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_MONITOR_MANAGER, MetaMonitorManager))
#define META_MONITOR_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_MONITOR_MANAGER, MetaMonitorManagerClass))
@ -343,11 +336,8 @@ struct _MetaMonitorManager
int dbus_name_id;
MetaMonitorConfigSystem pending_persistent_system;
int persistent_timeout_id;
MetaMonitorConfig *legacy_config;
MetaMonitorConfigManager *config_manager;
GnomePnpIds *pnp_ids;
@ -378,12 +368,6 @@ struct _MetaMonitorManagerClass
MetaMonitorsConfigMethod ,
GError **);
void (*apply_configuration) (MetaMonitorManager *,
MetaCrtcInfo **,
unsigned int ,
MetaOutputInfo **,
unsigned int);
void (*set_power_save_mode) (MetaMonitorManager *,
MetaPowerSave);
@ -433,8 +417,6 @@ struct _MetaMonitorManagerClass
MetaLogicalMonitorLayoutMode (*get_default_layout_mode) (MetaMonitorManager *);
};
gboolean meta_is_monitor_config_manager_enabled (void);
void meta_monitor_manager_rebuild (MetaMonitorManager *manager,
MetaMonitorsConfig *config);
void meta_monitor_manager_rebuild_derived (MetaMonitorManager *manager,
@ -484,12 +466,6 @@ void meta_monitor_manager_get_screen_size (MetaMonitorManager *
int *width,
int *height);
void meta_monitor_manager_apply_configuration (MetaMonitorManager *manager,
MetaCrtcInfo **crtcs,
unsigned int n_crtcs,
MetaOutputInfo **outputs,
unsigned int n_outputs);
void meta_monitor_manager_confirm_configuration (MetaMonitorManager *manager,
gboolean ok);
@ -497,9 +473,6 @@ void meta_output_parse_edid (MetaOutput *output,
GBytes *edid);
gboolean meta_output_is_laptop (MetaOutput *output);
void meta_crtc_info_free (MetaCrtcInfo *info);
void meta_output_info_free (MetaOutputInfo *info);
gboolean meta_monitor_manager_has_hotplug_mode_update (MetaMonitorManager *manager);
void meta_monitor_manager_read_current_state (MetaMonitorManager *manager);
void meta_monitor_manager_on_hotplug (MetaMonitorManager *manager);

View File

@ -36,7 +36,6 @@
#include "util-private.h"
#include <meta/errors.h>
#include "edid.h"
#include "meta-monitor-config.h"
#include "backends/meta-logical-monitor.h"
#include "backends/meta-monitor.h"
#include "backends/meta-monitor-config-manager.h"
@ -77,17 +76,6 @@ meta_monitor_manager_init (MetaMonitorManager *manager)
{
}
gboolean
meta_is_monitor_config_manager_enabled (void)
{
MetaBackend *backend = meta_get_backend ();
MetaSettings *settings = meta_backend_get_settings (backend);
return meta_settings_is_experimental_feature_enabled (
settings,
META_EXPERIMENTAL_FEATURE_MONITOR_CONFIG_MANAGER);
}
static void
meta_monitor_manager_set_primary_logical_monitor (MetaMonitorManager *manager,
MetaLogicalMonitor *logical_monitor)
@ -332,10 +320,7 @@ power_save_mode_changed (MetaMonitorManager *manager,
void
meta_monitor_manager_lid_is_closed_changed (MetaMonitorManager *manager)
{
if (meta_is_monitor_config_manager_enabled ())
meta_monitor_manager_ensure_configured (manager);
else
meta_monitor_config_lid_is_closed_changed (manager->legacy_config, manager);
meta_monitor_manager_ensure_configured (manager);
}
static void
@ -483,13 +468,6 @@ should_use_stored_config (MetaMonitorManager *manager)
!meta_monitor_manager_has_hotplug_mode_update (manager));
}
static void
legacy_ensure_configured (MetaMonitorManager *manager)
{
if (!meta_monitor_config_apply_stored (manager->legacy_config, manager))
meta_monitor_config_make_default (manager->legacy_config, manager);
}
MetaMonitorsConfig *
meta_monitor_manager_ensure_configured (MetaMonitorManager *manager)
{
@ -500,12 +478,6 @@ meta_monitor_manager_ensure_configured (MetaMonitorManager *manager)
MetaMonitorsConfigMethod fallback_method =
META_MONITORS_CONFIG_METHOD_TEMPORARY;
if (!meta_is_monitor_config_manager_enabled ())
{
legacy_ensure_configured (manager);
return NULL;
}
use_stored_config = should_use_stored_config (manager);
if (use_stored_config)
method = META_MONITORS_CONFIG_METHOD_PERSISTENT;
@ -612,6 +584,8 @@ orientation_changed (MetaOrientationManager *orientation_manager,
MetaMonitorManager *manager)
{
MetaMonitorTransform transform;
GError *error = NULL;
MetaMonitorsConfig *config;
switch (meta_orientation_manager_get_orientation (orientation_manager))
{
@ -633,30 +607,22 @@ orientation_changed (MetaOrientationManager *orientation_manager,
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;
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);
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
@ -664,21 +630,10 @@ experimental_features_changed (MetaSettings *settings,
MetaExperimentalFeature old_experimental_features,
MetaMonitorManager *manager)
{
MetaDBusDisplayConfig *skeleton = META_DBUS_DISPLAY_CONFIG (manager);
gboolean was_config_manager_enabled;
gboolean was_stage_views_scaled;
gboolean is_config_manager_enabled;
gboolean is_stage_views_scaled;
gboolean should_reconfigure = FALSE;
is_config_manager_enabled = meta_is_monitor_config_manager_enabled ();
was_config_manager_enabled =
meta_dbus_display_config_get_is_experimental_api_enabled (skeleton);
if (was_config_manager_enabled != is_config_manager_enabled)
meta_dbus_display_config_set_is_experimental_api_enabled (
skeleton, is_config_manager_enabled);
was_stage_views_scaled =
!!(old_experimental_features &
META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER);
@ -687,8 +642,7 @@ experimental_features_changed (MetaSettings *settings,
settings,
META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER);
if (is_config_manager_enabled != was_config_manager_enabled ||
is_stage_views_scaled != was_stage_views_scaled)
if (is_stage_views_scaled != was_stage_views_scaled)
should_reconfigure = TRUE;
if (should_reconfigure)
@ -701,7 +655,6 @@ static void
meta_monitor_manager_constructed (GObject *object)
{
MetaMonitorManager *manager = META_MONITOR_MANAGER (object);
MetaDBusDisplayConfig *skeleton = META_DBUS_DISPLAY_CONFIG (manager);
MetaMonitorManagerClass *manager_class =
META_MONITOR_MANAGER_GET_CLASS (manager);
MetaBackend *backend = meta_get_backend ();
@ -723,10 +676,6 @@ meta_monitor_manager_constructed (GObject *object)
g_signal_connect_object (manager, "notify::power-save-mode",
G_CALLBACK (power_save_mode_changed), manager, 0);
meta_dbus_display_config_set_is_experimental_api_enabled (
skeleton,
meta_is_monitor_config_manager_enabled ());
g_signal_connect_object (meta_backend_get_orientation_manager (backend),
"orientation-changed",
G_CALLBACK (orientation_changed),
@ -735,12 +684,7 @@ meta_monitor_manager_constructed (GObject *object)
manager->current_switch_config = META_MONITOR_SWITCH_CONFIG_UNKNOWN;
manager->in_init = TRUE;
/*
* MetaMonitorConfigManager will only be used if the corresponding
* experimental feature is enabled.
*/
manager->config_manager = meta_monitor_config_manager_new (manager);
manager->legacy_config = meta_monitor_config_new (manager);
meta_monitor_manager_read_current_state (manager);
@ -1157,61 +1101,6 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
return TRUE;
}
static gboolean
output_can_config (MetaOutput *output,
MetaCrtc *crtc,
MetaCrtcMode *mode)
{
unsigned int i;
gboolean ok = FALSE;
for (i = 0; i < output->n_possible_crtcs && !ok; i++)
ok = output->possible_crtcs[i] == crtc;
if (!ok)
return FALSE;
if (mode == NULL)
return TRUE;
ok = FALSE;
for (i = 0; i < output->n_modes && !ok; i++)
ok = output->modes[i] == mode;
return ok;
}
static gboolean
output_can_clone (MetaOutput *output,
MetaOutput *clone)
{
unsigned int i;
gboolean ok = FALSE;
for (i = 0; i < output->n_possible_clones && !ok; i++)
ok = output->possible_clones[i] == clone;
return ok;
}
void
meta_monitor_manager_apply_configuration (MetaMonitorManager *manager,
MetaCrtcInfo **crtcs,
unsigned int n_crtcs,
MetaOutputInfo **outputs,
unsigned int n_outputs)
{
META_MONITOR_MANAGER_GET_CLASS (manager)->apply_configuration (manager,
crtcs, n_crtcs,
outputs, n_outputs);
}
static void
legacy_restore_previous_config (MetaMonitorManager *manager)
{
meta_monitor_config_restore_previous (manager->legacy_config, manager);
}
static void
restore_previous_config (MetaMonitorManager *manager)
{
@ -1258,17 +1147,9 @@ save_config_timeout (gpointer user_data)
{
MetaMonitorManager *manager = user_data;
switch (manager->pending_persistent_system)
{
case META_MONITOR_CONFIG_SYSTEM_LEGACY:
legacy_restore_previous_config (manager);
break;
case META_MONITOR_CONFIG_SYSTEM_MANAGER:
restore_previous_config (manager);
break;
}
restore_previous_config (manager);
manager->persistent_timeout_id = 0;
return G_SOURCE_REMOVE;
}
@ -1280,10 +1161,8 @@ cancel_persistent_confirmation (MetaMonitorManager *manager)
}
static void
request_persistent_confirmation (MetaMonitorManager *manager,
MetaMonitorConfigSystem system)
request_persistent_confirmation (MetaMonitorManager *manager)
{
manager->pending_persistent_system = system;
manager->persistent_timeout_id = g_timeout_add_seconds (meta_monitor_manager_get_display_configuration_timeout (),
save_config_timeout,
manager);
@ -1293,250 +1172,6 @@ request_persistent_confirmation (MetaMonitorManager *manager,
g_signal_emit (manager, signals[CONFIRM_DISPLAY_CHANGE], 0);
}
static gboolean
meta_monitor_manager_legacy_handle_apply_configuration (MetaDBusDisplayConfig *skeleton,
GDBusMethodInvocation *invocation,
guint serial,
gboolean persistent,
GVariant *crtcs,
GVariant *outputs)
{
MetaMonitorManager *manager = META_MONITOR_MANAGER (skeleton);
GVariantIter crtc_iter, output_iter, *nested_outputs;
GVariant *properties;
guint crtc_id;
int new_mode, x, y;
int new_screen_width, new_screen_height;
guint transform;
guint output_index;
GPtrArray *crtc_infos, *output_infos;
if (meta_monitor_config_manager_get_current (manager->config_manager))
meta_monitor_config_manager_set_current (manager->config_manager, NULL);
if (serial != manager->serial)
{
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
G_DBUS_ERROR_ACCESS_DENIED,
"The requested configuration is based on stale information");
return TRUE;
}
crtc_infos = g_ptr_array_new_full (g_variant_n_children (crtcs),
(GDestroyNotify) meta_crtc_info_free);
output_infos = g_ptr_array_new_full (g_variant_n_children (outputs),
(GDestroyNotify) meta_output_info_free);
/* Validate all arguments */
new_screen_width = 0; new_screen_height = 0;
g_variant_iter_init (&crtc_iter, crtcs);
while (g_variant_iter_loop (&crtc_iter, "(uiiiuaua{sv})",
&crtc_id, &new_mode, &x, &y, &transform,
&nested_outputs, NULL))
{
MetaCrtcInfo *crtc_info;
MetaOutput *first_output;
MetaCrtc *crtc;
MetaCrtcMode *mode;
crtc_info = g_slice_new (MetaCrtcInfo);
crtc_info->outputs = g_ptr_array_new ();
if (crtc_id >= manager->n_crtcs)
{
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
G_DBUS_ERROR_INVALID_ARGS,
"Invalid CRTC id");
return TRUE;
}
crtc = &manager->crtcs[crtc_id];
crtc_info->crtc = crtc;
if (new_mode != -1 && (new_mode < 0 || (unsigned)new_mode >= manager->n_modes))
{
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
G_DBUS_ERROR_INVALID_ARGS,
"Invalid mode id");
return TRUE;
}
mode = new_mode != -1 ? &manager->modes[new_mode] : NULL;
crtc_info->mode = mode;
if (mode)
{
int width, height;
int max_screen_width, max_screen_height;
if (meta_monitor_transform_is_rotated (transform))
{
width = mode->height;
height = mode->width;
}
else
{
width = mode->width;
height = mode->height;
}
if (x < 0 || y < 0)
{
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
G_DBUS_ERROR_INVALID_ARGS,
"Invalid CRTC geometry");
return TRUE;
}
if (meta_monitor_manager_get_max_screen_size (manager,
&max_screen_width,
&max_screen_height))
{
if (x + width > max_screen_width ||
y + height > max_screen_height)
{
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
G_DBUS_ERROR_INVALID_ARGS,
"Invalid CRTC geometry");
return TRUE;
}
}
new_screen_width = MAX (new_screen_width, x + width);
new_screen_height = MAX (new_screen_height, y + height);
crtc_info->x = x;
crtc_info->y = y;
}
else
{
crtc_info->x = 0;
crtc_info->y = 0;
}
if (transform > META_MONITOR_TRANSFORM_FLIPPED_270 ||
((crtc->all_transforms & (1 << transform)) == 0))
{
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
G_DBUS_ERROR_INVALID_ARGS,
"Invalid transform");
return TRUE;
}
crtc_info->transform = transform;
first_output = NULL;
while (g_variant_iter_loop (nested_outputs, "u", &output_index))
{
MetaOutput *output;
if (output_index >= manager->n_outputs)
{
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
G_DBUS_ERROR_INVALID_ARGS,
"Invalid output id");
return TRUE;
}
output = &manager->outputs[output_index];
if (!output_can_config (output, crtc, mode))
{
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
G_DBUS_ERROR_INVALID_ARGS,
"Output cannot be assigned to this CRTC or mode");
return TRUE;
}
g_ptr_array_add (crtc_info->outputs, output);
if (first_output)
{
if (!output_can_clone (output, first_output))
{
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
G_DBUS_ERROR_INVALID_ARGS,
"Outputs cannot be cloned");
return TRUE;
}
}
else
first_output = output;
}
if (!first_output && mode)
{
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
G_DBUS_ERROR_INVALID_ARGS,
"Mode specified without outputs?");
return TRUE;
}
g_ptr_array_add (crtc_infos, crtc_info);
}
if (new_screen_width == 0 || new_screen_height == 0)
{
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
G_DBUS_ERROR_INVALID_ARGS,
"Refusing to disable all outputs");
return TRUE;
}
g_variant_iter_init (&output_iter, outputs);
while (g_variant_iter_loop (&output_iter, "(u@a{sv})", &output_index, &properties))
{
MetaOutputInfo *output_info;
gboolean primary, presentation, underscanning;
if (output_index >= manager->n_outputs)
{
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
G_DBUS_ERROR_INVALID_ARGS,
"Invalid output id");
return TRUE;
}
output_info = g_slice_new0 (MetaOutputInfo);
output_info->output = &manager->outputs[output_index];
if (g_variant_lookup (properties, "primary", "b", &primary))
output_info->is_primary = primary;
if (g_variant_lookup (properties, "presentation", "b", &presentation))
output_info->is_presentation = presentation;
if (g_variant_lookup (properties, "underscanning", "b", &underscanning))
output_info->is_underscanning = underscanning;
g_ptr_array_add (output_infos, output_info);
}
/* If we were in progress of making a persistent change and we see a
new request, it's likely that the old one failed in some way, so
don't save it, but also don't queue for restoring it.
*/
if (manager->persistent_timeout_id && persistent)
cancel_persistent_confirmation (manager);
meta_monitor_manager_apply_configuration (manager,
(MetaCrtcInfo**)crtc_infos->pdata,
crtc_infos->len,
(MetaOutputInfo**)output_infos->pdata,
output_infos->len);
g_ptr_array_unref (crtc_infos);
g_ptr_array_unref (output_infos);
/* Update MetaMonitorConfig data structures immediately so that we
don't revert the change at the next XRandR event, then ask the plugin
manager (through MetaScreen) to confirm the display change with the
appropriate UI. Then wait 20 seconds and if not confirmed, revert the
configuration.
*/
meta_monitor_config_update_current (manager->legacy_config, manager);
if (persistent)
request_persistent_confirmation (manager,
META_MONITOR_CONFIG_SYSTEM_LEGACY);
meta_dbus_display_config_complete_apply_configuration (skeleton, invocation);
return TRUE;
}
#define META_DISPLAY_CONFIG_MODE_FLAGS_PREFERRED (1 << 0)
#define META_DISPLAY_CONFIG_MODE_FLAGS_CURRENT (1 << 1)
@ -1563,14 +1198,6 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton,
MetaMonitorManagerCapability capabilities;
int max_screen_width, max_screen_height;
if (!meta_is_monitor_config_manager_enabled ())
{
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
G_DBUS_ERROR_ACCESS_DENIED,
"This experimental API is currently not enabled");
return TRUE;
}
g_variant_builder_init (&monitors_builder,
G_VARIANT_TYPE (MONITORS_FORMAT));
g_variant_builder_init (&logical_monitors_builder,
@ -2175,14 +1802,6 @@ meta_monitor_manager_handle_apply_monitors_config (MetaDBusDisplayConfig *skelet
GList *logical_monitor_configs = NULL;
GError *error = NULL;
if (!meta_is_monitor_config_manager_enabled ())
{
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
G_DBUS_ERROR_ACCESS_DENIED,
"This experimental API is currently not enabled");
return TRUE;
}
if (serial != manager->serial)
{
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
@ -2293,9 +1912,7 @@ meta_monitor_manager_handle_apply_monitors_config (MetaDBusDisplayConfig *skelet
}
if (method == META_MONITORS_CONFIG_METHOD_PERSISTENT)
request_persistent_confirmation (manager,
META_MONITOR_CONFIG_SYSTEM_MANAGER);
request_persistent_confirmation (manager);
meta_dbus_display_config_complete_apply_monitors_config (skeleton, invocation);
@ -2307,16 +1924,6 @@ meta_monitor_manager_handle_apply_monitors_config (MetaDBusDisplayConfig *skelet
#undef MONITOR_CONFIGS_FORMAT
#undef LOGICAL_MONITOR_CONFIG_FORMAT
static void
legacy_confirm_configuration (MetaMonitorManager *manager,
gboolean confirmed)
{
if (confirmed)
meta_monitor_config_make_persistent (manager->legacy_config);
else
meta_monitor_config_restore_previous (manager->legacy_config, manager);
}
static void
confirm_configuration (MetaMonitorManager *manager,
gboolean confirmed)
@ -2338,15 +1945,7 @@ meta_monitor_manager_confirm_configuration (MetaMonitorManager *manager,
}
cancel_persistent_confirmation (manager);
switch (manager->pending_persistent_system)
{
case META_MONITOR_CONFIG_SYSTEM_LEGACY:
legacy_confirm_configuration (manager, ok);
break;
case META_MONITOR_CONFIG_SYSTEM_MANAGER:
confirm_configuration (manager, ok);
break;
}
confirm_configuration (manager, ok);
}
static gboolean
@ -2506,7 +2105,6 @@ meta_monitor_manager_handle_set_crtc_gamma (MetaDBusDisplayConfig *skeleton,
klass = META_MONITOR_MANAGER_GET_CLASS (manager);
if (klass->set_crtc_gamma)
klass->set_crtc_gamma (manager, crtc, size, red, green, blue);
meta_dbus_display_config_complete_set_crtc_gamma (skeleton, invocation);
g_bytes_unref (red_bytes);
@ -2520,7 +2118,6 @@ static void
meta_monitor_manager_display_config_init (MetaDBusDisplayConfigIface *iface)
{
iface->handle_get_resources = meta_monitor_manager_handle_get_resources;
iface->handle_apply_configuration = meta_monitor_manager_legacy_handle_apply_configuration;
iface->handle_change_backlight = meta_monitor_manager_handle_change_backlight;
iface->handle_get_crtc_gamma = meta_monitor_manager_handle_get_crtc_gamma;
iface->handle_set_crtc_gamma = meta_monitor_manager_handle_set_crtc_gamma;
@ -3079,35 +2676,9 @@ meta_output_is_laptop (MetaOutput *output)
}
}
static void
legacy_on_hotplug (MetaMonitorManager *manager)
{
gboolean applied_config = FALSE;
/* If the monitor has hotplug_mode_update (which is used by VMs), don't bother
* applying our stored configuration, because it's likely the user just resizing
* the window.
*/
if (!meta_monitor_manager_has_hotplug_mode_update (manager))
{
if (meta_monitor_config_apply_stored (manager->legacy_config, manager))
applied_config = TRUE;
}
/* If we haven't applied any configuration, apply the default configuration. */
if (!applied_config)
meta_monitor_config_make_default (manager->legacy_config, manager);
}
void
meta_monitor_manager_on_hotplug (MetaMonitorManager *manager)
{
if (!meta_is_monitor_config_manager_enabled ())
{
legacy_on_hotplug (manager);
return;
}
meta_monitor_manager_ensure_configured (manager);
}
@ -3244,67 +2815,54 @@ meta_monitor_manager_get_is_builtin_display_on (MetaMonitorManager *manager)
void
meta_monitor_manager_rotate_monitor (MetaMonitorManager *manager)
{
if (!meta_is_monitor_config_manager_enabled ())
{
meta_monitor_config_rotate_monitor (manager->legacy_config);
}
else
{
GError *error = NULL;
MetaMonitorsConfig *config =
meta_monitor_config_manager_create_for_rotate_monitor (manager->config_manager);
GError *error = NULL;
MetaMonitorsConfig *config =
meta_monitor_config_manager_create_for_rotate_monitor (manager->config_manager);
if (!config)
return;
if (!config)
return;
if (!meta_monitor_manager_apply_monitors_config (manager,
config,
META_MONITORS_CONFIG_METHOD_TEMPORARY,
&error))
{
g_warning ("Failed to use rotate monitor configuration: %s",
error->message);
g_error_free (error);
}
g_object_unref (config);
if (!meta_monitor_manager_apply_monitors_config (manager,
config,
META_MONITORS_CONFIG_METHOD_TEMPORARY,
&error))
{
g_warning ("Failed to use rotate monitor configuration: %s",
error->message);
g_error_free (error);
}
g_object_unref (config);
}
void
meta_monitor_manager_switch_config (MetaMonitorManager *manager,
MetaMonitorSwitchConfigType config_type)
{
GError *error = NULL;
MetaMonitorsConfig *config;
g_return_if_fail (config_type != META_MONITOR_SWITCH_CONFIG_UNKNOWN);
if (!meta_is_monitor_config_manager_enabled ())
config =
meta_monitor_config_manager_create_for_switch_config (manager->config_manager,
config_type);
if (!config)
return;
if (!meta_monitor_manager_apply_monitors_config (manager,
config,
META_MONITORS_CONFIG_METHOD_TEMPORARY,
&error))
{
if (meta_monitor_config_switch_config (manager->legacy_config, config_type))
manager->current_switch_config = config_type;
g_warning ("Failed to use switch monitor configuration: %s",
error->message);
g_error_free (error);
}
else
{
GError *error = NULL;
MetaMonitorsConfig *config =
meta_monitor_config_manager_create_for_switch_config (manager->config_manager,
config_type);
if (!config)
return;
if (!meta_monitor_manager_apply_monitors_config (manager,
config,
META_MONITORS_CONFIG_METHOD_TEMPORARY,
&error))
{
g_warning ("Failed to use switch monitor configuration: %s",
error->message);
g_error_free (error);
}
else
{
manager->current_switch_config = config_type;
}
g_object_unref (config);
manager->current_switch_config = config_type;
}
g_object_unref (config);
}
gboolean

View File

@ -31,7 +31,6 @@ typedef enum _MetaExperimentalFeature
{
META_EXPERIMENTAL_FEATURE_NONE = 0,
META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER = (1 << 0),
META_EXPERIMENTAL_FEATURE_MONITOR_CONFIG_MANAGER = (1 << 1)
} MetaExperimentalFeature;
#define META_TYPE_SETTINGS (meta_settings_get_type ())

View File

@ -86,37 +86,15 @@ calculate_ui_scaling_factor (MetaSettings *settings)
return (int) max_scale;
}
static int
get_xsettings_scaling_factor (void)
{
GdkScreen *screen;
GValue value = G_VALUE_INIT;
g_value_init (&value, G_TYPE_INT);
screen = gdk_screen_get_default ();
if (gdk_screen_get_setting (screen, "gdk-window-scaling-factor", &value))
return g_value_get_int (&value);
else
return 1;
}
static gboolean
update_ui_scaling_factor (MetaSettings *settings)
{
int ui_scaling_factor;
if (meta_is_stage_views_scaled ())
{
ui_scaling_factor = 1;
}
ui_scaling_factor = 1;
else
{
if (meta_is_monitor_config_manager_enabled ())
ui_scaling_factor = calculate_ui_scaling_factor (settings);
else
ui_scaling_factor = get_xsettings_scaling_factor ();
}
ui_scaling_factor = calculate_ui_scaling_factor (settings);
if (settings->ui_scaling_factor != ui_scaling_factor)
{
@ -129,34 +107,6 @@ update_ui_scaling_factor (MetaSettings *settings)
}
}
static void
xft_dpi_changed (GtkSettings *gtk_settings,
GParamSpec *pspec,
MetaSettings *settings)
{
/* This only matters when we rely on XSettings. */
if (meta_is_monitor_config_manager_enabled ())
return;
meta_settings_update_ui_scaling_factor (settings);
}
static void
x11_display_opened (MetaBackend *backend,
MetaSettings *settings)
{
/*
* gdk-window-scaling-factor is not exported to gtk-settings
* because it is handled inside gdk, so we use gtk-xft-dpi instead
* which also changes when the scale factor changes.
*
* TODO: Only rely on our own configured scale when we only have
* MetaMonitorConfigManager.
*/
g_signal_connect (gtk_settings_get_default (), "notify::gtk-xft-dpi",
G_CALLBACK (xft_dpi_changed), settings);
}
void
meta_settings_update_ui_scaling_factor (MetaSettings *settings)
{
@ -312,8 +262,6 @@ experimental_features_handler (GVariant *features_variant,
/* So far no experimental features defined. */
if (g_str_equal (feature, "scale-monitor-framebuffer"))
features |= META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER;
else if (g_str_equal (feature, "monitor-config-manager"))
features |= META_EXPERIMENTAL_FEATURE_MONITOR_CONFIG_MANAGER;
else
g_info ("Unknown experimental feature '%s'\n", feature);
}
@ -364,10 +312,6 @@ meta_settings_new (MetaBackend *backend)
settings = g_object_new (META_TYPE_SETTINGS, NULL);
settings->backend = backend;
g_signal_connect (backend, "x11-display-opened",
G_CALLBACK (x11_display_opened),
settings);
return settings;
}

View File

@ -24,7 +24,6 @@
#include "config.h"
#include "meta-monitor-manager-kms.h"
#include "meta-monitor-config.h"
#include "meta-monitor-config-manager.h"
#include "meta-backend-private.h"
#include "meta-renderer-native.h"
@ -1253,17 +1252,7 @@ meta_monitor_manager_kms_ensure_initial_config (MetaMonitorManager *manager)
config = meta_monitor_manager_ensure_configured (manager);
if (meta_is_monitor_config_manager_enabled ())
{
meta_monitor_manager_update_logical_state (manager, config);
}
else
{
MetaMonitorManagerDeriveFlag flags =
META_MONITOR_MANAGER_DERIVE_FLAG_NONE;
meta_monitor_manager_update_logical_state_derived (manager, flags);
}
meta_monitor_manager_update_logical_state (manager, config);
}
static void
@ -1469,40 +1458,6 @@ meta_monitor_manager_kms_apply_monitors_config (MetaMonitorManager *manager
return TRUE;
}
static void
legacy_calculate_screen_size (MetaMonitorManager *manager)
{
unsigned int i;
int width = 0, height = 0;
for (i = 0; i < manager->n_crtcs; i++)
{
MetaCrtc *crtc = &manager->crtcs[i];
width = MAX (width, crtc->rect.x + crtc->rect.width);
height = MAX (height, crtc->rect.y + crtc->rect.height);
}
manager->screen_width = width;
manager->screen_height = height;
}
static void
meta_monitor_manager_kms_apply_configuration (MetaMonitorManager *manager,
MetaCrtcInfo **crtcs,
unsigned int n_crtcs,
MetaOutputInfo **outputs,
unsigned int n_outputs)
{
MetaMonitorManagerDeriveFlag flags =
META_MONITOR_MANAGER_DERIVE_FLAG_NONE;
apply_crtc_assignments (manager, crtcs, n_crtcs, outputs, n_outputs);
legacy_calculate_screen_size (manager);
meta_monitor_manager_rebuild_derived (manager, flags);
}
static void
meta_monitor_manager_kms_get_crtc_gamma (MetaMonitorManager *manager,
MetaCrtc *crtc,
@ -1961,7 +1916,6 @@ meta_monitor_manager_kms_class_init (MetaMonitorManagerKmsClass *klass)
manager_class->read_edid = meta_monitor_manager_kms_read_edid;
manager_class->ensure_initial_config = meta_monitor_manager_kms_ensure_initial_config;
manager_class->apply_monitors_config = meta_monitor_manager_kms_apply_monitors_config;
manager_class->apply_configuration = meta_monitor_manager_kms_apply_configuration;
manager_class->set_power_save_mode = meta_monitor_manager_kms_set_power_save_mode;
manager_class->get_crtc_gamma = meta_monitor_manager_kms_get_crtc_gamma;
manager_class->set_crtc_gamma = meta_monitor_manager_kms_set_crtc_gamma;

View File

@ -43,7 +43,6 @@
#include "meta-backend-x11.h"
#include <meta/main.h>
#include <meta/errors.h>
#include "meta-monitor-config.h"
#include "backends/meta-monitor-config-manager.h"
#include "backends/meta-logical-monitor.h"
@ -1465,8 +1464,7 @@ apply_crtc_assignments (MetaMonitorManager *manager,
static void
meta_monitor_manager_xrandr_ensure_initial_config (MetaMonitorManager *manager)
{
MetaMonitorManagerDeriveFlag flags =
META_MONITOR_MANAGER_DERIVE_FLAG_NONE;
MetaMonitorManagerDeriveFlag flags;
meta_monitor_manager_ensure_configured (manager);
@ -1477,9 +1475,7 @@ meta_monitor_manager_xrandr_ensure_initial_config (MetaMonitorManager *manager)
*/
meta_monitor_manager_read_current_state (manager);
if (meta_is_monitor_config_manager_enabled ())
flags |= META_MONITOR_MANAGER_DERIVE_FLAG_CONFIGURED_SCALE;
flags = META_MONITOR_MANAGER_DERIVE_FLAG_CONFIGURED_SCALE;
meta_monitor_manager_update_logical_state_derived (manager, flags);
}
@ -1545,16 +1541,6 @@ meta_monitor_manager_xrandr_apply_monitors_config (MetaMonitorManager *mana
return TRUE;
}
static void
meta_monitor_manager_xrandr_apply_configuration (MetaMonitorManager *manager,
MetaCrtcInfo **crtcs,
unsigned int n_crtcs,
MetaOutputInfo **outputs,
unsigned int n_outputs)
{
apply_crtc_assignments (manager, FALSE, crtcs, n_crtcs, outputs, n_outputs);
}
static void
meta_monitor_manager_xrandr_change_backlight (MetaMonitorManager *manager,
MetaOutput *output,
@ -1909,7 +1895,6 @@ meta_monitor_manager_xrandr_class_init (MetaMonitorManagerXrandrClass *klass)
manager_class->read_edid = meta_monitor_manager_xrandr_read_edid;
manager_class->ensure_initial_config = meta_monitor_manager_xrandr_ensure_initial_config;
manager_class->apply_monitors_config = meta_monitor_manager_xrandr_apply_monitors_config;
manager_class->apply_configuration = meta_monitor_manager_xrandr_apply_configuration;
manager_class->set_power_save_mode = meta_monitor_manager_xrandr_set_power_save_mode;
manager_class->change_backlight = meta_monitor_manager_xrandr_change_backlight;
manager_class->get_crtc_gamma = meta_monitor_manager_xrandr_get_crtc_gamma;

View File

@ -963,8 +963,6 @@ meta_display_open (void)
meta_screen_init_workspaces (screen);
meta_backend_x11_display_opened (meta_get_backend ());
enable_compositor (display);
meta_screen_create_guard_window (screen);

View File

@ -291,17 +291,6 @@
-->
<signal name="MonitorsChanged" />
<!--
IsExperimentalApiEnabled:
True if the experimental APIs are enabled, false if not. The
experimental APIs consists of the following methods:
GetCurrentState()
ApplyMonitorsConfig()
-->
<property name="IsExperimentalApiEnabled" type="b" access="read" />
<!--
GetCurrentState:
@serial: configuration serial

View File

@ -117,7 +117,7 @@ meta_monitor_manager_test_ensure_initial_config (MetaMonitorManager *manager)
config = meta_monitor_manager_ensure_configured (manager);
if (meta_is_monitor_config_manager_enabled ())
if (meta_is_stage_views_enabled ())
{
meta_monitor_manager_update_logical_state (manager, config);
}
@ -334,39 +334,6 @@ meta_monitor_manager_test_apply_monitors_config (MetaMonitorManager *manage
return TRUE;
}
static void
legacy_calculate_screen_size (MetaMonitorManager *manager)
{
unsigned int i;
int width = 0, height = 0;
for (i = 0; i < manager->n_crtcs; i++)
{
MetaCrtc *crtc = &manager->crtcs[i];
width = MAX (width, crtc->rect.x + crtc->rect.width);
height = MAX (height, crtc->rect.y + crtc->rect.height);
}
manager->screen_width = width;
manager->screen_height = height;
}
static void
meta_monitor_manager_test_apply_configuration (MetaMonitorManager *manager,
MetaCrtcInfo **crtcs,
unsigned int n_crtcs,
MetaOutputInfo **outputs,
unsigned int n_outputs)
{
MetaMonitorManagerDeriveFlag flags =
META_MONITOR_MANAGER_DERIVE_FLAG_NONE;
apply_crtc_assignments (manager, crtcs, n_crtcs, outputs, n_outputs);
legacy_calculate_screen_size (manager);
meta_monitor_manager_rebuild_derived (manager, flags);
}
static void
meta_monitor_manager_test_tiled_monitor_added (MetaMonitorManager *manager,
MetaMonitor *monitor)
@ -514,7 +481,6 @@ meta_monitor_manager_test_class_init (MetaMonitorManagerTestClass *klass)
manager_class->is_lid_closed = meta_monitor_manager_test_is_lid_closed;
manager_class->ensure_initial_config = meta_monitor_manager_test_ensure_initial_config;
manager_class->apply_monitors_config = meta_monitor_manager_test_apply_monitors_config;
manager_class->apply_configuration = meta_monitor_manager_test_apply_configuration;
manager_class->tiled_monitor_added = meta_monitor_manager_test_tiled_monitor_added;
manager_class->tiled_monitor_removed = meta_monitor_manager_test_tiled_monitor_removed;
manager_class->is_transform_handled = meta_monitor_manager_test_is_transform_handled;

View File

@ -257,12 +257,6 @@ meta_test_monitor_store_single (void)
.n_configurations = 1
};
if (!is_using_monitor_config_manager ())
{
g_test_skip ("Not using MetaMonitorConfigManager");
return;
}
set_custom_monitor_config ("single.xml");
check_monitor_configurations (&expect);
@ -332,12 +326,6 @@ meta_test_monitor_store_vertical (void)
.n_configurations = 1
};
if (!is_using_monitor_config_manager ())
{
g_test_skip ("Not using MetaMonitorConfigManager");
return;
}
set_custom_monitor_config ("vertical.xml");
check_monitor_configurations (&expect);
@ -407,12 +395,6 @@ meta_test_monitor_store_primary (void)
.n_configurations = 1
};
if (!is_using_monitor_config_manager ())
{
g_test_skip ("Not using MetaMonitorConfigManager");
return;
}
set_custom_monitor_config ("primary.xml");
check_monitor_configurations (&expect);
@ -458,12 +440,6 @@ meta_test_monitor_store_underscanning (void)
.n_configurations = 1
};
if (!is_using_monitor_config_manager ())
{
g_test_skip ("Not using MetaMonitorConfigManager");
return;
}
set_custom_monitor_config ("underscanning.xml");
check_monitor_configurations (&expect);
@ -508,12 +484,6 @@ meta_test_monitor_store_scale (void)
.n_configurations = 1
};
if (!is_using_monitor_config_manager ())
{
g_test_skip ("Not using MetaMonitorConfigManager");
return;
}
if (!meta_is_stage_views_enabled ())
{
g_test_skip ("Not using stage views");
@ -564,12 +534,6 @@ meta_test_monitor_store_fractional_scale (void)
.n_configurations = 1
};
if (!is_using_monitor_config_manager ())
{
g_test_skip ("Not using MetaMonitorConfigManager");
return;
}
if (!meta_is_stage_views_enabled ())
{
g_test_skip ("Not using stage views");
@ -620,12 +584,6 @@ meta_test_monitor_store_high_precision_fractional_scale (void)
.n_configurations = 1
};
if (!is_using_monitor_config_manager ())
{
g_test_skip ("Not using MetaMonitorConfigManager");
return;
}
if (!meta_is_stage_views_enabled ())
{
g_test_skip ("Not using stage views");
@ -686,12 +644,6 @@ meta_test_monitor_store_mirrored (void)
.n_configurations = 1
};
if (!is_using_monitor_config_manager ())
{
g_test_skip ("Not using MetaMonitorConfigManager");
return;
}
set_custom_monitor_config ("mirrored.xml");
check_monitor_configurations (&expect);
@ -763,12 +715,6 @@ meta_test_monitor_store_first_rotated (void)
.n_configurations = 1
};
if (!is_using_monitor_config_manager ())
{
g_test_skip ("Not using MetaMonitorConfigManager");
return;
}
set_custom_monitor_config ("first-rotated.xml");
check_monitor_configurations (&expect);
@ -840,12 +786,6 @@ meta_test_monitor_store_second_rotated (void)
.n_configurations = 1
};
if (!is_using_monitor_config_manager ())
{
g_test_skip ("Not using MetaMonitorConfigManager");
return;
}
set_custom_monitor_config ("second-rotated.xml");
check_monitor_configurations (&expect);
@ -891,12 +831,6 @@ meta_test_monitor_store_interlaced (void)
.n_configurations = 1
};
if (!is_using_monitor_config_manager ())
{
g_test_skip ("Not using MetaMonitorConfigManager");
return;
}
set_custom_monitor_config ("interlaced.xml");
check_monitor_configurations (&expect);

View File

@ -25,12 +25,6 @@
#include "backends/meta-monitor-config-manager.h"
#include "backends/meta-monitor-config-store.h"
gboolean
is_using_monitor_config_manager (void)
{
return meta_is_monitor_config_manager_enabled ();
}
void
set_custom_monitor_config (const char *filename)
{

View File

@ -1550,12 +1550,6 @@ meta_test_monitor_tiled_non_preferred_linear_config (void)
};
MetaMonitorTestSetup *test_setup;
if (!is_using_monitor_config_manager ())
{
g_test_skip ("Only the new monitor config manager handles this case.");
return;
}
test_setup = create_monitor_test_setup (&test_case,
MONITOR_TEST_FLAG_NO_STORED);
emulate_hotplug (test_setup);
@ -1844,12 +1838,6 @@ meta_test_monitor_hidpi_linear_config (void)
};
MetaMonitorTestSetup *test_setup;
if (!is_using_monitor_config_manager ())
{
g_test_skip ("Not using MetaMonitorConfigManager");
return;
}
if (!meta_is_stage_views_enabled ())
{
g_test_skip ("Not using stage views");
@ -2126,15 +2114,9 @@ meta_test_monitor_limited_crtcs (void)
test_setup = create_monitor_test_setup (&test_case,
MONITOR_TEST_FLAG_NO_STORED);
/*
* With the config manager, we'll get a g_warning.
* With the old it's just a meta_warning().
*/
if (is_using_monitor_config_manager ())
{
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING,
"Failed to use linear *");
}
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING,
"Failed to use linear *");
emulate_hotplug (test_setup);
g_test_assert_expected_messages ();
@ -2304,45 +2286,25 @@ meta_test_monitor_lid_switch_config (void)
test_case.expect.crtcs[0].current_mode = 0;
test_case.expect.crtcs[1].current_mode = 0;
if (!is_using_monitor_config_manager ())
{
test_case.expect.logical_monitors[0] = (MonitorTestCaseLogicalMonitor) {
.monitors = { 0 },
.n_monitors = 1,
.layout = {.x = 0, .y = 0, .width = 1024, .height = 768 },
.scale = 1
};
test_case.expect.logical_monitors[1] = (MonitorTestCaseLogicalMonitor) {
.monitors = { 1 },
.n_monitors = 1,
.layout = {.x = 1024, .y = 0, .width = 1024, .height = 768 },
.scale = 1
};
test_case.expect.n_logical_monitors = 2;
test_case.expect.primary_logical_monitor = 0;
}
else
{
/*
* FIXME: The above expectation is correct, but MetaMonitorConfigManager
* doesn't support restoring previous configurations yet, so it'll
* pick keep the external monitor as primary and put it first.
*/
test_case.expect.logical_monitors[0] = (MonitorTestCaseLogicalMonitor) {
.monitors = { 1 },
.n_monitors = 1,
.layout = {.x = 0, .y = 0, .width = 1024, .height = 768 },
.scale = 1
};
test_case.expect.logical_monitors[1] = (MonitorTestCaseLogicalMonitor) {
.monitors = { 0 },
.n_monitors = 1,
.layout = {.x = 1024, .y = 0, .width = 1024, .height = 768 },
.scale = 1
};
test_case.expect.n_logical_monitors = 2;
test_case.expect.primary_logical_monitor = 0;
}
/*
* FIXME: The above expectation is correct, but MetaMonitorConfigManager
* doesn't support restoring previous configurations yet, so it'll
* pick keep the external monitor as primary and put it first.
*/
test_case.expect.logical_monitors[0] = (MonitorTestCaseLogicalMonitor) {
.monitors = { 1 },
.n_monitors = 1,
.layout = {.x = 0, .y = 0, .width = 1024, .height = 768 },
.scale = 1
};
test_case.expect.logical_monitors[1] = (MonitorTestCaseLogicalMonitor) {
.monitors = { 0 },
.n_monitors = 1,
.layout = {.x = 1024, .y = 0, .width = 1024, .height = 768 },
.scale = 1
};
test_case.expect.n_logical_monitors = 2;
test_case.expect.primary_logical_monitor = 0;
check_monitor_configuration (&test_case);
}
@ -2479,12 +2441,6 @@ meta_test_monitor_lid_opened_config (void)
MetaMonitorManagerTest *monitor_manager_test =
META_MONITOR_MANAGER_TEST (monitor_manager);
if (!is_using_monitor_config_manager ())
{
g_test_skip ("Only the new monitor config manager handles this case.");
return;
}
test_setup = create_monitor_test_setup (&test_case,
MONITOR_TEST_FLAG_NO_STORED);
meta_monitor_manager_test_set_is_lid_closed (monitor_manager_test, TRUE);
@ -2625,12 +2581,6 @@ meta_test_monitor_no_outputs (void)
};
MetaMonitorTestSetup *test_setup;
if (!is_using_monitor_config_manager ())
{
g_test_skip ("Only the new monitor config manager handles this case.");
return;
}
test_setup = create_monitor_test_setup (&test_case,
MONITOR_TEST_FLAG_NO_STORED);
@ -2859,12 +2809,6 @@ meta_test_monitor_custom_vertical_config (void)
};
MetaMonitorTestSetup *test_setup;
if (!is_using_monitor_config_manager ())
{
g_test_skip ("Not using MetaMonitorConfigManager");
return;
}
test_setup = create_monitor_test_setup (&test_case,
MONITOR_TEST_FLAG_NONE);
set_custom_monitor_config ("vertical.xml");
@ -3004,12 +2948,6 @@ meta_test_monitor_custom_primary_config (void)
};
MetaMonitorTestSetup *test_setup;
if (!is_using_monitor_config_manager ())
{
g_test_skip ("Not using MetaMonitorConfigManager");
return;
}
test_setup = create_monitor_test_setup (&test_case,
MONITOR_TEST_FLAG_NONE);
set_custom_monitor_config ("primary.xml");
@ -3102,12 +3040,6 @@ meta_test_monitor_custom_underscanning_config (void)
};
MetaMonitorTestSetup *test_setup;
if (!is_using_monitor_config_manager ())
{
g_test_skip ("Not using MetaMonitorConfigManager");
return;
}
test_setup = create_monitor_test_setup (&test_case,
MONITOR_TEST_FLAG_NONE);
set_custom_monitor_config ("underscanning.xml");
@ -3199,12 +3131,6 @@ meta_test_monitor_custom_scale_config (void)
};
MetaMonitorTestSetup *test_setup;
if (!is_using_monitor_config_manager ())
{
g_test_skip ("Not using MetaMonitorConfigManager");
return;
}
if (!meta_is_stage_views_enabled ())
{
g_test_skip ("Not using stage views");
@ -3302,12 +3228,6 @@ meta_test_monitor_custom_fractional_scale_config (void)
};
MetaMonitorTestSetup *test_setup;
if (!is_using_monitor_config_manager ())
{
g_test_skip ("Not using MetaMonitorConfigManager");
return;
}
if (!meta_is_stage_views_enabled ())
{
g_test_skip ("Not using stage views");
@ -3405,12 +3325,6 @@ meta_test_monitor_custom_high_precision_fractional_scale_config (void)
};
MetaMonitorTestSetup *test_setup;
if (!is_using_monitor_config_manager ())
{
g_test_skip ("Not using MetaMonitorConfigManager");
return;
}
if (!meta_is_stage_views_enabled ())
{
g_test_skip ("Not using stage views");
@ -3548,12 +3462,6 @@ meta_test_monitor_custom_tiled_config (void)
};
MetaMonitorTestSetup *test_setup;
if (!is_using_monitor_config_manager ())
{
g_test_skip ("Not using MetaMonitorConfigManager");
return;
}
if (!meta_is_stage_views_enabled ())
{
g_test_skip ("Not using stage views");
@ -3711,12 +3619,6 @@ meta_test_monitor_custom_tiled_custom_resolution_config (void)
};
MetaMonitorTestSetup *test_setup;
if (!is_using_monitor_config_manager ())
{
g_test_skip ("Not using MetaMonitorConfigManager");
return;
}
if (!meta_is_stage_views_enabled ())
{
g_test_skip ("Not using stage views");
@ -3897,12 +3799,6 @@ meta_test_monitor_custom_tiled_non_preferred_config (void)
};
MetaMonitorTestSetup *test_setup;
if (!is_using_monitor_config_manager ())
{
g_test_skip ("Only the new monitor config manager handles this case.");
return;
}
test_setup = create_monitor_test_setup (&test_case,
MONITOR_TEST_FLAG_NONE);
set_custom_monitor_config ("non-preferred-tiled-custom-resolution.xml");
@ -4031,12 +3927,6 @@ meta_test_monitor_custom_mirrored_config (void)
};
MetaMonitorTestSetup *test_setup;
if (!is_using_monitor_config_manager ())
{
g_test_skip ("Not using MetaMonitorConfigManager");
return;
}
test_setup = create_monitor_test_setup (&test_case,
MONITOR_TEST_FLAG_NONE);
set_custom_monitor_config ("mirrored.xml");
@ -4172,12 +4062,6 @@ meta_test_monitor_custom_first_rotated_config (void)
};
MetaMonitorTestSetup *test_setup;
if (!is_using_monitor_config_manager ())
{
g_test_skip ("Not using MetaMonitorConfigManager");
return;
}
test_setup = create_monitor_test_setup (&test_case,
MONITOR_TEST_FLAG_NONE);
set_custom_monitor_config ("first-rotated.xml");
@ -4312,12 +4196,6 @@ meta_test_monitor_custom_second_rotated_config (void)
};
MetaMonitorTestSetup *test_setup;
if (!is_using_monitor_config_manager ())
{
g_test_skip ("Not using MetaMonitorConfigManager");
return;
}
test_setup = create_monitor_test_setup (&test_case,
MONITOR_TEST_FLAG_NONE);
set_custom_monitor_config ("second-rotated.xml");
@ -4504,12 +4382,6 @@ meta_test_monitor_custom_second_rotated_tiled_config (void)
MetaMonitorManagerTest *monitor_manager_test =
META_MONITOR_MANAGER_TEST (monitor_manager);
if (!is_using_monitor_config_manager ())
{
g_test_skip ("Not using MetaMonitorConfigManager");
return;
}
meta_monitor_manager_test_set_handles_transforms (monitor_manager_test,
TRUE);
@ -4652,12 +4524,6 @@ meta_test_monitor_custom_second_rotated_nonnative_config (void)
MetaMonitorManagerTest *monitor_manager_test =
META_MONITOR_MANAGER_TEST (monitor_manager);
if (!is_using_monitor_config_manager ())
{
g_test_skip ("Not using MetaMonitorConfigManager");
return;
}
if (!meta_is_stage_views_enabled ())
{
g_test_skip ("Not using stage views");
@ -4776,12 +4642,6 @@ meta_test_monitor_custom_interlaced_config (void)
};
MetaMonitorTestSetup *test_setup;
if (!is_using_monitor_config_manager ())
{
g_test_skip ("Not using MetaMonitorConfigManager");
return;
}
test_setup = create_monitor_test_setup (&test_case,
MONITOR_TEST_FLAG_NONE);
set_custom_monitor_config ("interlaced.xml");

View File

@ -220,15 +220,9 @@ run_tests (gpointer data)
meta_settings_override_experimental_features (settings);
if (g_strcmp0 (g_getenv ("MUTTER_USE_CONFIG_MANAGER"), "1") == 0)
{
meta_settings_enable_experimental_feature (
settings,
META_EXPERIMENTAL_FEATURE_MONITOR_CONFIG_MANAGER);
meta_settings_enable_experimental_feature (
settings,
META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER);
}
meta_settings_enable_experimental_feature (
settings,
META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER);
ret = g_test_run ();