diff options
Diffstat (limited to 'backend')
-rw-r--r-- | backend/drm/backend.c | 17 | ||||
-rw-r--r-- | backend/drm/drm.c | 9 | ||||
-rw-r--r-- | backend/wayland/output.c | 9 | ||||
-rw-r--r-- | backend/x11/output.c | 9 |
4 files changed, 20 insertions, 24 deletions
diff --git a/backend/drm/backend.c b/backend/drm/backend.c index 89240352..b3af3005 100644 --- a/backend/drm/backend.c +++ b/backend/drm/backend.c @@ -121,22 +121,21 @@ static void handle_session_active(struct wl_listener *listener, void *data) { struct wlr_drm_connector *conn; wl_list_for_each(conn, &drm->connectors, link) { struct wlr_output_mode *mode = NULL; - uint32_t committed = WLR_OUTPUT_STATE_ENABLED; if (conn->status != DRM_MODE_DISCONNECTED && conn->output.enabled && conn->output.current_mode != NULL) { - committed |= WLR_OUTPUT_STATE_MODE; mode = conn->output.current_mode; } - struct wlr_output_state state = { - .committed = committed, - .allow_artifacts = true, - .enabled = mode != NULL, - .mode_type = WLR_OUTPUT_STATE_MODE_FIXED, - .mode = mode, - }; + + struct wlr_output_state state; + wlr_output_state_init(&state); + wlr_output_state_set_enabled(&state, mode != NULL); + if (mode != NULL) { + wlr_output_state_set_mode(&state, mode); + } if (!drm_connector_commit_state(conn, &state)) { wlr_drm_conn_log(conn, WLR_ERROR, "Failed to restore state after VT switch"); } + wlr_output_state_finish(&state); } } else { wlr_log(WLR_INFO, "DRM fd paused"); diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 22bc6681..7ead82ab 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -1155,16 +1155,15 @@ static void dealloc_crtc(struct wlr_drm_connector *conn) { wlr_drm_conn_log(conn, WLR_DEBUG, "De-allocating CRTC %" PRIu32, conn->crtc->id); - struct wlr_output_state state = { - .committed = WLR_OUTPUT_STATE_ENABLED, - .allow_artifacts = true, - .enabled = false, - }; + struct wlr_output_state state; + wlr_output_state_init(&state); + wlr_output_state_set_enabled(&state, false); if (!drm_connector_commit_state(conn, &state)) { // On GPU unplug, disabling the CRTC can fail with EPERM wlr_drm_conn_log(conn, WLR_ERROR, "Failed to disable CRTC %"PRIu32, conn->crtc->id); } + wlr_output_state_finish(&state); } static void realloc_crtcs(struct wlr_drm_backend *drm, diff --git a/backend/wayland/output.c b/backend/wayland/output.c index d16b0dbc..22f61de0 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -703,12 +703,11 @@ static void xdg_toplevel_handle_configure(void *data, return; } - struct wlr_output_state state = { - .committed = WLR_OUTPUT_STATE_MODE, - .mode_type = WLR_OUTPUT_STATE_MODE_CUSTOM, - .custom_mode = { .width = width, .height = height }, - }; + struct wlr_output_state state; + wlr_output_state_init(&state); + wlr_output_state_set_custom_mode(&state, width, height, 0); wlr_output_send_request_state(&output->wlr_output, &state); + wlr_output_state_finish(&state); } static void xdg_toplevel_handle_close(void *data, diff --git a/backend/x11/output.c b/backend/x11/output.c index 517ea85b..0fd9b9c5 100644 --- a/backend/x11/output.c +++ b/backend/x11/output.c @@ -623,12 +623,11 @@ void handle_x11_configure_notify(struct wlr_x11_output *output, return; } - struct wlr_output_state state = { - .committed = WLR_OUTPUT_STATE_MODE, - .mode_type = WLR_OUTPUT_STATE_MODE_CUSTOM, - .custom_mode = { .width = ev->width, .height = ev->height }, - }; + struct wlr_output_state state; + wlr_output_state_init(&state); + wlr_output_state_set_custom_mode(&state, ev->width, ev->height, 0); wlr_output_send_request_state(&output->wlr_output, &state); + wlr_output_state_finish(&state); } bool wlr_output_is_x11(struct wlr_output *wlr_output) { |