aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sway/input/cursor.c14
-rw-r--r--swaybar/tray/item.c6
-rw-r--r--swaybar/tray/watcher.c31
3 files changed, 31 insertions, 20 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index 5ede6e74..170532be 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -425,11 +425,12 @@ static void handle_cursor_motion(struct wl_listener *listener, void *data) {
dx, dy, dx_unaccel, dy_unaccel);
struct wlr_surface *surface = NULL;
+ struct sway_node *node = NULL;
double sx, sy;
- struct sway_node *node = node_at_coords(cursor->seat,
- cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy);
-
if (cursor->active_constraint) {
+ node = node_at_coords(cursor->seat,
+ cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy);
+
if (cursor->active_constraint->surface != surface) {
return;
}
@@ -445,8 +446,13 @@ static void handle_cursor_motion(struct wl_listener *listener, void *data) {
}
wlr_cursor_move(cursor->cursor, event->device, dx, dy);
+
+ // Recalculate pointer location after layout checks
+ node = node_at_coords(cursor->seat,
+ cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy);
+
cursor_send_pointer_motion(cursor, event->time_msec, node, surface,
- sx + dx, sy + dy);
+ sx, sy);
transaction_commit_dirty();
}
diff --git a/swaybar/tray/item.c b/swaybar/tray/item.c
index 4262d687..4fa6c97b 100644
--- a/swaybar/tray/item.c
+++ b/swaybar/tray/item.c
@@ -299,6 +299,8 @@ void destroy_sni(struct swaybar_sni *sni) {
return;
}
+ cairo_surface_destroy(sni->icon);
+
sd_bus_slot_unref(sni->new_icon_slot);
sd_bus_slot_unref(sni->new_attention_icon_slot);
sd_bus_slot_unref(sni->new_status_slot);
@@ -308,9 +310,11 @@ void destroy_sni(struct swaybar_sni *sni) {
free(sni->path);
free(sni->status);
free(sni->icon_name);
- free(sni->icon_pixmap);
+ list_free_items_and_destroy(sni->icon_pixmap);
free(sni->attention_icon_name);
+ list_free_items_and_destroy(sni->attention_icon_pixmap);
free(sni->menu);
+ free(sni->icon_theme_path);
free(sni);
}
diff --git a/swaybar/tray/watcher.c b/swaybar/tray/watcher.c
index 38151071..951a0589 100644
--- a/swaybar/tray/watcher.c
+++ b/swaybar/tray/watcher.c
@@ -18,10 +18,6 @@ static int cmp_id(const void *item, const void *cmp_to) {
return strcmp(item, cmp_to);
}
-static int cmp_service(const void *item, const void *cmp_to) {
- return strncmp(item, cmp_to, strlen(cmp_to));
-}
-
static int handle_lost_service(sd_bus_message *msg,
void *data, sd_bus_error *error) {
char *service, *old_owner, *new_owner;
@@ -33,18 +29,23 @@ static int handle_lost_service(sd_bus_message *msg,
if (!*new_owner) {
struct swaybar_watcher *watcher = data;
- int idx = list_seq_find(watcher->items,
- using_standard_protocol(watcher) ? cmp_id : cmp_service, service);
- if (idx != -1) {
+ for (int idx = 0; idx < watcher->items->length; ++idx) {
char *id = watcher->items->items[idx];
- sway_log(SWAY_DEBUG, "Unregistering Status Notifier Item '%s'", id);
- list_del(watcher->items, idx);
- sd_bus_emit_signal(watcher->bus, obj_path, watcher->interface,
- "StatusNotifierItemUnregistered", "s", id);
- free(id);
+ int cmp_res = using_standard_protocol(watcher) ?
+ cmp_id(id, service) : strncmp(id, service, strlen(service));
+ if (cmp_res == 0) {
+ sway_log(SWAY_DEBUG, "Unregistering Status Notifier Item '%s'", id);
+ list_del(watcher->items, idx--);
+ sd_bus_emit_signal(watcher->bus, obj_path, watcher->interface,
+ "StatusNotifierItemUnregistered", "s", id);
+ free(id);
+ if (using_standard_protocol(watcher)) {
+ break;
+ }
+ }
}
- idx = list_seq_find(watcher->hosts, cmp_id, service);
+ int idx = list_seq_find(watcher->hosts, cmp_id, service);
if (idx != -1) {
sway_log(SWAY_DEBUG, "Unregistering Status Notifier Host '%s'", service);
free(watcher->hosts->items[idx]);
@@ -185,8 +186,8 @@ struct swaybar_watcher *create_watcher(char *protocol, sd_bus *bus) {
goto error;
}
- sd_bus_slot_set_floating(signal_slot, 1);
- sd_bus_slot_set_floating(vtable_slot, 1);
+ sd_bus_slot_set_floating(signal_slot, 0);
+ sd_bus_slot_set_floating(vtable_slot, 0);
watcher->bus = bus;
watcher->hosts = create_list();