monitor-manager: Fall back to minimum screen size of 640 x 480

When headless, we don't have any logical monitors to derive a screen
size from, but we can't set it to empty as that will cause issues with
the clutter stage, UI widget layout and other things. To avoid such
issues, just fall back to a 640 x 480 screen size when headless.

https://bugzilla.gnome.org/show_bug.cgi?id=730551
This commit is contained in:
Jonas Ådahl 2017-04-12 14:15:33 +08:00
parent a119e58773
commit 0aa7405a2a
5 changed files with 12 additions and 10 deletions

View File

@ -506,10 +506,11 @@ meta_monitor_manager_dummy_apply_monitors_config (MetaMonitorManager *manag
if (!config) if (!config)
{ {
manager->screen_width = 0; manager->screen_width = META_MONITOR_MANAGER_MIN_SCREEN_WIDTH;
manager->screen_height = 0; manager->screen_height = META_MONITOR_MANAGER_MIN_SCREEN_HEIGHT;
meta_monitor_manager_rebuild (manager, NULL); meta_monitor_manager_rebuild (manager, NULL);
return TRUE;
} }
if (!meta_monitor_config_manager_assign (manager, config, if (!meta_monitor_config_manager_assign (manager, config,

View File

@ -67,6 +67,9 @@ typedef struct _MetaCrtcInfo MetaCrtcInfo;
typedef struct _MetaOutputInfo MetaOutputInfo; typedef struct _MetaOutputInfo MetaOutputInfo;
typedef struct _MetaTileInfo MetaTileInfo; typedef struct _MetaTileInfo MetaTileInfo;
#define META_MONITOR_MANAGER_MIN_SCREEN_WIDTH 640
#define META_MONITOR_MANAGER_MIN_SCREEN_HEIGHT 480
typedef enum _MetaMonitorManagerCapability typedef enum _MetaMonitorManagerCapability
{ {
META_MONITOR_MANAGER_CAPABILITY_NONE = 0, META_MONITOR_MANAGER_CAPABILITY_NONE = 0,

View File

@ -1425,8 +1425,8 @@ meta_monitor_manager_kms_apply_monitors_config (MetaMonitorManager *manager
if (!config) if (!config)
{ {
manager->screen_width = 0; manager->screen_width = META_MONITOR_MANAGER_MIN_SCREEN_WIDTH;
manager->screen_height = 0; manager->screen_height = META_MONITOR_MANAGER_MIN_SCREEN_HEIGHT;
meta_monitor_manager_rebuild (manager, NULL); meta_monitor_manager_rebuild (manager, NULL);
return TRUE; return TRUE;
} }

View File

@ -276,9 +276,8 @@ meta_monitor_manager_test_apply_monitors_config (MetaMonitorManager *manage
if (!config) if (!config)
{ {
/* The screen is made 1x1, as clutter stage used cannot be empty. */ manager->screen_width = META_MONITOR_MANAGER_MIN_SCREEN_WIDTH;
manager->screen_width = 1; manager->screen_height = META_MONITOR_MANAGER_MIN_SCREEN_HEIGHT;
manager->screen_height = 1;
if (meta_is_stage_views_enabled ()) if (meta_is_stage_views_enabled ())
{ {

View File

@ -2563,9 +2563,8 @@ meta_test_monitor_no_outputs (void)
.n_outputs = 0, .n_outputs = 0,
.n_crtcs = 0, .n_crtcs = 0,
.n_tiled_monitors = 0, .n_tiled_monitors = 0,
/* The screen is made 1x1, as clutter stage used cannot be empty. */ .screen_width = META_MONITOR_MANAGER_MIN_SCREEN_WIDTH,
.screen_width = 1, .screen_height = META_MONITOR_MANAGER_MIN_SCREEN_HEIGHT
.screen_height = 1
} }
}; };
MetaMonitorTestSetup *test_setup; MetaMonitorTestSetup *test_setup;