From dc701b72fc579776cf10bf7d5ec91c033f9bec8e Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Tue, 16 Jan 2018 07:12:46 -0500 Subject: abstract box matrix --- include/wlr/types/wlr_output.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/wlr') diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index 71463cb5..4c59d98b 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -136,4 +136,11 @@ enum wl_output_transform wlr_output_transform_invert( enum wl_output_transform wlr_output_transform_compose( enum wl_output_transform tr_a, enum wl_output_transform tr_b); +/** + * Get a matrix suitable for rendering a box on the output. + */ +void wlr_output_get_box_matrix(struct wlr_output *output, int ox, int oy, + int width, int height, enum wl_output_transform transform, + float rotation, float (*mat)[16]); + #endif -- cgit v1.2.3 From d13114520acef63f9293ff313b8a549bc81be30c Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Sun, 21 Jan 2018 15:53:29 -0500 Subject: move matrix model code to matrix.h --- include/wlr/render/matrix.h | 3 +++ include/wlr/types/wlr_output.h | 7 ------- render/matrix.c | 46 ++++++++++++++++++++++++++++++++++++++++++ rootston/output.c | 25 +++++++++++++++++------ types/wlr_output.c | 43 --------------------------------------- 5 files changed, 68 insertions(+), 56 deletions(-) (limited to 'include/wlr') diff --git a/include/wlr/render/matrix.h b/include/wlr/render/matrix.h index 0b35aad3..dbd06c8d 100644 --- a/include/wlr/render/matrix.h +++ b/include/wlr/render/matrix.h @@ -2,6 +2,7 @@ #define WLR_RENDER_MATRIX_H #include +#include void wlr_matrix_identity(float (*output)[16]); void wlr_matrix_translate(float (*output)[16], float x, float y, float z); @@ -14,5 +15,7 @@ void wlr_matrix_transform(float mat[static 16], enum wl_output_transform transform); void wlr_matrix_texture(float mat[static 16], int32_t width, int32_t height, enum wl_output_transform transform); +void wlr_matrix_box_model(float (*mat)[16], struct wlr_box *box, + enum wl_output_transform transform, float rotation); #endif diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index 4c59d98b..71463cb5 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -136,11 +136,4 @@ enum wl_output_transform wlr_output_transform_invert( enum wl_output_transform wlr_output_transform_compose( enum wl_output_transform tr_a, enum wl_output_transform tr_b); -/** - * Get a matrix suitable for rendering a box on the output. - */ -void wlr_output_get_box_matrix(struct wlr_output *output, int ox, int oy, - int width, int height, enum wl_output_transform transform, - float rotation, float (*mat)[16]); - #endif diff --git a/render/matrix.c b/render/matrix.c index 54dba4cc..a64a8f9b 100644 --- a/render/matrix.c +++ b/render/matrix.c @@ -1,6 +1,8 @@ #include #include #include +#include +#include #include /* Obtains the index for the given row/column */ @@ -158,3 +160,47 @@ void wlr_matrix_texture(float mat[static 16], int32_t width, int32_t height, mat[10] = 1.0f; mat[15] = 1.0f; } + +void wlr_matrix_box_model(float (*mat)[16], struct wlr_box *box, + enum wl_output_transform transform, float rotation) { + int x = box->x; + int y = box->y; + int width = box->width; + int height = box->height; + + float translate_center[16]; + wlr_matrix_translate(&translate_center, + (int)x + width / 2, (int)y + height / 2, 0); + + float rotate[16]; + wlr_matrix_rotate(&rotate, rotation); + + float translate_origin[16]; + wlr_matrix_translate(&translate_origin, -width / 2, + -height / 2, 0); + + float scale[16]; + wlr_matrix_scale(&scale, width, height, 1); + + wlr_matrix_mul(&translate_center, &rotate, mat); + wlr_matrix_mul(mat, &translate_origin, mat); + wlr_matrix_mul(mat, &scale, mat); + + if (transform != WL_OUTPUT_TRANSFORM_NORMAL) { + float surface_translate_center[16]; + wlr_matrix_translate(&surface_translate_center, 0.5, 0.5, 0); + + float surface_transform[16]; + wlr_matrix_transform(surface_transform, + wlr_output_transform_invert(transform)); + + float surface_translate_origin[16]; + wlr_matrix_translate(&surface_translate_origin, -0.5, -0.5, 0); + + wlr_matrix_mul(mat, &surface_translate_center, + mat); + wlr_matrix_mul(mat, &surface_transform, mat); + wlr_matrix_mul(mat, &surface_translate_origin, + mat); + } +} diff --git a/rootston/output.c b/rootston/output.c index 502e72d2..3680beac 100644 --- a/rootston/output.c +++ b/rootston/output.c @@ -52,9 +52,16 @@ static void render_surface(struct wlr_surface *surface, .width = render_width, .height = render_height, }; if (wlr_output_layout_intersects(desktop->layout, wlr_output, &render_box)) { + struct wlr_box model_box = { + .x = ox, + .y = oy, + .width = render_width, + .height = render_height, + }; float matrix[16]; - wlr_output_get_box_matrix(wlr_output, ox, oy, render_width, - render_height, surface->current->transform, rotation, &matrix); + wlr_matrix_box_model(&matrix, &model_box, surface->current->transform, + rotation); + wlr_matrix_mul(&wlr_output->transform_matrix, &matrix, &matrix); wlr_render_with_matrix(desktop->server->renderer, surface->texture, &matrix); @@ -157,11 +164,17 @@ static void render_decorations(struct roots_view *view, ox *= output->scale; oy *= output->scale; - float matrix[16]; - wlr_output_get_box_matrix(output, ox, oy, deco_box.width, - deco_box.height, WL_OUTPUT_TRANSFORM_NORMAL, view->rotation, - &matrix); + struct wlr_box model_box = { + .x = ox, + .y = oy, + .width = deco_box.width, + .height = deco_box.height, + }; + float matrix[16]; + wlr_matrix_box_model(&matrix, &model_box, WL_OUTPUT_TRANSFORM_NORMAL, + view->rotation); + wlr_matrix_mul(&output->transform_matrix, &matrix, &matrix); float color[4] = { 0.2, 0.2, 0.2, 1 }; wlr_render_colored_quad(desktop->server->renderer, &color, &matrix); } diff --git a/types/wlr_output.c b/types/wlr_output.c index 178306a8..b47fb3a0 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -751,46 +751,3 @@ enum wl_output_transform wlr_output_transform_compose( } return flipped | rotated; } - -void wlr_output_get_box_matrix(struct wlr_output *output, int ox, int oy, - int width, int height, enum wl_output_transform transform, - float rotation, float (*mat)[16]) { - float translate_center[16]; - wlr_matrix_translate(&translate_center, - (int)ox + width / 2, (int)oy + height / 2, 0); - - float rotate[16]; - wlr_matrix_rotate(&rotate, rotation); - - float translate_origin[16]; - wlr_matrix_translate(&translate_origin, -width / 2, - -height / 2, 0); - - float scale[16]; - wlr_matrix_scale(&scale, width, height, 1); - - float transform_matrix[16]; - wlr_matrix_mul(&translate_center, &rotate, &transform_matrix); - wlr_matrix_mul(&transform_matrix, &translate_origin, &transform_matrix); - wlr_matrix_mul(&transform_matrix, &scale, &transform_matrix); - - if (transform != WL_OUTPUT_TRANSFORM_NORMAL) { - float surface_translate_center[16]; - wlr_matrix_translate(&surface_translate_center, 0.5, 0.5, 0); - - float surface_transform[16]; - wlr_matrix_transform(surface_transform, - wlr_output_transform_invert(transform)); - - float surface_translate_origin[16]; - wlr_matrix_translate(&surface_translate_origin, -0.5, -0.5, 0); - - wlr_matrix_mul(&transform_matrix, &surface_translate_center, - &transform_matrix); - wlr_matrix_mul(&transform_matrix, &surface_transform, &transform_matrix); - wlr_matrix_mul(&transform_matrix, &surface_translate_origin, - &transform_matrix); - } - - wlr_matrix_mul(&output->transform_matrix, &transform_matrix, mat); -} -- cgit v1.2.3 From 85a6939cf2753fd6a7fa84c9fcd370a4fb1f4095 Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Sun, 21 Jan 2018 19:03:10 -0500 Subject: rename matrix model box to project box --- include/wlr/render/matrix.h | 5 +++-- render/matrix.c | 7 +++++-- rootston/output.c | 14 ++++++-------- 3 files changed, 14 insertions(+), 12 deletions(-) (limited to 'include/wlr') diff --git a/include/wlr/render/matrix.h b/include/wlr/render/matrix.h index dbd06c8d..a333bf0f 100644 --- a/include/wlr/render/matrix.h +++ b/include/wlr/render/matrix.h @@ -15,7 +15,8 @@ void wlr_matrix_transform(float mat[static 16], enum wl_output_transform transform); void wlr_matrix_texture(float mat[static 16], int32_t width, int32_t height, enum wl_output_transform transform); -void wlr_matrix_box_model(float (*mat)[16], struct wlr_box *box, - enum wl_output_transform transform, float rotation); +void wlr_matrix_project_box(float (*mat)[16], struct wlr_box *box, + enum wl_output_transform transform, float rotation, float + (*projection)[16]); #endif diff --git a/render/matrix.c b/render/matrix.c index a64a8f9b..9a1b2bb4 100644 --- a/render/matrix.c +++ b/render/matrix.c @@ -161,8 +161,9 @@ void wlr_matrix_texture(float mat[static 16], int32_t width, int32_t height, mat[15] = 1.0f; } -void wlr_matrix_box_model(float (*mat)[16], struct wlr_box *box, - enum wl_output_transform transform, float rotation) { +void wlr_matrix_project_box(float (*mat)[16], struct wlr_box *box, + enum wl_output_transform transform, float rotation, + float (*projection)[16]) { int x = box->x; int y = box->y; int width = box->width; @@ -203,4 +204,6 @@ void wlr_matrix_box_model(float (*mat)[16], struct wlr_box *box, wlr_matrix_mul(mat, &surface_translate_origin, mat); } + + wlr_matrix_mul(projection, mat, mat); } diff --git a/rootston/output.c b/rootston/output.c index 0e568a14..689956ad 100644 --- a/rootston/output.c +++ b/rootston/output.c @@ -52,16 +52,15 @@ static void render_surface(struct wlr_surface *surface, .width = render_width, .height = render_height, }; if (wlr_output_layout_intersects(desktop->layout, wlr_output, &render_box)) { - struct wlr_box model_box = { + struct wlr_box project_box = { .x = ox, .y = oy, .width = render_width, .height = render_height, }; float matrix[16]; - wlr_matrix_box_model(&matrix, &model_box, surface->current->transform, - rotation); - wlr_matrix_mul(&wlr_output->transform_matrix, &matrix, &matrix); + wlr_matrix_project_box(&matrix, &project_box, surface->current->transform, + rotation, &wlr_output->transform_matrix); wlr_render_with_matrix(desktop->server->renderer, surface->texture, &matrix); @@ -170,7 +169,7 @@ static void render_decorations(struct roots_view *view, ox *= output->scale; oy *= output->scale; - struct wlr_box model_box = { + struct wlr_box project_box = { .x = ox, .y = oy, .width = deco_box.width, @@ -178,9 +177,8 @@ static void render_decorations(struct roots_view *view, }; float matrix[16]; - wlr_matrix_box_model(&matrix, &model_box, WL_OUTPUT_TRANSFORM_NORMAL, - view->rotation); - wlr_matrix_mul(&output->transform_matrix, &matrix, &matrix); + wlr_matrix_project_box(&matrix, &project_box, WL_OUTPUT_TRANSFORM_NORMAL, + view->rotation, &output->transform_matrix); float color[4] = { 0.2, 0.2, 0.2, 1 }; wlr_render_colored_quad(desktop->server->renderer, &color, &matrix); } -- cgit v1.2.3 From 3cf7225cec637c90f4a676aa02dee9ad06dadee9 Mon Sep 17 00:00:00 2001 From: Markus Ongyerth Date: Tue, 23 Jan 2018 17:40:12 +0100 Subject: decouples outputenable state and wl_output global This decouples wlr_output_enable and the wl_global. The previously internal functions wlr_output_(destroy/create)_global are exposed and used automatically in the wlr_output_layout to create/tear down the global. The compositor can handle them itself if it wants to, but I think this is the right moment to create/destroy the wl_output when the wlr_output_layout is used. --- backend/drm/drm.c | 6 +++--- backend/headless/backend.c | 2 +- backend/headless/output.c | 2 +- backend/wayland/output.c | 2 +- backend/x11/backend.c | 2 +- include/wlr/types/wlr_output.h | 2 ++ types/wlr_output.c | 20 ++------------------ types/wlr_output_layout.c | 3 +++ 8 files changed, 14 insertions(+), 25 deletions(-) (limited to 'include/wlr') diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 47bd4e3a..fc2721f3 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -267,7 +267,7 @@ static void wlr_drm_connector_enable(struct wlr_output *output, bool enable) { wlr_drm_connector_start_renderer(conn); } - wlr_output_update_enabled(&conn->output, enable); + conn->output.enabled = enable; } static void realloc_planes(struct wlr_drm_backend *drm, const uint32_t *crtc_in, @@ -813,7 +813,7 @@ void wlr_drm_scan_connectors(struct wlr_drm_backend *drm) { wl_list_insert(&wlr_conn->output.modes, &mode->wlr_mode.link); } - wlr_output_update_enabled(&wlr_conn->output, true); + wlr_conn->output.enabled = true; wlr_conn->state = WLR_DRM_CONN_NEEDS_MODESET; wlr_log(L_INFO, "Sending modesetting signal for '%s'", @@ -823,7 +823,7 @@ void wlr_drm_scan_connectors(struct wlr_drm_backend *drm) { drm_conn->connection != DRM_MODE_CONNECTED) { wlr_log(L_INFO, "'%s' disconnected", wlr_conn->output.name); - wlr_output_update_enabled(&wlr_conn->output, false); + wlr_conn->output.enabled = false; wlr_drm_connector_cleanup(wlr_conn); } diff --git a/backend/headless/backend.c b/backend/headless/backend.c index cef8eec4..5438f1f4 100644 --- a/backend/headless/backend.c +++ b/backend/headless/backend.c @@ -15,7 +15,7 @@ static bool backend_start(struct wlr_backend *wlr_backend) { struct wlr_headless_output *output; wl_list_for_each(output, &backend->outputs, link) { wl_event_source_timer_update(output->frame_timer, output->frame_delay); - wlr_output_update_enabled(&output->wlr_output, true); + output->wlr_output.enabled = true; wl_signal_emit(&backend->backend.events.output_add, &output->wlr_output); } diff --git a/backend/headless/output.c b/backend/headless/output.c index 9fc92e88..b89d4106 100644 --- a/backend/headless/output.c +++ b/backend/headless/output.c @@ -139,7 +139,7 @@ struct wlr_output *wlr_headless_add_output(struct wlr_backend *wlr_backend, if (backend->started) { wl_event_source_timer_update(output->frame_timer, output->frame_delay); - wlr_output_update_enabled(wlr_output, true); + wlr_output->enabled = true; wl_signal_emit(&backend->backend.events.output_add, wlr_output); } diff --git a/backend/wayland/output.c b/backend/wayland/output.c index 52791679..7a115264 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -326,7 +326,7 @@ struct wlr_output *wlr_wl_output_create(struct wlr_backend *_backend) { } wl_list_insert(&backend->outputs, &output->link); - wlr_output_update_enabled(wlr_output, true); + wlr_output->enabled = true; wl_signal_emit(&backend->backend.events.output_add, wlr_output); return wlr_output; diff --git a/backend/x11/backend.c b/backend/x11/backend.c index e1622d06..2ee23b4f 100644 --- a/backend/x11/backend.c +++ b/backend/x11/backend.c @@ -226,7 +226,7 @@ static bool wlr_x11_backend_start(struct wlr_backend *backend) { xcb_map_window(x11->xcb_conn, output->win); xcb_flush(x11->xcb_conn); - wlr_output_update_enabled(&output->wlr_output, true); + output->wlr_output.enabled = true; wl_signal_emit(&x11->backend.events.output_add, output); wl_signal_emit(&x11->backend.events.input_add, &x11->keyboard_dev); diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index 71463cb5..1f0fc1ec 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -89,6 +89,8 @@ struct wlr_output { struct wlr_surface; void wlr_output_enable(struct wlr_output *output, bool enable); +void wlr_output_create_global(); +void wlr_output_destroy_global(); bool wlr_output_set_mode(struct wlr_output *output, struct wlr_output_mode *mode); bool wlr_output_set_custom_mode(struct wlr_output *output, int32_t width, diff --git a/types/wlr_output.c b/types/wlr_output.c index b47fb3a0..52ac3d22 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -113,7 +113,7 @@ static void wl_output_bind(struct wl_client *wl_client, void *data, wl_output_send_to_resource(wl_resource); } -static void wlr_output_create_global(struct wlr_output *output) { +void wlr_output_create_global(struct wlr_output *output) { if (output->wl_global != NULL) { return; } @@ -122,7 +122,7 @@ static void wlr_output_create_global(struct wlr_output *output) { output->wl_global = wl_global; } -static void wlr_output_destroy_global(struct wlr_output *output) { +void wlr_output_destroy_global(struct wlr_output *output) { if (output->wl_global == NULL) { return; } @@ -134,22 +134,6 @@ static void wlr_output_destroy_global(struct wlr_output *output) { output->wl_global = NULL; } -void wlr_output_update_enabled(struct wlr_output *output, bool enabled) { - if (output->enabled == enabled) { - return; - } - - output->enabled = enabled; - - if (enabled) { - wlr_output_create_global(output); - } else { - wlr_output_destroy_global(output); - } - - wl_signal_emit(&output->events.enable, output); -} - static void wlr_output_update_matrix(struct wlr_output *output) { wlr_matrix_texture(output->transform_matrix, output->width, output->height, output->transform); diff --git a/types/wlr_output_layout.c b/types/wlr_output_layout.c index d1d67e7d..b01fb840 100644 --- a/types/wlr_output_layout.c +++ b/types/wlr_output_layout.c @@ -203,6 +203,7 @@ void wlr_output_layout_add(struct wlr_output_layout *layout, l_output->y = y; l_output->state->auto_configured = false; wlr_output_layout_reconfigure(layout); + wlr_output_create_global(output); wl_signal_emit(&layout->events.add, l_output); } @@ -289,6 +290,7 @@ void wlr_output_layout_remove(struct wlr_output_layout *layout, wlr_output_layout_output_destroy(l_output); wlr_output_layout_reconfigure(layout); } + wlr_output_destroy_global(output); } void wlr_output_layout_output_coords(struct wlr_output_layout *layout, @@ -394,6 +396,7 @@ void wlr_output_layout_add_auto(struct wlr_output_layout *layout, l_output->state->auto_configured = true; wlr_output_layout_reconfigure(layout); + wlr_output_create_global(output); wl_signal_emit(&layout->events.add, l_output); } -- cgit v1.2.3 From f946c10cb171644e915deeaa40b5e8f8344a808c Mon Sep 17 00:00:00 2001 From: Markus Ongyerth Date: Wed, 24 Jan 2018 10:23:48 +0100 Subject: re-adds wlr_output_update_enabled Re-add the wlr_output_update_enabled to make sure wlr_output::events.enable is called when the output enabled state changes. --- backend/drm/drm.c | 6 +++--- backend/headless/backend.c | 2 +- backend/headless/output.c | 2 +- backend/wayland/output.c | 2 +- backend/x11/backend.c | 2 +- include/wlr/types/wlr_output.h | 4 ++-- types/wlr_output.c | 9 +++++++++ 7 files changed, 18 insertions(+), 9 deletions(-) (limited to 'include/wlr') diff --git a/backend/drm/drm.c b/backend/drm/drm.c index fc2721f3..47bd4e3a 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -267,7 +267,7 @@ static void wlr_drm_connector_enable(struct wlr_output *output, bool enable) { wlr_drm_connector_start_renderer(conn); } - conn->output.enabled = enable; + wlr_output_update_enabled(&conn->output, enable); } static void realloc_planes(struct wlr_drm_backend *drm, const uint32_t *crtc_in, @@ -813,7 +813,7 @@ void wlr_drm_scan_connectors(struct wlr_drm_backend *drm) { wl_list_insert(&wlr_conn->output.modes, &mode->wlr_mode.link); } - wlr_conn->output.enabled = true; + wlr_output_update_enabled(&wlr_conn->output, true); wlr_conn->state = WLR_DRM_CONN_NEEDS_MODESET; wlr_log(L_INFO, "Sending modesetting signal for '%s'", @@ -823,7 +823,7 @@ void wlr_drm_scan_connectors(struct wlr_drm_backend *drm) { drm_conn->connection != DRM_MODE_CONNECTED) { wlr_log(L_INFO, "'%s' disconnected", wlr_conn->output.name); - wlr_conn->output.enabled = false; + wlr_output_update_enabled(&wlr_conn->output, false); wlr_drm_connector_cleanup(wlr_conn); } diff --git a/backend/headless/backend.c b/backend/headless/backend.c index 5438f1f4..cef8eec4 100644 --- a/backend/headless/backend.c +++ b/backend/headless/backend.c @@ -15,7 +15,7 @@ static bool backend_start(struct wlr_backend *wlr_backend) { struct wlr_headless_output *output; wl_list_for_each(output, &backend->outputs, link) { wl_event_source_timer_update(output->frame_timer, output->frame_delay); - output->wlr_output.enabled = true; + wlr_output_update_enabled(&output->wlr_output, true); wl_signal_emit(&backend->backend.events.output_add, &output->wlr_output); } diff --git a/backend/headless/output.c b/backend/headless/output.c index b89d4106..9fc92e88 100644 --- a/backend/headless/output.c +++ b/backend/headless/output.c @@ -139,7 +139,7 @@ struct wlr_output *wlr_headless_add_output(struct wlr_backend *wlr_backend, if (backend->started) { wl_event_source_timer_update(output->frame_timer, output->frame_delay); - wlr_output->enabled = true; + wlr_output_update_enabled(wlr_output, true); wl_signal_emit(&backend->backend.events.output_add, wlr_output); } diff --git a/backend/wayland/output.c b/backend/wayland/output.c index 7a115264..52791679 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -326,7 +326,7 @@ struct wlr_output *wlr_wl_output_create(struct wlr_backend *_backend) { } wl_list_insert(&backend->outputs, &output->link); - wlr_output->enabled = true; + wlr_output_update_enabled(wlr_output, true); wl_signal_emit(&backend->backend.events.output_add, wlr_output); return wlr_output; diff --git a/backend/x11/backend.c b/backend/x11/backend.c index 2ee23b4f..e1622d06 100644 --- a/backend/x11/backend.c +++ b/backend/x11/backend.c @@ -226,7 +226,7 @@ static bool wlr_x11_backend_start(struct wlr_backend *backend) { xcb_map_window(x11->xcb_conn, output->win); xcb_flush(x11->xcb_conn); - output->wlr_output.enabled = true; + wlr_output_update_enabled(&output->wlr_output, true); wl_signal_emit(&x11->backend.events.output_add, output); wl_signal_emit(&x11->backend.events.input_add, &x11->keyboard_dev); diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index 1f0fc1ec..55431ab1 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -89,8 +89,8 @@ struct wlr_output { struct wlr_surface; void wlr_output_enable(struct wlr_output *output, bool enable); -void wlr_output_create_global(); -void wlr_output_destroy_global(); +void wlr_output_create_global(struct wlr_output *output); +void wlr_output_destroy_global(struct wlr_output *output); bool wlr_output_set_mode(struct wlr_output *output, struct wlr_output_mode *mode); bool wlr_output_set_custom_mode(struct wlr_output *output, int32_t width, diff --git a/types/wlr_output.c b/types/wlr_output.c index 52ac3d22..426926ac 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -134,6 +134,15 @@ void wlr_output_destroy_global(struct wlr_output *output) { output->wl_global = NULL; } +void wlr_output_update_enabled(struct wlr_output *output, bool enabled) { + if (output->enabled == enabled) { + return; + } + + output->enabled = enabled; + wl_signal_emit(&output->events.enable, output); +} + static void wlr_output_update_matrix(struct wlr_output *output) { wlr_matrix_texture(output->transform_matrix, output->width, output->height, output->transform); -- cgit v1.2.3