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

Sway 1.10.1 Rebase #382

Merged
merged 2 commits into from
Feb 17, 2025
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
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ project(
],
)

original_version = '1.10.0'
original_version = '1.10.1'

add_project_arguments(
[
Expand Down
7 changes: 5 additions & 2 deletions sway/config/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <sys/wait.h>
#include <unistd.h>
#include <wlr/config.h>
#include <wlr/render/allocator.h>
#include <wlr/types/wlr_cursor.h>
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_output.h>
Expand Down Expand Up @@ -773,7 +774,7 @@ static bool search_render_format(struct search_context *ctx, size_t output_idx)
}

const struct wlr_drm_format_set *primary_formats =
wlr_output_get_primary_formats(wlr_output, WLR_BUFFER_CAP_DMABUF);
wlr_output_get_primary_formats(wlr_output, server.allocator->buffer_caps);
enum render_bit_depth needed_bits = RENDER_BIT_DEPTH_8;
if (cfg->config && cfg->config->render_bit_depth != RENDER_BIT_DEPTH_DEFAULT) {
needed_bits = cfg->config->render_bit_depth;
Expand All @@ -783,7 +784,8 @@ static bool search_render_format(struct search_context *ctx, size_t output_idx)
if (needed_bits < format_bits) {
continue;
}
if (!wlr_drm_format_set_get(primary_formats, fmts[idx])) {
// If primary_formats is NULL, all formats are supported
if (primary_formats && !wlr_drm_format_set_get(primary_formats, fmts[idx])) {
// This is not a supported format for this output
continue;
}
Expand Down Expand Up @@ -1016,6 +1018,7 @@ void free_output_config(struct output_config *oc) {
free(oc->name);
free(oc->background);
free(oc->background_option);
free(oc->background_fallback);
wlr_color_transform_unref(oc->color_transform);
free(oc);
}
Expand Down
1 change: 1 addition & 0 deletions sway/desktop/layer_shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ static void handle_node_destroy(struct wl_listener *listener, void *data) {
wl_list_remove(&layer->unmap.link);
wl_list_remove(&layer->surface_commit.link);
wl_list_remove(&layer->node_destroy.link);
wl_list_remove(&layer->new_popup.link);
wl_list_remove(&layer->output_destroy.link);

layer->layer_surface->data = NULL;
Expand Down
6 changes: 3 additions & 3 deletions sway/sway.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ They are expected to be used with *bindsym* or at runtime through *swaymsg*(1).
*border* none|normal|csd|pixel [<n>]
Set border style for focused window. _normal_ includes a border of
thickness _n_ and a title bar. _pixel_ is a border without title bar _n_
pixels thick. Default is _normal_ with border thickness 2. _csd_ is short
for client-side-decorations, which allows the client to draw its own
decorations.
pixels thick. The title bar always shows in stacking or tabbed layouts.
_csd_ is short for client-side-decorations, which allows the client to draw
its own decorations. Default is _normal_ with border thickness 2.

*border* toggle
Cycles through the available border styles.
Expand Down
17 changes: 11 additions & 6 deletions swaybar/render.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ struct render_context {
cairo_font_options_t *textaa_sharp;
cairo_font_options_t *textaa_safe;
uint32_t background_color;
bool has_transparency;
};

static void choose_text_aa_mode(struct render_context *ctx, uint32_t fontcolor) {
Expand Down Expand Up @@ -265,6 +266,7 @@ static uint32_t render_status_block(struct render_context *ctx,

uint32_t bg_color = block->urgent
? config->colors.urgent_workspace.background : block->background;
ctx->has_transparency |= (bg_color & 0xFF) != 0xFF;
if (bg_color) {
render_sharp_rectangle(cairo, bg_color, x_pos, y_pos,
block_width, render_height);
Expand Down Expand Up @@ -574,6 +576,7 @@ static uint32_t render_binding_mode_indicator(struct render_context *ctx,
cairo_set_operator(cairo, CAIRO_OPERATOR_SOURCE);
cairo_set_source_u32(cairo, config->colors.binding_mode.background);
ctx->background_color = config->colors.binding_mode.background;
ctx->has_transparency |= (config->colors.binding_mode.background & 0xFF) != 0xFF;
cairo_rectangle(cairo, x, 0, width, height);
cairo_fill(cairo);

Expand Down Expand Up @@ -653,6 +656,7 @@ static uint32_t render_workspace_button(struct render_context *ctx,
cairo_set_operator(cairo, CAIRO_OPERATOR_SOURCE);
cairo_set_source_u32(cairo, box_colors.background);
ctx->background_color = box_colors.background;
ctx->has_transparency |= (box_colors.background & 0xFF) != 0xFF;
cairo_rectangle(cairo, *x, 0, width, height);
cairo_fill(cairo);

Expand Down Expand Up @@ -760,10 +764,12 @@ void render_frame(struct swaybar_output *output) {
background_color = output->bar->config->colors.background;
}

struct render_context ctx = { 0 };
ctx.output = output;
// initial background color used for deciding the best way to antialias text
ctx.background_color = background_color;
struct render_context ctx = {
.output = output,
// initial background color used for deciding the best way to antialias text
.background_color = background_color,
.has_transparency = (background_color & 0xFF) != 0xFF,
};

cairo_surface_t *recorder = cairo_recording_surface_create(
CAIRO_CONTENT_COLOR_ALPHA, NULL);
Expand Down Expand Up @@ -834,8 +840,7 @@ void render_frame(struct swaybar_output *output) {
wl_surface_damage(output->surface, 0, 0,
output->width, output->height);

uint32_t bg_alpha = background_color & 0xFF;
if (bg_alpha == 0xFF) {
if (!ctx.has_transparency) {
struct wl_region *region =
wl_compositor_create_region(output->bar->compositor);
wl_region_add(region, 0, 0, INT32_MAX, INT32_MAX);
Expand Down
4 changes: 3 additions & 1 deletion swaynag/swaynag.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,9 @@ static void output_scale(void *data, struct wl_output *output,
swaynag_output->scale = factor;
if (swaynag_output->swaynag->output == swaynag_output) {
swaynag_output->swaynag->scale = swaynag_output->scale;
update_all_cursors(swaynag_output->swaynag);
if (!swaynag_output->swaynag->cursor_shape_manager) {
update_all_cursors(swaynag_output->swaynag);
}
render_frame(swaynag_output->swaynag);
}
}
Expand Down