diff options
-rw-r--r-- | sway/input/cursor.c | 14 | ||||
-rw-r--r-- | swaybar/tray/item.c | 6 | ||||
-rw-r--r-- | swaybar/tray/watcher.c | 31 |
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) { | |||
425 | dx, dy, dx_unaccel, dy_unaccel); | 425 | dx, dy, dx_unaccel, dy_unaccel); |
426 | 426 | ||
427 | struct wlr_surface *surface = NULL; | 427 | struct wlr_surface *surface = NULL; |
428 | struct sway_node *node = NULL; | ||
428 | double sx, sy; | 429 | double sx, sy; |
429 | struct sway_node *node = node_at_coords(cursor->seat, | ||
430 | cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); | ||
431 | |||
432 | if (cursor->active_constraint) { | 430 | if (cursor->active_constraint) { |
431 | node = node_at_coords(cursor->seat, | ||
432 | cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); | ||
433 | |||
433 | if (cursor->active_constraint->surface != surface) { | 434 | if (cursor->active_constraint->surface != surface) { |
434 | return; | 435 | return; |
435 | } | 436 | } |
@@ -445,8 +446,13 @@ static void handle_cursor_motion(struct wl_listener *listener, void *data) { | |||
445 | } | 446 | } |
446 | 447 | ||
447 | wlr_cursor_move(cursor->cursor, event->device, dx, dy); | 448 | wlr_cursor_move(cursor->cursor, event->device, dx, dy); |
449 | |||
450 | // Recalculate pointer location after layout checks | ||
451 | node = node_at_coords(cursor->seat, | ||
452 | cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); | ||
453 | |||
448 | cursor_send_pointer_motion(cursor, event->time_msec, node, surface, | 454 | cursor_send_pointer_motion(cursor, event->time_msec, node, surface, |
449 | sx + dx, sy + dy); | 455 | sx, sy); |
450 | transaction_commit_dirty(); | 456 | transaction_commit_dirty(); |
451 | } | 457 | } |
452 | 458 | ||
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) { | |||
299 | return; | 299 | return; |
300 | } | 300 | } |
301 | 301 | ||
302 | cairo_surface_destroy(sni->icon); | ||
303 | |||
302 | sd_bus_slot_unref(sni->new_icon_slot); | 304 | sd_bus_slot_unref(sni->new_icon_slot); |
303 | sd_bus_slot_unref(sni->new_attention_icon_slot); | 305 | sd_bus_slot_unref(sni->new_attention_icon_slot); |
304 | sd_bus_slot_unref(sni->new_status_slot); | 306 | sd_bus_slot_unref(sni->new_status_slot); |
@@ -308,9 +310,11 @@ void destroy_sni(struct swaybar_sni *sni) { | |||
308 | free(sni->path); | 310 | free(sni->path); |
309 | free(sni->status); | 311 | free(sni->status); |
310 | free(sni->icon_name); | 312 | free(sni->icon_name); |
311 | free(sni->icon_pixmap); | 313 | list_free_items_and_destroy(sni->icon_pixmap); |
312 | free(sni->attention_icon_name); | 314 | free(sni->attention_icon_name); |
315 | list_free_items_and_destroy(sni->attention_icon_pixmap); | ||
313 | free(sni->menu); | 316 | free(sni->menu); |
317 | free(sni->icon_theme_path); | ||
314 | free(sni); | 318 | free(sni); |
315 | } | 319 | } |
316 | 320 | ||
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) { | |||
18 | return strcmp(item, cmp_to); | 18 | return strcmp(item, cmp_to); |
19 | } | 19 | } |
20 | 20 | ||
21 | static int cmp_service(const void *item, const void *cmp_to) { | ||
22 | return strncmp(item, cmp_to, strlen(cmp_to)); | ||
23 | } | ||
24 | |||
25 | static int handle_lost_service(sd_bus_message *msg, | 21 | static int handle_lost_service(sd_bus_message *msg, |
26 | void *data, sd_bus_error *error) { | 22 | void *data, sd_bus_error *error) { |
27 | char *service, *old_owner, *new_owner; | 23 | char *service, *old_owner, *new_owner; |
@@ -33,18 +29,23 @@ static int handle_lost_service(sd_bus_message *msg, | |||
33 | 29 | ||
34 | if (!*new_owner) { | 30 | if (!*new_owner) { |
35 | struct swaybar_watcher *watcher = data; | 31 | struct swaybar_watcher *watcher = data; |
36 | int idx = list_seq_find(watcher->items, | 32 | for (int idx = 0; idx < watcher->items->length; ++idx) { |
37 | using_standard_protocol(watcher) ? cmp_id : cmp_service, service); | ||
38 | if (idx != -1) { | ||
39 | char *id = watcher->items->items[idx]; | 33 | char *id = watcher->items->items[idx]; |
40 | sway_log(SWAY_DEBUG, "Unregistering Status Notifier Item '%s'", id); | 34 | int cmp_res = using_standard_protocol(watcher) ? |
41 | list_del(watcher->items, idx); | 35 | cmp_id(id, service) : strncmp(id, service, strlen(service)); |
42 | sd_bus_emit_signal(watcher->bus, obj_path, watcher->interface, | 36 | if (cmp_res == 0) { |
43 | "StatusNotifierItemUnregistered", "s", id); | 37 | sway_log(SWAY_DEBUG, "Unregistering Status Notifier Item '%s'", id); |
44 | free(id); | 38 | list_del(watcher->items, idx--); |
39 | sd_bus_emit_signal(watcher->bus, obj_path, watcher->interface, | ||
40 | "StatusNotifierItemUnregistered", "s", id); | ||
41 | free(id); | ||
42 | if (using_standard_protocol(watcher)) { | ||
43 | break; | ||
44 | } | ||
45 | } | ||
45 | } | 46 | } |
46 | 47 | ||
47 | idx = list_seq_find(watcher->hosts, cmp_id, service); | 48 | int idx = list_seq_find(watcher->hosts, cmp_id, service); |
48 | if (idx != -1) { | 49 | if (idx != -1) { |
49 | sway_log(SWAY_DEBUG, "Unregistering Status Notifier Host '%s'", service); | 50 | sway_log(SWAY_DEBUG, "Unregistering Status Notifier Host '%s'", service); |
50 | free(watcher->hosts->items[idx]); | 51 | free(watcher->hosts->items[idx]); |
@@ -185,8 +186,8 @@ struct swaybar_watcher *create_watcher(char *protocol, sd_bus *bus) { | |||
185 | goto error; | 186 | goto error; |
186 | } | 187 | } |
187 | 188 | ||
188 | sd_bus_slot_set_floating(signal_slot, 1); | 189 | sd_bus_slot_set_floating(signal_slot, 0); |
189 | sd_bus_slot_set_floating(vtable_slot, 1); | 190 | sd_bus_slot_set_floating(vtable_slot, 0); |
190 | 191 | ||
191 | watcher->bus = bus; | 192 | watcher->bus = bus; |
192 | watcher->hosts = create_list(); | 193 | watcher->hosts = create_list(); |