rootston: use wlr_output_preferred_mode

Also fix rootston setting the preferred mode when another mode is specified in
the config file.
This commit is contained in:
Simon Ser 2019-04-22 14:03:59 +03:00 committed by Drew DeVault
parent 8acbf449cc
commit 56ceed38bf

View file

@ -643,12 +643,8 @@ void handle_new_output(struct wl_listener *listener, void *data) {
struct roots_output_config *output_config = struct roots_output_config *output_config =
roots_config_get_output(config, wlr_output); roots_config_get_output(config, wlr_output);
if ((!output_config || output_config->enable) && !wl_list_empty(&wlr_output->modes)) { struct wlr_output_mode *preferred_mode =
struct wlr_output_mode *mode = wlr_output_preferred_mode(wlr_output);
wl_container_of(wlr_output->modes.prev, mode, link);
wlr_output_set_mode(wlr_output, mode);
}
if (output_config) { if (output_config) {
if (output_config->enable) { if (output_config->enable) {
if (wlr_output_is_drm(wlr_output)) { if (wlr_output_is_drm(wlr_output)) {
@ -662,6 +658,8 @@ void handle_new_output(struct wl_listener *listener, void *data) {
if (output_config->mode.width) { if (output_config->mode.width) {
set_mode(wlr_output, output_config); set_mode(wlr_output, output_config);
} else if (preferred_mode != NULL) {
wlr_output_set_mode(wlr_output, preferred_mode);
} }
wlr_output_set_scale(wlr_output, output_config->scale); wlr_output_set_scale(wlr_output, output_config->scale);
@ -672,6 +670,9 @@ void handle_new_output(struct wl_listener *listener, void *data) {
wlr_output_enable(wlr_output, false); wlr_output_enable(wlr_output, false);
} }
} else { } else {
if (preferred_mode != NULL) {
wlr_output_set_mode(wlr_output, preferred_mode);
}
wlr_output_layout_add_auto(desktop->layout, wlr_output); wlr_output_layout_add_auto(desktop->layout, wlr_output);
} }