mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 21:05:58 +01:00
backend/drm: restore custom modes
We were only restoring fixed modes here. The DRM backend no longer creates fixed modes when the compositor sets a custom mode, so we need to handle this situation when restoring. Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3698
This commit is contained in:
parent
2f859f5bec
commit
307720d501
1 changed files with 9 additions and 8 deletions
|
@ -121,17 +121,18 @@ static void handle_session_active(struct wl_listener *listener, void *data) {
|
||||||
|
|
||||||
struct wlr_drm_connector *conn;
|
struct wlr_drm_connector *conn;
|
||||||
wl_list_for_each(conn, &drm->connectors, link) {
|
wl_list_for_each(conn, &drm->connectors, link) {
|
||||||
struct wlr_output_mode *mode = NULL;
|
bool enabled = conn->status != DRM_MODE_DISCONNECTED && conn->output.enabled;
|
||||||
if (conn->status != DRM_MODE_DISCONNECTED && conn->output.enabled
|
|
||||||
&& conn->output.current_mode != NULL) {
|
|
||||||
mode = conn->output.current_mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct wlr_output_state state;
|
struct wlr_output_state state;
|
||||||
wlr_output_state_init(&state);
|
wlr_output_state_init(&state);
|
||||||
wlr_output_state_set_enabled(&state, mode != NULL);
|
wlr_output_state_set_enabled(&state, enabled);
|
||||||
if (mode != NULL) {
|
if (enabled) {
|
||||||
wlr_output_state_set_mode(&state, mode);
|
if (conn->output.current_mode != NULL) {
|
||||||
|
wlr_output_state_set_mode(&state, conn->output.current_mode);
|
||||||
|
} else {
|
||||||
|
wlr_output_state_set_custom_mode(&state,
|
||||||
|
conn->output.width, conn->output.height, conn->output.refresh);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!drm_connector_commit_state(conn, &state)) {
|
if (!drm_connector_commit_state(conn, &state)) {
|
||||||
wlr_drm_conn_log(conn, WLR_ERROR, "Failed to restore state after VT switch");
|
wlr_drm_conn_log(conn, WLR_ERROR, "Failed to restore state after VT switch");
|
||||||
|
|
Loading…
Reference in a new issue