From 8bf82857c4542877b4e2fa36761acb70f6fa2e2d Mon Sep 17 00:00:00 2001 From: Maxim Solovyov Date: Thu, 3 Aug 2023 01:38:34 +0300 Subject: [PATCH 1/3] backend: name default backend operation implementations consistently --- src/backend/backend.h | 6 +++--- src/backend/backend_common.c | 4 ++-- src/backend/backend_common.h | 4 ++-- src/backend/dummy/dummy.c | 2 +- src/backend/xrender/xrender.c | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/backend/backend.h b/src/backend/backend.h index 3ed7a761a8..6a05a55090 100644 --- a/src/backend/backend.h +++ b/src/backend/backend.h @@ -215,18 +215,18 @@ struct backend_operations { struct xvisual_info fmt, bool owned); /// Create a shadow context for rendering shadows with radius `radius`. - /// Default implementation: default_backend_create_shadow_context + /// Default implementation: default_create_shadow_context struct backend_shadow_context *(*create_shadow_context)(backend_t *backend_data, double radius); /// Destroy a shadow context - /// Default implementation: default_backend_destroy_shadow_context + /// Default implementation: default_destroy_shadow_context void (*destroy_shadow_context)(backend_t *backend_data, struct backend_shadow_context *ctx); /// Create a shadow image based on the parameters. Resulting image should have a /// size of `width + radisu * 2` x `height + radius * 2`. Radius is set when the /// shadow context is created. - /// Default implementation: default_backend_render_shadow + /// Default implementation: default_render_shadow /// /// Required. void *(*render_shadow)(backend_t *backend_data, int width, int height, diff --git a/src/backend/backend_common.c b/src/backend/backend_common.c index 3388b78516..eef214593b 100644 --- a/src/backend/backend_common.c +++ b/src/backend/backend_common.c @@ -293,8 +293,8 @@ bool build_shadow(struct x_connection *c, double opacity, const int width, return false; } -void *default_backend_render_shadow(backend_t *backend_data, int width, int height, - struct backend_shadow_context *sctx, struct color color) { +void *default_render_shadow(backend_t *backend_data, int width, int height, + struct backend_shadow_context *sctx, struct color color) { const conv *kernel = (void *)sctx; xcb_render_picture_t shadow_pixel = solid_picture(backend_data->c, true, 1, color.red, color.green, color.blue); diff --git a/src/backend/backend_common.h b/src/backend/backend_common.h index 2e49cecf71..a58d816c0a 100644 --- a/src/backend/backend_common.h +++ b/src/backend/backend_common.h @@ -62,8 +62,8 @@ bool default_is_win_transparent(void *, win *, void *); /// caveat as `default_is_win_transparent` applies. bool default_is_frame_transparent(void *, win *, void *); -void *default_backend_render_shadow(backend_t *backend_data, int width, int height, - struct backend_shadow_context *sctx, struct color color); +void *default_render_shadow(backend_t *backend_data, int width, int height, + struct backend_shadow_context *sctx, struct color color); /// Implement `render_shadow` with `shadow_from_mask`. void * diff --git a/src/backend/dummy/dummy.c b/src/backend/dummy/dummy.c index 4e3d713873..19e88ddc85 100644 --- a/src/backend/dummy/dummy.c +++ b/src/backend/dummy/dummy.c @@ -184,7 +184,7 @@ struct backend_operations dummy_ops = { .bind_pixmap = dummy_bind_pixmap, .create_shadow_context = default_create_shadow_context, .destroy_shadow_context = default_destroy_shadow_context, - .render_shadow = default_backend_render_shadow, + .render_shadow = default_render_shadow, .make_mask = dummy_make_mask, .release_image = dummy_release_image, .is_image_transparent = dummy_is_image_transparent, diff --git a/src/backend/xrender/xrender.c b/src/backend/xrender/xrender.c index c359fc4efa..5c7d786ef4 100644 --- a/src/backend/xrender/xrender.c +++ b/src/backend/xrender/xrender.c @@ -981,7 +981,7 @@ struct backend_operations xrender_ops = { .release_image = release_image, .create_shadow_context = default_create_shadow_context, .destroy_shadow_context = default_destroy_shadow_context, - .render_shadow = default_backend_render_shadow, + .render_shadow = default_render_shadow, .make_mask = make_mask, //.prepare_win = prepare_win, //.release_win = release_win, From bd3134efd982397a3c51a48a7d7f13e25b87c41d Mon Sep 17 00:00:00 2001 From: Maxim Solovyov Date: Thu, 3 Aug 2023 01:42:00 +0300 Subject: [PATCH 2/3] backend: xrender: remove obsolete commented out backend operations --- src/backend/xrender/xrender.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/backend/xrender/xrender.c b/src/backend/xrender/xrender.c index 5c7d786ef4..f7ef8616c1 100644 --- a/src/backend/xrender/xrender.c +++ b/src/backend/xrender/xrender.c @@ -983,8 +983,6 @@ struct backend_operations xrender_ops = { .destroy_shadow_context = default_destroy_shadow_context, .render_shadow = default_render_shadow, .make_mask = make_mask, - //.prepare_win = prepare_win, - //.release_win = release_win, .is_image_transparent = default_is_image_transparent, .buffer_age = buffer_age, .max_buffer_age = 2, From 44800ed845fad3fb0638891764a3b17084c96c3a Mon Sep 17 00:00:00 2001 From: Maxim Solovyov Date: Thu, 3 Aug 2023 01:44:54 +0300 Subject: [PATCH 3/3] backend: remove default implementations of obsolete backend operations --- src/backend/backend_common.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/backend/backend_common.h b/src/backend/backend_common.h index a58d816c0a..da9ccd0235 100644 --- a/src/backend/backend_common.h +++ b/src/backend/backend_common.h @@ -54,14 +54,6 @@ solid_picture(struct x_connection *, bool argb, double a, double r, double g, do xcb_image_t *make_shadow(struct x_connection *c, const conv *kernel, double opacity, int width, int height); -/// The default implementation of `is_win_transparent`, it simply looks at win::mode. So -/// this is not suitable for backends that alter the content of windows -bool default_is_win_transparent(void *, win *, void *); - -/// The default implementation of `is_frame_transparent`, it uses win::frame_opacity. Same -/// caveat as `default_is_win_transparent` applies. -bool default_is_frame_transparent(void *, win *, void *); - void *default_render_shadow(backend_t *backend_data, int width, int height, struct backend_shadow_context *sctx, struct color color);