diff options
Diffstat (limited to 'swaybar/tray')
-rw-r--r-- | swaybar/tray/host.c | 30 | ||||
-rw-r--r-- | swaybar/tray/icon.c | 2 | ||||
-rw-r--r-- | swaybar/tray/item.c | 40 | ||||
-rw-r--r-- | swaybar/tray/tray.c | 10 | ||||
-rw-r--r-- | swaybar/tray/watcher.c | 26 |
5 files changed, 54 insertions, 54 deletions
diff --git a/swaybar/tray/host.c b/swaybar/tray/host.c index cc8dd188..215e1e72 100644 --- a/swaybar/tray/host.c +++ b/swaybar/tray/host.c @@ -21,7 +21,7 @@ static int cmp_sni_id(const void *item, const void *cmp_to) { static void add_sni(struct swaybar_tray *tray, char *id) { int idx = list_seq_find(tray->items, cmp_sni_id, id); if (idx == -1) { - wlr_log(WLR_INFO, "Registering Status Notifier Item '%s'", id); + sway_log(SWAY_INFO, "Registering Status Notifier Item '%s'", id); struct swaybar_sni *sni = create_sni(id, tray); if (sni) { list_add(tray->items, sni); @@ -34,7 +34,7 @@ static int handle_sni_registered(sd_bus_message *msg, void *data, char *id; int ret = sd_bus_message_read(msg, "s", &id); if (ret < 0) { - wlr_log(WLR_ERROR, "Failed to parse register SNI message: %s", strerror(-ret)); + sway_log(SWAY_ERROR, "Failed to parse register SNI message: %s", strerror(-ret)); } struct swaybar_tray *tray = data; @@ -48,13 +48,13 @@ static int handle_sni_unregistered(sd_bus_message *msg, void *data, char *id; int ret = sd_bus_message_read(msg, "s", &id); if (ret < 0) { - wlr_log(WLR_ERROR, "Failed to parse unregister SNI message: %s", strerror(-ret)); + sway_log(SWAY_ERROR, "Failed to parse unregister SNI message: %s", strerror(-ret)); } struct swaybar_tray *tray = data; int idx = list_seq_find(tray->items, cmp_sni_id, id); if (idx != -1) { - wlr_log(WLR_INFO, "Unregistering Status Notifier Item '%s'", id); + sway_log(SWAY_INFO, "Unregistering Status Notifier Item '%s'", id); destroy_sni(tray->items->items[idx]); list_del(tray->items, idx); set_bar_dirty(tray->bar); @@ -66,20 +66,20 @@ static int get_registered_snis_callback(sd_bus_message *msg, void *data, sd_bus_error *error) { if (sd_bus_message_is_method_error(msg, NULL)) { sd_bus_error err = *sd_bus_message_get_error(msg); - wlr_log(WLR_ERROR, "Failed to get registered SNIs: %s", err.message); + sway_log(SWAY_ERROR, "Failed to get registered SNIs: %s", err.message); return -sd_bus_error_get_errno(&err); } int ret = sd_bus_message_enter_container(msg, 'v', NULL); if (ret < 0) { - wlr_log(WLR_ERROR, "Failed to read registered SNIs: %s", strerror(-ret)); + sway_log(SWAY_ERROR, "Failed to read registered SNIs: %s", strerror(-ret)); return ret; } char **ids; ret = sd_bus_message_read_strv(msg, &ids); if (ret < 0) { - wlr_log(WLR_ERROR, "Failed to read registered SNIs: %s", strerror(-ret)); + sway_log(SWAY_ERROR, "Failed to read registered SNIs: %s", strerror(-ret)); return ret; } @@ -99,7 +99,7 @@ static bool register_to_watcher(struct swaybar_host *host) { host->watcher_interface, watcher_path, host->watcher_interface, "RegisterStatusNotifierHost", NULL, NULL, "s", host->service); if (ret < 0) { - wlr_log(WLR_ERROR, "Failed to send register call: %s", strerror(-ret)); + sway_log(SWAY_ERROR, "Failed to send register call: %s", strerror(-ret)); return false; } @@ -109,7 +109,7 @@ static bool register_to_watcher(struct swaybar_host *host) { get_registered_snis_callback, host->tray, "ss", host->watcher_interface, "RegisteredStatusNotifierItems"); if (ret < 0) { - wlr_log(WLR_ERROR, "Failed to get registered SNIs: %s", strerror(-ret)); + sway_log(SWAY_ERROR, "Failed to get registered SNIs: %s", strerror(-ret)); } return ret >= 0; @@ -120,7 +120,7 @@ static int handle_new_watcher(sd_bus_message *msg, char *service, *old_owner, *new_owner; int ret = sd_bus_message_read(msg, "sss", &service, &old_owner, &new_owner); if (ret < 0) { - wlr_log(WLR_ERROR, "Failed to parse owner change message: %s", strerror(-ret)); + sway_log(SWAY_ERROR, "Failed to parse owner change message: %s", strerror(-ret)); return ret; } @@ -148,7 +148,7 @@ bool init_host(struct swaybar_host *host, char *protocol, watcher_path, host->watcher_interface, "StatusNotifierItemRegistered", handle_sni_registered, tray); if (ret < 0) { - wlr_log(WLR_ERROR, "Failed to subscribe to registering events: %s", + sway_log(SWAY_ERROR, "Failed to subscribe to registering events: %s", strerror(-ret)); goto error; } @@ -156,7 +156,7 @@ bool init_host(struct swaybar_host *host, char *protocol, watcher_path, host->watcher_interface, "StatusNotifierItemUnregistered", handle_sni_unregistered, tray); if (ret < 0) { - wlr_log(WLR_ERROR, "Failed to subscribe to unregistering events: %s", + sway_log(SWAY_ERROR, "Failed to subscribe to unregistering events: %s", strerror(-ret)); goto error; } @@ -165,7 +165,7 @@ bool init_host(struct swaybar_host *host, char *protocol, "/org/freedesktop/DBus", "org.freedesktop.DBus", "NameOwnerChanged", handle_new_watcher, host); if (ret < 0) { - wlr_log(WLR_ERROR, "Failed to subscribe to unregistering events: %s", + sway_log(SWAY_ERROR, "Failed to subscribe to unregistering events: %s", strerror(-ret)); goto error; } @@ -180,7 +180,7 @@ bool init_host(struct swaybar_host *host, char *protocol, snprintf(host->service, service_len, "org.%s.StatusNotifierHost-%d", protocol, pid); ret = sd_bus_request_name(tray->bus, host->service, 0); if (ret < 0) { - wlr_log(WLR_DEBUG, "Failed to acquire service name: %s", strerror(-ret)); + sway_log(SWAY_DEBUG, "Failed to acquire service name: %s", strerror(-ret)); goto error; } @@ -193,7 +193,7 @@ bool init_host(struct swaybar_host *host, char *protocol, sd_bus_slot_set_floating(unreg_slot, 1); sd_bus_slot_set_floating(watcher_slot, 1); - wlr_log(WLR_DEBUG, "Registered %s", host->service); + sway_log(SWAY_DEBUG, "Registered %s", host->service); return true; error: sd_bus_slot_unref(reg_slot); diff --git a/swaybar/tray/icon.c b/swaybar/tray/icon.c index 15fda631..ed152be5 100644 --- a/swaybar/tray/icon.c +++ b/swaybar/tray/icon.c @@ -317,7 +317,7 @@ void init_themes(list_t **themes, list_t **basedirs) { list_add(theme_names, theme->name); } char *theme_list = join_list(theme_names, ", "); - wlr_log(WLR_DEBUG, "Loaded themes: %s", theme_list); + sway_log(SWAY_DEBUG, "Loaded themes: %s", theme_list); free(theme_list); list_free(theme_names); } diff --git a/swaybar/tray/item.c b/swaybar/tray/item.c index 9056331e..39d83b23 100644 --- a/swaybar/tray/item.c +++ b/swaybar/tray/item.c @@ -35,12 +35,12 @@ static int read_pixmap(sd_bus_message *msg, struct swaybar_sni *sni, const char *prop, list_t **dest) { int ret = sd_bus_message_enter_container(msg, 'a', "(iiay)"); if (ret < 0) { - wlr_log(WLR_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret)); + sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret)); return ret; } if (sd_bus_message_at_end(msg, 0)) { - wlr_log(WLR_DEBUG, "%s %s no. of icons = 0", sni->watcher_id, prop); + sway_log(SWAY_DEBUG, "%s %s no. of icons = 0", sni->watcher_id, prop); return ret; } @@ -52,14 +52,14 @@ static int read_pixmap(sd_bus_message *msg, struct swaybar_sni *sni, while (!sd_bus_message_at_end(msg, 0)) { ret = sd_bus_message_enter_container(msg, 'r', "iiay"); if (ret < 0) { - wlr_log(WLR_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret)); + sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret)); goto error; } int size; ret = sd_bus_message_read(msg, "ii", NULL, &size); if (ret < 0) { - wlr_log(WLR_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret)); + sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret)); goto error; } @@ -67,7 +67,7 @@ static int read_pixmap(sd_bus_message *msg, struct swaybar_sni *sni, size_t npixels; ret = sd_bus_message_read_array(msg, 'y', &pixels, &npixels); if (ret < 0) { - wlr_log(WLR_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret)); + sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret)); goto error; } @@ -81,7 +81,7 @@ static int read_pixmap(sd_bus_message *msg, struct swaybar_sni *sni, } list_free_items_and_destroy(*dest); *dest = pixmaps; - wlr_log(WLR_DEBUG, "%s %s no. of icons = %d", sni->watcher_id, prop, + sway_log(SWAY_DEBUG, "%s %s no. of icons = %d", sni->watcher_id, prop, pixmaps->length); return ret; @@ -107,7 +107,7 @@ static int get_property_callback(sd_bus_message *msg, void *data, int ret; if (sd_bus_message_is_method_error(msg, NULL)) { - wlr_log(WLR_ERROR, "%s %s: %s", sni->watcher_id, prop, + sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, sd_bus_message_get_error(msg)->message); ret = sd_bus_message_get_errno(msg); goto cleanup; @@ -115,7 +115,7 @@ static int get_property_callback(sd_bus_message *msg, void *data, ret = sd_bus_message_enter_container(msg, 'v', type); if (ret < 0) { - wlr_log(WLR_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret)); + sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret)); goto cleanup; } @@ -131,16 +131,16 @@ static int get_property_callback(sd_bus_message *msg, void *data, ret = sd_bus_message_read(msg, type, dest); if (ret < 0) { - wlr_log(WLR_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret)); + sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret)); goto cleanup; } if (*type == 's' || *type == 'o') { char **str = dest; *str = strdup(*str); - wlr_log(WLR_DEBUG, "%s %s = '%s'", sni->watcher_id, prop, *str); + sway_log(SWAY_DEBUG, "%s %s = '%s'", sni->watcher_id, prop, *str); } else if (*type == 'b') { - wlr_log(WLR_DEBUG, "%s %s = %s", sni->watcher_id, prop, + sway_log(SWAY_DEBUG, "%s %s = %s", sni->watcher_id, prop, *(bool *)dest ? "true" : "false"); } } @@ -165,7 +165,7 @@ static void sni_get_property_async(struct swaybar_sni *sni, const char *prop, sni->path, "org.freedesktop.DBus.Properties", "Get", get_property_callback, data, "ss", sni->interface, prop); if (ret < 0) { - wlr_log(WLR_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret)); + sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret)); } } @@ -188,10 +188,10 @@ static int sni_check_msg_sender(struct swaybar_sni *sni, sd_bus_message *msg, bool has_well_known_names = sd_bus_creds_get_mask(sd_bus_message_get_creds(msg)) & SD_BUS_CREDS_WELL_KNOWN_NAMES; if (sni->service[0] == ':' || has_well_known_names) { - wlr_log(WLR_DEBUG, "%s has new %s", sni->watcher_id, signal); + sway_log(SWAY_DEBUG, "%s has new %s", sni->watcher_id, signal); return 1; } else { - wlr_log(WLR_DEBUG, "%s may have new %s", sni->watcher_id, signal); + sway_log(SWAY_DEBUG, "%s may have new %s", sni->watcher_id, signal); return 0; } } @@ -218,12 +218,12 @@ static int handle_new_status(sd_bus_message *msg, void *data, sd_bus_error *erro char *status; int r = sd_bus_message_read(msg, "s", &status); if (r < 0) { - wlr_log(WLR_ERROR, "%s new status error: %s", sni->watcher_id, strerror(-ret)); + sway_log(SWAY_ERROR, "%s new status error: %s", sni->watcher_id, strerror(-ret)); ret = r; } else { free(sni->status); sni->status = strdup(status); - wlr_log(WLR_DEBUG, "%s has new status = '%s'", sni->watcher_id, status); + sway_log(SWAY_DEBUG, "%s has new status = '%s'", sni->watcher_id, status); set_sni_dirty(sni); } } else { @@ -238,7 +238,7 @@ static void sni_match_signal(struct swaybar_sni *sni, sd_bus_slot **slot, int ret = sd_bus_match_signal(sni->tray->bus, slot, sni->service, sni->path, sni->interface, signal, callback, sni); if (ret < 0) { - wlr_log(WLR_ERROR, "Failed to subscribe to signal %s: %s", signal, + sway_log(SWAY_ERROR, "Failed to subscribe to signal %s: %s", signal, strerror(-ret)); } } @@ -353,7 +353,7 @@ static int cmp_sni_id(const void *item, const void *cmp_to) { static enum hotspot_event_handling icon_hotspot_callback( struct swaybar_output *output, struct swaybar_hotspot *hotspot, int x, int y, uint32_t button, void *data) { - wlr_log(WLR_DEBUG, "Clicked on %s", (char *)data); + sway_log(SWAY_DEBUG, "Clicked on %s", (char *)data); struct swaybar_tray *tray = output->bar->tray; int idx = list_seq_find(tray->items, cmp_sni_id, data); @@ -367,11 +367,11 @@ static enum hotspot_event_handling icon_hotspot_callback( int global_y = output->output_y + (top_bar ? config->gaps.top + y: (int) output->output_height - config->gaps.bottom - y); - wlr_log(WLR_DEBUG, "Guessing click position at (%d, %d)", global_x, global_y); + sway_log(SWAY_DEBUG, "Guessing click position at (%d, %d)", global_x, global_y); handle_click(sni, global_x, global_y, button, 1); // TODO get delta from event return HOTSPOT_IGNORE; } else { - wlr_log(WLR_DEBUG, "but it doesn't exist"); + sway_log(SWAY_DEBUG, "but it doesn't exist"); } return HOTSPOT_PROCESS; diff --git a/swaybar/tray/tray.c b/swaybar/tray/tray.c index d5d0c84e..fcf8114f 100644 --- a/swaybar/tray/tray.c +++ b/swaybar/tray/tray.c @@ -17,7 +17,7 @@ static int handle_lost_watcher(sd_bus_message *msg, char *service, *old_owner, *new_owner; int ret = sd_bus_message_read(msg, "sss", &service, &old_owner, &new_owner); if (ret < 0) { - wlr_log(WLR_ERROR, "Failed to parse owner change message: %s", strerror(-ret)); + sway_log(SWAY_ERROR, "Failed to parse owner change message: %s", strerror(-ret)); return ret; } @@ -34,12 +34,12 @@ static int handle_lost_watcher(sd_bus_message *msg, } struct swaybar_tray *create_tray(struct swaybar *bar) { - wlr_log(WLR_DEBUG, "Initializing tray"); + sway_log(SWAY_DEBUG, "Initializing tray"); sd_bus *bus; int ret = sd_bus_open_user(&bus); if (ret < 0) { - wlr_log(WLR_ERROR, "Failed to connect to user bus: %s", strerror(-ret)); + sway_log(SWAY_ERROR, "Failed to connect to user bus: %s", strerror(-ret)); return NULL; } @@ -58,7 +58,7 @@ struct swaybar_tray *create_tray(struct swaybar *bar) { "/org/freedesktop/DBus", "org.freedesktop.DBus", "NameOwnerChanged", handle_lost_watcher, tray); if (ret < 0) { - wlr_log(WLR_ERROR, "Failed to subscribe to unregistering events: %s", + sway_log(SWAY_ERROR, "Failed to subscribe to unregistering events: %s", strerror(-ret)); } @@ -96,7 +96,7 @@ void tray_in(int fd, short mask, void *data) { // This space intentionally left blank } if (ret < 0) { - wlr_log(WLR_ERROR, "Failed to process bus: %s", strerror(-ret)); + sway_log(SWAY_ERROR, "Failed to process bus: %s", strerror(-ret)); } } diff --git a/swaybar/tray/watcher.c b/swaybar/tray/watcher.c index 198c6c85..68052ed9 100644 --- a/swaybar/tray/watcher.c +++ b/swaybar/tray/watcher.c @@ -27,7 +27,7 @@ static int handle_lost_service(sd_bus_message *msg, char *service, *old_owner, *new_owner; int ret = sd_bus_message_read(msg, "sss", &service, &old_owner, &new_owner); if (ret < 0) { - wlr_log(WLR_ERROR, "Failed to parse owner change message: %s", strerror(-ret)); + sway_log(SWAY_ERROR, "Failed to parse owner change message: %s", strerror(-ret)); return ret; } @@ -37,7 +37,7 @@ static int handle_lost_service(sd_bus_message *msg, using_standard_protocol(watcher) ? cmp_id : cmp_service, service); if (idx != -1) { char *id = watcher->items->items[idx]; - wlr_log(WLR_DEBUG, "Unregistering Status Notifier Item '%s'", id); + 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); @@ -46,7 +46,7 @@ static int handle_lost_service(sd_bus_message *msg, idx = list_seq_find(watcher->hosts, cmp_id, service); if (idx != -1) { - wlr_log(WLR_DEBUG, "Unregistering Status Notifier Host '%s'", service); + sway_log(SWAY_DEBUG, "Unregistering Status Notifier Host '%s'", service); free(watcher->hosts->items[idx]); list_del(watcher->hosts, idx); } @@ -59,7 +59,7 @@ static int register_sni(sd_bus_message *msg, void *data, sd_bus_error *error) { char *service_or_path, *id; int ret = sd_bus_message_read(msg, "s", &service_or_path); if (ret < 0) { - wlr_log(WLR_ERROR, "Failed to parse register SNI message: %s", strerror(-ret)); + sway_log(SWAY_ERROR, "Failed to parse register SNI message: %s", strerror(-ret)); return ret; } @@ -81,12 +81,12 @@ static int register_sni(sd_bus_message *msg, void *data, sd_bus_error *error) { } if (list_seq_find(watcher->items, cmp_id, id) == -1) { - wlr_log(WLR_DEBUG, "Registering Status Notifier Item '%s'", id); + sway_log(SWAY_DEBUG, "Registering Status Notifier Item '%s'", id); list_add(watcher->items, id); sd_bus_emit_signal(watcher->bus, obj_path, watcher->interface, "StatusNotifierItemRegistered", "s", id); } else { - wlr_log(WLR_DEBUG, "Status Notifier Item '%s' already registered", id); + sway_log(SWAY_DEBUG, "Status Notifier Item '%s' already registered", id); free(id); } @@ -97,18 +97,18 @@ static int register_host(sd_bus_message *msg, void *data, sd_bus_error *error) { char *service; int ret = sd_bus_message_read(msg, "s", &service); if (ret < 0) { - wlr_log(WLR_ERROR, "Failed to parse register host message: %s", strerror(-ret)); + sway_log(SWAY_ERROR, "Failed to parse register host message: %s", strerror(-ret)); return ret; } struct swaybar_watcher *watcher = data; if (list_seq_find(watcher->hosts, cmp_id, service) == -1) { - wlr_log(WLR_DEBUG, "Registering Status Notifier Host '%s'", service); + sway_log(SWAY_DEBUG, "Registering Status Notifier Host '%s'", service); list_add(watcher->hosts, strdup(service)); sd_bus_emit_signal(watcher->bus, obj_path, watcher->interface, "StatusNotifierHostRegistered", "s", service); } else { - wlr_log(WLR_DEBUG, "Status Notifier Host '%s' already registered", service); + sway_log(SWAY_DEBUG, "Status Notifier Host '%s' already registered", service); } return sd_bus_reply_method_return(msg, ""); @@ -166,7 +166,7 @@ struct swaybar_watcher *create_watcher(char *protocol, sd_bus *bus) { int ret = sd_bus_add_object_vtable(bus, &vtable_slot, obj_path, watcher->interface, watcher_vtable, watcher); if (ret < 0) { - wlr_log(WLR_ERROR, "Failed to add object vtable: %s", strerror(-ret)); + sway_log(SWAY_ERROR, "Failed to add object vtable: %s", strerror(-ret)); goto error; } @@ -174,14 +174,14 @@ struct swaybar_watcher *create_watcher(char *protocol, sd_bus *bus) { "/org/freedesktop/DBus", "org.freedesktop.DBus", "NameOwnerChanged", handle_lost_service, watcher); if (ret < 0) { - wlr_log(WLR_ERROR, "Failed to subscribe to unregistering events: %s", + sway_log(SWAY_ERROR, "Failed to subscribe to unregistering events: %s", strerror(-ret)); goto error; } ret = sd_bus_request_name(bus, watcher->interface, 0); if (ret < 0) { - wlr_log(WLR_ERROR, "Failed to acquire service name: %s", strerror(-ret)); + sway_log(SWAY_ERROR, "Failed to acquire service name: %s", strerror(-ret)); goto error; } @@ -192,7 +192,7 @@ struct swaybar_watcher *create_watcher(char *protocol, sd_bus *bus) { watcher->hosts = create_list(); watcher->items = create_list(); watcher->version = 0; - wlr_log(WLR_DEBUG, "Registered %s", watcher->interface); + sway_log(SWAY_DEBUG, "Registered %s", watcher->interface); return watcher; error: sd_bus_slot_unref(signal_slot); |