Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backend: name default backend operation implementations consistently #1107

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/backend/backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/backend/backend_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 2 additions & 10 deletions src/backend/backend_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,8 @@ 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_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 *
Expand Down
2 changes: 1 addition & 1 deletion src/backend/dummy/dummy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 1 addition & 3 deletions src/backend/xrender/xrender.c
Original file line number Diff line number Diff line change
Expand Up @@ -981,10 +981,8 @@ 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,
.is_image_transparent = default_is_image_transparent,
.buffer_age = buffer_age,
.max_buffer_age = 2,
Expand Down