weston: keep non-desktop displays turned off by default

Keep non-desktop heads representing e.g. head mounted displays turned off by
default. When using the DRM backend they can still be enabled by setting an
explicit [output] mode (or "mode=preferred") in weston.ini.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
dev
Philipp Zabel 6 years ago committed by Daniel Stone
parent 61dc4ca92e
commit b9454fde9f
  1. 10
      compositor/main.c

@ -1411,13 +1411,15 @@ simple_heads_changed(struct wl_listener *listener, void *arg)
bool connected; bool connected;
bool enabled; bool enabled;
bool changed; bool changed;
bool non_desktop;
while ((head = weston_compositor_iterate_heads(wet->compositor, head))) { while ((head = weston_compositor_iterate_heads(wet->compositor, head))) {
connected = weston_head_is_connected(head); connected = weston_head_is_connected(head);
enabled = weston_head_is_enabled(head); enabled = weston_head_is_enabled(head);
changed = weston_head_is_device_changed(head); changed = weston_head_is_device_changed(head);
non_desktop = weston_head_is_non_desktop(head);
if (connected && !enabled) { if (connected && !enabled && !non_desktop) {
simple_head_enable(wet, head); simple_head_enable(wet, head);
} else if (!connected && enabled) { } else if (!connected && enabled) {
simple_head_disable(head); simple_head_disable(head);
@ -1715,14 +1717,16 @@ drm_head_prepare_enable(struct wet_compositor *wet,
section = drm_config_find_controlling_output_section(wet->config, name); section = drm_config_find_controlling_output_section(wet->config, name);
if (section) { if (section) {
/* skip outputs that are explicitly off, the backend turns /* skip outputs that are explicitly off, or non-desktop and not
* them off automatically. * explicitly enabled. The backend turns them off automatically.
*/ */
weston_config_section_get_string(section, "mode", &mode, NULL); weston_config_section_get_string(section, "mode", &mode, NULL);
if (mode && strcmp(mode, "off") == 0) { if (mode && strcmp(mode, "off") == 0) {
free(mode); free(mode);
return; return;
} }
if (!mode && weston_head_is_non_desktop(head))
return;
free(mode); free(mode);
weston_config_section_get_string(section, "name", weston_config_section_get_string(section, "name",

Loading…
Cancel
Save