monitor-config-manager: Use monitor match filters to create config
Factorize the creation of a configuration inside one function that looks for the primary monitor and the other monitors using the matching rules and dispose them according to the chosen policy (checking if the result is valid when using the suggested positioning). Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/522>
This commit is contained in:
parent
3dbec4d709
commit
aeea2882e5
@ -30,6 +30,7 @@
|
|||||||
#include "backends/meta-monitor-manager-private.h"
|
#include "backends/meta-monitor-manager-private.h"
|
||||||
#include "backends/meta-output.h"
|
#include "backends/meta-output.h"
|
||||||
#include "core/boxes-private.h"
|
#include "core/boxes-private.h"
|
||||||
|
#include "meta/meta-monitor-manager.h"
|
||||||
|
|
||||||
#define CONFIG_HISTORY_MAX_SIZE 3
|
#define CONFIG_HISTORY_MAX_SIZE 3
|
||||||
|
|
||||||
@ -546,6 +547,8 @@ typedef enum _MonitorMatchRule
|
|||||||
MONITOR_MATCH_BUILTIN = (1 << 1),
|
MONITOR_MATCH_BUILTIN = (1 << 1),
|
||||||
MONITOR_MATCH_VISIBLE = (1 << 2),
|
MONITOR_MATCH_VISIBLE = (1 << 2),
|
||||||
MONITOR_MATCH_WITH_SUGGESTED_POSITION = (1 << 3),
|
MONITOR_MATCH_WITH_SUGGESTED_POSITION = (1 << 3),
|
||||||
|
MONITOR_MATCH_PRIMARY = (1 << 4),
|
||||||
|
MONITOR_MATCH_ALLOW_FALLBACK = (1 << 5),
|
||||||
} MonitorMatchRule;
|
} MonitorMatchRule;
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -649,8 +652,6 @@ find_primary_monitor (MetaMonitorManager *monitor_manager,
|
|||||||
{
|
{
|
||||||
MetaMonitor *monitor;
|
MetaMonitor *monitor;
|
||||||
|
|
||||||
match_rule |= MONITOR_MATCH_VISIBLE;
|
|
||||||
|
|
||||||
monitor = meta_monitor_manager_get_primary_monitor (monitor_manager);
|
monitor = meta_monitor_manager_get_primary_monitor (monitor_manager);
|
||||||
if (monitor_matches_rule (monitor, monitor_manager, match_rule))
|
if (monitor_matches_rule (monitor, monitor_manager, match_rule))
|
||||||
return monitor;
|
return monitor;
|
||||||
@ -664,8 +665,11 @@ find_primary_monitor (MetaMonitorManager *monitor_manager,
|
|||||||
if (monitor)
|
if (monitor)
|
||||||
return monitor;
|
return monitor;
|
||||||
|
|
||||||
|
if (match_rule & MONITOR_MATCH_ALLOW_FALLBACK)
|
||||||
return find_monitor_with_highest_preferred_resolution (monitor_manager,
|
return find_monitor_with_highest_preferred_resolution (monitor_manager,
|
||||||
MONITOR_MATCH_ALL);
|
MONITOR_MATCH_ALL);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MetaMonitorConfig *
|
static MetaMonitorConfig *
|
||||||
@ -781,37 +785,96 @@ create_preferred_logical_monitor_config (MetaMonitorManager *monitor_ma
|
|||||||
return logical_monitor_config;
|
return logical_monitor_config;
|
||||||
}
|
}
|
||||||
|
|
||||||
MetaMonitorsConfig *
|
typedef enum _MonitorPositioningMode
|
||||||
meta_monitor_config_manager_create_linear (MetaMonitorConfigManager *config_manager)
|
{
|
||||||
|
MONITOR_POSITIONING_LINEAR,
|
||||||
|
MONITOR_POSITIONING_SUGGESTED,
|
||||||
|
} MonitorPositioningMode;
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
verify_suggested_monitors_config (GList *logical_monitor_configs)
|
||||||
|
{
|
||||||
|
g_autoptr (GList) region = NULL;
|
||||||
|
GList *l;
|
||||||
|
|
||||||
|
for (l = logical_monitor_configs; l; l = l->next)
|
||||||
|
{
|
||||||
|
MetaLogicalMonitorConfig *logical_monitor_config = l->data;
|
||||||
|
MetaRectangle *rect = &logical_monitor_config->layout;
|
||||||
|
|
||||||
|
if (meta_rectangle_overlaps_with_region (region, rect))
|
||||||
|
{
|
||||||
|
g_warning ("Suggested monitor config has overlapping region, "
|
||||||
|
"rejecting");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
region = g_list_prepend (region, rect);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (l = region; region->next && l; l = l->next)
|
||||||
|
{
|
||||||
|
MetaRectangle *rect = l->data;
|
||||||
|
|
||||||
|
if (!meta_rectangle_is_adjacent_to_any_in_region (region, rect))
|
||||||
|
{
|
||||||
|
g_warning ("Suggested monitor config has monitors with no "
|
||||||
|
"neighbors, rejecting");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static MetaMonitorsConfig *
|
||||||
|
create_monitors_config (MetaMonitorConfigManager *config_manager,
|
||||||
|
MonitorMatchRule match_rule,
|
||||||
|
MonitorPositioningMode positioning,
|
||||||
|
MetaMonitorsConfigFlag config_flags)
|
||||||
{
|
{
|
||||||
MetaMonitorManager *monitor_manager = config_manager->monitor_manager;
|
MetaMonitorManager *monitor_manager = config_manager->monitor_manager;
|
||||||
g_autoptr (GList) monitors = NULL;
|
g_autoptr (GList) monitors = NULL;
|
||||||
GList *logical_monitor_configs;
|
g_autolist (MetaLogicalMonitorConfig) logical_monitor_configs = NULL;
|
||||||
MetaMonitor *primary_monitor;
|
MetaMonitor *primary_monitor;
|
||||||
MetaLogicalMonitorLayoutMode layout_mode;
|
MetaLogicalMonitorLayoutMode layout_mode;
|
||||||
MetaLogicalMonitorConfig *primary_logical_monitor_config;
|
MetaLogicalMonitorConfig *primary_logical_monitor_config;
|
||||||
int x;
|
gboolean has_suggested_position;
|
||||||
GList *l;
|
GList *l;
|
||||||
MetaMonitorsConfig *monitors_config;
|
int x, y;
|
||||||
|
|
||||||
primary_monitor = find_primary_monitor (monitor_manager,
|
primary_monitor = find_primary_monitor (monitor_manager,
|
||||||
MONITOR_MATCH_VISIBLE);
|
match_rule | MONITOR_MATCH_VISIBLE);
|
||||||
if (!primary_monitor)
|
if (!primary_monitor)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
layout_mode = meta_monitor_manager_get_default_layout_mode (monitor_manager);
|
layout_mode = meta_monitor_manager_get_default_layout_mode (monitor_manager);
|
||||||
monitors = find_monitors (monitor_manager, MONITOR_MATCH_VISIBLE);
|
|
||||||
|
switch (positioning)
|
||||||
|
{
|
||||||
|
case MONITOR_POSITIONING_LINEAR:
|
||||||
|
x = y = 0;
|
||||||
|
break;
|
||||||
|
case MONITOR_POSITIONING_SUGGESTED:
|
||||||
|
has_suggested_position =
|
||||||
|
meta_monitor_get_suggested_position (primary_monitor, &x, &y);
|
||||||
|
g_assert (has_suggested_position);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
primary_logical_monitor_config =
|
primary_logical_monitor_config =
|
||||||
create_preferred_logical_monitor_config (monitor_manager,
|
create_preferred_logical_monitor_config (monitor_manager,
|
||||||
primary_monitor,
|
primary_monitor,
|
||||||
0, 0,
|
x, y,
|
||||||
NULL,
|
NULL,
|
||||||
layout_mode);
|
layout_mode);
|
||||||
primary_logical_monitor_config->is_primary = TRUE;
|
primary_logical_monitor_config->is_primary = TRUE;
|
||||||
logical_monitor_configs = g_list_append (NULL,
|
logical_monitor_configs = g_list_append (NULL,
|
||||||
primary_logical_monitor_config);
|
primary_logical_monitor_config);
|
||||||
|
|
||||||
|
if (!(match_rule & MONITOR_MATCH_PRIMARY))
|
||||||
|
monitors = find_monitors (monitor_manager, match_rule);
|
||||||
|
|
||||||
x = primary_logical_monitor_config->layout.width;
|
x = primary_logical_monitor_config->layout.width;
|
||||||
for (l = monitors; l; l = l->next)
|
for (l = monitors; l; l = l->next)
|
||||||
{
|
{
|
||||||
@ -821,10 +884,21 @@ meta_monitor_config_manager_create_linear (MetaMonitorConfigManager *config_mana
|
|||||||
if (monitor == primary_monitor)
|
if (monitor == primary_monitor)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
switch (positioning)
|
||||||
|
{
|
||||||
|
case MONITOR_POSITIONING_LINEAR:
|
||||||
|
break;
|
||||||
|
case MONITOR_POSITIONING_SUGGESTED:
|
||||||
|
has_suggested_position =
|
||||||
|
meta_monitor_get_suggested_position (monitor, &x, &y);
|
||||||
|
g_assert (has_suggested_position);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
logical_monitor_config =
|
logical_monitor_config =
|
||||||
create_preferred_logical_monitor_config (monitor_manager,
|
create_preferred_logical_monitor_config (monitor_manager,
|
||||||
monitor,
|
monitor,
|
||||||
x, 0,
|
x, y,
|
||||||
primary_logical_monitor_config,
|
primary_logical_monitor_config,
|
||||||
layout_mode);
|
layout_mode);
|
||||||
logical_monitor_configs = g_list_append (logical_monitor_configs,
|
logical_monitor_configs = g_list_append (logical_monitor_configs,
|
||||||
@ -833,139 +907,44 @@ meta_monitor_config_manager_create_linear (MetaMonitorConfigManager *config_mana
|
|||||||
x += logical_monitor_config->layout.width;
|
x += logical_monitor_config->layout.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
monitors_config = meta_monitors_config_new (monitor_manager,
|
if (positioning == MONITOR_POSITIONING_SUGGESTED)
|
||||||
logical_monitor_configs,
|
{
|
||||||
|
if (!verify_suggested_monitors_config (logical_monitor_configs))
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return meta_monitors_config_new (monitor_manager,
|
||||||
|
g_steal_pointer (&logical_monitor_configs),
|
||||||
layout_mode,
|
layout_mode,
|
||||||
|
config_flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
MetaMonitorsConfig *
|
||||||
|
meta_monitor_config_manager_create_linear (MetaMonitorConfigManager *config_manager)
|
||||||
|
{
|
||||||
|
return create_monitors_config (config_manager,
|
||||||
|
MONITOR_MATCH_VISIBLE |
|
||||||
|
MONITOR_MATCH_ALLOW_FALLBACK,
|
||||||
|
MONITOR_POSITIONING_LINEAR,
|
||||||
META_MONITORS_CONFIG_FLAG_NONE);
|
META_MONITORS_CONFIG_FLAG_NONE);
|
||||||
|
|
||||||
if (monitors_config)
|
|
||||||
meta_monitors_config_set_switch_config (monitors_config, META_MONITOR_SWITCH_CONFIG_ALL_LINEAR);
|
|
||||||
|
|
||||||
return monitors_config;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MetaMonitorsConfig *
|
MetaMonitorsConfig *
|
||||||
meta_monitor_config_manager_create_fallback (MetaMonitorConfigManager *config_manager)
|
meta_monitor_config_manager_create_fallback (MetaMonitorConfigManager *config_manager)
|
||||||
{
|
{
|
||||||
MetaMonitorManager *monitor_manager = config_manager->monitor_manager;
|
return create_monitors_config (config_manager,
|
||||||
MetaMonitor *primary_monitor;
|
MONITOR_MATCH_PRIMARY |
|
||||||
GList *logical_monitor_configs;
|
MONITOR_MATCH_ALLOW_FALLBACK,
|
||||||
MetaLogicalMonitorLayoutMode layout_mode;
|
MONITOR_POSITIONING_LINEAR,
|
||||||
MetaLogicalMonitorConfig *primary_logical_monitor_config;
|
|
||||||
|
|
||||||
primary_monitor = find_primary_monitor (monitor_manager, MONITOR_MATCH_ALL);
|
|
||||||
if (!primary_monitor)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
layout_mode = meta_monitor_manager_get_default_layout_mode (monitor_manager);
|
|
||||||
|
|
||||||
primary_logical_monitor_config =
|
|
||||||
create_preferred_logical_monitor_config (monitor_manager,
|
|
||||||
primary_monitor,
|
|
||||||
0, 0,
|
|
||||||
NULL,
|
|
||||||
layout_mode);
|
|
||||||
primary_logical_monitor_config->is_primary = TRUE;
|
|
||||||
logical_monitor_configs = g_list_append (NULL,
|
|
||||||
primary_logical_monitor_config);
|
|
||||||
|
|
||||||
return meta_monitors_config_new (monitor_manager,
|
|
||||||
logical_monitor_configs,
|
|
||||||
layout_mode,
|
|
||||||
META_MONITORS_CONFIG_FLAG_NONE);
|
META_MONITORS_CONFIG_FLAG_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
MetaMonitorsConfig *
|
MetaMonitorsConfig *
|
||||||
meta_monitor_config_manager_create_suggested (MetaMonitorConfigManager *config_manager)
|
meta_monitor_config_manager_create_suggested (MetaMonitorConfigManager *config_manager)
|
||||||
{
|
{
|
||||||
MetaMonitorManager *monitor_manager = config_manager->monitor_manager;
|
return create_monitors_config (config_manager,
|
||||||
MetaLogicalMonitorConfig *primary_logical_monitor_config = NULL;
|
MONITOR_MATCH_WITH_SUGGESTED_POSITION,
|
||||||
g_autoptr (GList) monitors = NULL;
|
MONITOR_POSITIONING_SUGGESTED,
|
||||||
MetaMonitor *primary_monitor;
|
|
||||||
MetaLogicalMonitorLayoutMode layout_mode;
|
|
||||||
GList *logical_monitor_configs;
|
|
||||||
GList *region;
|
|
||||||
GList *l;
|
|
||||||
int x, y;
|
|
||||||
|
|
||||||
primary_monitor = find_primary_monitor (monitor_manager,
|
|
||||||
MONITOR_MATCH_WITH_SUGGESTED_POSITION);
|
|
||||||
if (!primary_monitor)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (!meta_monitor_get_suggested_position (primary_monitor, &x, &y))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
monitors = find_monitors (monitor_manager,
|
|
||||||
MONITOR_MATCH_WITH_SUGGESTED_POSITION);
|
|
||||||
layout_mode = meta_monitor_manager_get_default_layout_mode (monitor_manager);
|
|
||||||
|
|
||||||
primary_logical_monitor_config =
|
|
||||||
create_preferred_logical_monitor_config (monitor_manager,
|
|
||||||
primary_monitor,
|
|
||||||
x, y,
|
|
||||||
NULL,
|
|
||||||
layout_mode);
|
|
||||||
primary_logical_monitor_config->is_primary = TRUE;
|
|
||||||
logical_monitor_configs = g_list_append (NULL,
|
|
||||||
primary_logical_monitor_config);
|
|
||||||
region = g_list_prepend (NULL, &primary_logical_monitor_config->layout);
|
|
||||||
|
|
||||||
for (l = monitors; l; l = l->next)
|
|
||||||
{
|
|
||||||
MetaMonitor *monitor = l->data;
|
|
||||||
MetaLogicalMonitorConfig *logical_monitor_config;
|
|
||||||
|
|
||||||
if (monitor == primary_monitor)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
meta_monitor_get_suggested_position (monitor, &x, &y);
|
|
||||||
|
|
||||||
logical_monitor_config =
|
|
||||||
create_preferred_logical_monitor_config (monitor_manager,
|
|
||||||
monitor,
|
|
||||||
x, y,
|
|
||||||
primary_logical_monitor_config,
|
|
||||||
layout_mode);
|
|
||||||
logical_monitor_configs = g_list_append (logical_monitor_configs,
|
|
||||||
logical_monitor_config);
|
|
||||||
|
|
||||||
if (meta_rectangle_overlaps_with_region (region,
|
|
||||||
&logical_monitor_config->layout))
|
|
||||||
{
|
|
||||||
g_warning ("Suggested monitor config has overlapping region, rejecting");
|
|
||||||
g_list_free (region);
|
|
||||||
g_list_free_full (logical_monitor_configs,
|
|
||||||
(GDestroyNotify) meta_logical_monitor_config_free);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
region = g_list_prepend (region, &logical_monitor_config->layout);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (l = region; region->next && l; l = l->next)
|
|
||||||
{
|
|
||||||
MetaRectangle *rect = l->data;
|
|
||||||
|
|
||||||
if (!meta_rectangle_is_adjacent_to_any_in_region (region, rect))
|
|
||||||
{
|
|
||||||
g_warning ("Suggested monitor config has monitors with no neighbors, "
|
|
||||||
"rejecting");
|
|
||||||
g_list_free (region);
|
|
||||||
g_list_free_full (logical_monitor_configs,
|
|
||||||
(GDestroyNotify) meta_logical_monitor_config_free);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_list_free (region);
|
|
||||||
|
|
||||||
if (!logical_monitor_configs)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return meta_monitors_config_new (monitor_manager,
|
|
||||||
logical_monitor_configs,
|
|
||||||
layout_mode,
|
|
||||||
META_MONITORS_CONFIG_FLAG_NONE);
|
META_MONITORS_CONFIG_FLAG_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1126,6 +1105,25 @@ meta_monitor_config_manager_create_for_rotate_monitor (MetaMonitorConfigManager
|
|||||||
return create_for_builtin_display_rotation (config_manager, TRUE, META_MONITOR_TRANSFORM_NORMAL);
|
return create_for_builtin_display_rotation (config_manager, TRUE, META_MONITOR_TRANSFORM_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static MetaMonitorsConfig *
|
||||||
|
create_monitors_switch_config (MetaMonitorConfigManager *config_manager,
|
||||||
|
MonitorMatchRule match_rule,
|
||||||
|
MonitorPositioningMode positioning,
|
||||||
|
MetaMonitorsConfigFlag config_flags,
|
||||||
|
MetaMonitorSwitchConfigType switch_config)
|
||||||
|
{
|
||||||
|
MetaMonitorsConfig *monitors_config;
|
||||||
|
|
||||||
|
monitors_config = create_monitors_config (config_manager, match_rule,
|
||||||
|
positioning, config_flags);
|
||||||
|
|
||||||
|
if (!monitors_config)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
meta_monitors_config_set_switch_config (monitors_config, switch_config);
|
||||||
|
return monitors_config;
|
||||||
|
}
|
||||||
|
|
||||||
static MetaMonitorsConfig *
|
static MetaMonitorsConfig *
|
||||||
create_for_switch_config_all_mirror (MetaMonitorConfigManager *config_manager)
|
create_for_switch_config_all_mirror (MetaMonitorConfigManager *config_manager)
|
||||||
{
|
{
|
||||||
@ -1249,86 +1247,21 @@ create_for_switch_config_all_mirror (MetaMonitorConfigManager *config_manager)
|
|||||||
static MetaMonitorsConfig *
|
static MetaMonitorsConfig *
|
||||||
create_for_switch_config_external (MetaMonitorConfigManager *config_manager)
|
create_for_switch_config_external (MetaMonitorConfigManager *config_manager)
|
||||||
{
|
{
|
||||||
MetaMonitorManager *monitor_manager = config_manager->monitor_manager;
|
return create_monitors_switch_config (config_manager,
|
||||||
g_autoptr (GList) monitors = NULL;
|
MONITOR_MATCH_EXTERNAL,
|
||||||
GList *logical_monitor_configs = NULL;
|
MONITOR_POSITIONING_LINEAR,
|
||||||
int x = 0;
|
META_MONITORS_CONFIG_FLAG_NONE,
|
||||||
MetaLogicalMonitorLayoutMode layout_mode;
|
META_MONITOR_SWITCH_CONFIG_EXTERNAL);
|
||||||
GList *l;
|
|
||||||
MetaMonitorsConfig *monitors_config;
|
|
||||||
|
|
||||||
monitors = find_monitors (monitor_manager, MONITOR_MATCH_EXTERNAL);
|
|
||||||
layout_mode = meta_monitor_manager_get_default_layout_mode (monitor_manager);
|
|
||||||
|
|
||||||
for (l = monitors; l; l = l->next)
|
|
||||||
{
|
|
||||||
MetaMonitor *monitor = l->data;
|
|
||||||
MetaLogicalMonitorConfig *logical_monitor_config;
|
|
||||||
|
|
||||||
logical_monitor_config =
|
|
||||||
create_preferred_logical_monitor_config (monitor_manager,
|
|
||||||
monitor,
|
|
||||||
x, 0,
|
|
||||||
NULL,
|
|
||||||
layout_mode);
|
|
||||||
logical_monitor_configs = g_list_append (logical_monitor_configs,
|
|
||||||
logical_monitor_config);
|
|
||||||
|
|
||||||
if (x == 0)
|
|
||||||
logical_monitor_config->is_primary = TRUE;
|
|
||||||
|
|
||||||
x += logical_monitor_config->layout.width;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!logical_monitor_configs)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
monitors_config = meta_monitors_config_new (monitor_manager,
|
|
||||||
logical_monitor_configs,
|
|
||||||
layout_mode,
|
|
||||||
META_MONITORS_CONFIG_FLAG_NONE);
|
|
||||||
|
|
||||||
if (monitors_config)
|
|
||||||
meta_monitors_config_set_switch_config (monitors_config, META_MONITOR_SWITCH_CONFIG_EXTERNAL);
|
|
||||||
|
|
||||||
return monitors_config;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static MetaMonitorsConfig *
|
static MetaMonitorsConfig *
|
||||||
create_for_switch_config_builtin (MetaMonitorConfigManager *config_manager)
|
create_for_switch_config_builtin (MetaMonitorConfigManager *config_manager)
|
||||||
{
|
{
|
||||||
MetaMonitorManager *monitor_manager = config_manager->monitor_manager;
|
return create_monitors_switch_config (config_manager,
|
||||||
MetaLogicalMonitorLayoutMode layout_mode;
|
MONITOR_MATCH_BUILTIN,
|
||||||
GList *logical_monitor_configs;
|
MONITOR_POSITIONING_LINEAR,
|
||||||
MetaLogicalMonitorConfig *primary_logical_monitor_config;
|
META_MONITORS_CONFIG_FLAG_NONE,
|
||||||
MetaMonitor *monitor;
|
META_MONITOR_SWITCH_CONFIG_BUILTIN);
|
||||||
MetaMonitorsConfig *monitors_config;
|
|
||||||
|
|
||||||
monitor = meta_monitor_manager_get_laptop_panel (monitor_manager);
|
|
||||||
if (!monitor)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
layout_mode = meta_monitor_manager_get_default_layout_mode (monitor_manager);
|
|
||||||
|
|
||||||
primary_logical_monitor_config =
|
|
||||||
create_preferred_logical_monitor_config (monitor_manager,
|
|
||||||
monitor,
|
|
||||||
0, 0,
|
|
||||||
NULL,
|
|
||||||
layout_mode);
|
|
||||||
primary_logical_monitor_config->is_primary = TRUE;
|
|
||||||
logical_monitor_configs = g_list_append (NULL,
|
|
||||||
primary_logical_monitor_config);
|
|
||||||
|
|
||||||
monitors_config = meta_monitors_config_new (monitor_manager,
|
|
||||||
logical_monitor_configs,
|
|
||||||
layout_mode,
|
|
||||||
META_MONITORS_CONFIG_FLAG_NONE);
|
|
||||||
|
|
||||||
if (monitors_config)
|
|
||||||
meta_monitors_config_set_switch_config (monitors_config, META_MONITOR_SWITCH_CONFIG_BUILTIN);
|
|
||||||
|
|
||||||
return monitors_config;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MetaMonitorsConfig *
|
MetaMonitorsConfig *
|
||||||
|
Loading…
Reference in New Issue
Block a user