Sway 1.10.1 Rebase (#382)

This commit is contained in:
Erik Reider 2025-02-17 16:45:01 +01:00 committed by GitHub
parent 03a0796973
commit 50d4cf45ab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 24 additions and 13 deletions

View file

@ -11,7 +11,7 @@ project(
],
)
original_version = '1.10.0'
original_version = '1.10.1'
add_project_arguments(
[

View file

@ -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>
@ -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;
@ -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;
}
@ -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);
}

View file

@ -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;

View file

@ -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.

View file

@ -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) {
@ -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);
@ -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);
@ -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);
@ -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);
@ -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);

View file

@ -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);
}
}