Skip to content

Commit

Permalink
Merge branch 'master' into bindsym-tocode-dup-children
Browse files Browse the repository at this point in the history
  • Loading branch information
sahinf authored Oct 3, 2024
2 parents db0c5b7 + c90cb37 commit 55bea8e
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 7 deletions.
1 change: 1 addition & 0 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ archive=$prefix.tar.gz
git archive --prefix="$prefix/" -o "$archive" "$next"
gpg --output "$archive".sig --detach-sig "$archive"

git push --follow-tags
gh release create "sway $next" -t "$next" -n "" -d "$archive" "$archive.sig"
10 changes: 10 additions & 0 deletions sway/desktop/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <wlr/render/swapchain.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_buffer.h>
#include <wlr/types/wlr_alpha_modifier_v1.h>
#include <wlr/types/wlr_gamma_control_v1.h>
#include <wlr/types/wlr_matrix.h>
#include <wlr/types/wlr_output_layout.h>
Expand Down Expand Up @@ -216,6 +217,15 @@ static void output_configure_scene(struct sway_output *output,

if (node->type == WLR_SCENE_NODE_BUFFER) {
struct wlr_scene_buffer *buffer = wlr_scene_buffer_from_node(node);
struct wlr_scene_surface *surface = wlr_scene_surface_try_from_buffer(buffer);

if (surface) {
const struct wlr_alpha_modifier_surface_v1_state *alpha_modifier_state =
wlr_alpha_modifier_v1_get_surface_state(surface->surface);
if (alpha_modifier_state != NULL) {
opacity *= (float)alpha_modifier_state->multiplier;
}
}

// hack: don't call the scene setter because that will damage all outputs
// We don't want to damage outputs that aren't our current output that
Expand Down
6 changes: 4 additions & 2 deletions sway/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <wlr/config.h>
#include <wlr/render/allocator.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_alpha_modifier_v1.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_content_type_v1.h>
#include <wlr/types/wlr_cursor_shape_v1.h>
Expand Down Expand Up @@ -204,8 +205,8 @@ static void handle_renderer_lost(struct wl_listener *listener, void *data) {

wlr_compositor_set_renderer(server->compositor, renderer);

for (int i = 0; i < root->outputs->length; ++i) {
struct sway_output *output = root->outputs->items[i];
struct sway_output *output;
wl_list_for_each(output, &root->all_outputs, link) {
wlr_output_init_render(output->wlr_output,
server->allocator, server->renderer);
}
Expand Down Expand Up @@ -326,6 +327,7 @@ bool server_init(struct sway_server *server) {
&server->pointer_constraint);

wlr_presentation_create(server->wl_display, server->backend);
wlr_alpha_modifier_v1_create(server->wl_display);

server->output_manager_v1 =
wlr_output_manager_v1_create(server->wl_display);
Expand Down
2 changes: 1 addition & 1 deletion swaybar/bar.c
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ void bar_run(struct swaybar *bar) {
}
#if HAVE_TRAY
if (bar->tray) {
loop_add_fd(bar->eventloop, bar->tray->fd, POLLIN, tray_in, bar->tray->bus);
loop_add_fd(bar->eventloop, bar->tray->fd, POLLIN, tray_in, bar);
}
#endif
while (bar->running) {
Expand Down
3 changes: 1 addition & 2 deletions swaybar/ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,7 @@ static bool handle_barconfig_update(struct swaybar *bar, const char *payload,
#if HAVE_TRAY
if (oldcfg->tray_hidden && !newcfg->tray_hidden) {
bar->tray = create_tray(bar);
loop_add_fd(bar->eventloop, bar->tray->fd, POLLIN, tray_in,
bar->tray->bus);
loop_add_fd(bar->eventloop, bar->tray->fd, POLLIN, tray_in, bar);
} else if (bar->tray && newcfg->tray_hidden) {
loop_remove_fd(bar->eventloop, bar->tray->fd);
destroy_tray(bar->tray);
Expand Down
12 changes: 10 additions & 2 deletions swaybar/tray/tray.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <cairo.h>
#include <poll.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -90,9 +91,16 @@ void destroy_tray(struct swaybar_tray *tray) {
}

void tray_in(int fd, short mask, void *data) {
sd_bus *bus = data;
struct swaybar *bar = data;
int ret;
while ((ret = sd_bus_process(bus, NULL)) > 0) {

if (mask & (POLLHUP | POLLERR)) {
sway_log(SWAY_ERROR, "D-Bus connection closed unexpectedly");
bar->running = false;
return;
}

while ((ret = sd_bus_process(bar->tray->bus, NULL)) > 0) {
// This space intentionally left blank
}
if (ret < 0) {
Expand Down

0 comments on commit 55bea8e

Please sign in to comment.