From eb93af362248a5355e544b6827f26cf4ab6bf7bf Mon Sep 17 00:00:00 2001 From: o9000 Date: Fri, 1 Sep 2017 18:23:46 +0200 Subject: [PATCH] preprent "tint2:" to all logging messages --- src/battery/battery.c | 6 +-- src/battery/freebsd.c | 2 +- src/battery/linux.c | 24 +++++----- src/button/button.c | 2 +- src/clock/clock.c | 4 +- src/config.c | 24 +++++----- src/drag_and_drop.c | 30 ++++++------ src/execplugin/execplugin.c | 13 +++-- src/init.c | 6 +-- src/launcher/apps-common.c | 14 +++--- src/launcher/icon-theme-common.c | 54 ++++++++++----------- src/launcher/launcher.c | 6 +-- src/launcher/xsettings-client.c | 16 +++---- src/main.c | 24 +++++----- src/panel.c | 18 +++---- src/server.c | 40 ++++++++-------- src/signals.c | 2 +- src/systray/systraybar.c | 82 ++++++++++++++++---------------- src/taskbar/task.c | 14 +++--- src/taskbar/taskbar.c | 6 +-- src/tint2conf/properties.c | 12 ++--- src/tint2conf/properties_rw.c | 2 +- src/tracing.c | 18 +++---- src/util/area.c | 14 +++--- src/util/cache.c | 4 +- src/util/common.c | 10 ++-- src/util/fps_distribution.c | 4 +- src/util/gradient.c | 2 +- src/util/uevent.c | 6 +-- src/util/window.c | 4 +- 30 files changed, 231 insertions(+), 232 deletions(-) diff --git a/src/battery/battery.c b/src/battery/battery.c index 2dff910..433bff4 100644 --- a/src/battery/battery.c +++ b/src/battery/battery.c @@ -208,7 +208,7 @@ void battery_update_text(char *dest, char *format) strnappend(dest, "%", BATTERY_BUF_SIZE); break; default: - fprintf(stderr, "Battery: unrecognised format specifier '%%%c'.\n", *c); + fprintf(stderr, "tint2: Battery: unrecognised format specifier '%%%c'.\n", *c); buf[0] = *c; strnappend(dest, buf, BATTERY_BUF_SIZE); } @@ -435,8 +435,8 @@ void draw_battery(void *obj, cairo_t *c) void battery_dump_geometry(void *obj, int indent) { Battery *battery = (Battery *)obj; - fprintf(stderr, "%*sText 1: y = %d, text = %s\n", indent, "", battery->bat1_posy, buf_bat_line1); - fprintf(stderr, "%*sText 2: y = %d, text = %s\n", indent, "", battery->bat2_posy, buf_bat_line2); + fprintf(stderr, "tint2: %*sText 1: y = %d, text = %s\n", indent, "", battery->bat1_posy, buf_bat_line1); + fprintf(stderr, "tint2: %*sText 2: y = %d, text = %s\n", indent, "", battery->bat2_posy, buf_bat_line2); } char *battery_get_tooltip(void *obj) diff --git a/src/battery/freebsd.c b/src/battery/freebsd.c index 826b47f..bcf40bb 100644 --- a/src/battery/freebsd.c +++ b/src/battery/freebsd.c @@ -58,7 +58,7 @@ int battery_os_update(BatteryState *state) break; } } else { - fprintf(stderr, "power update: no such sysctl"); + fprintf(stderr, "tint2: power update: no such sysctl"); err = -1; } diff --git a/src/battery/linux.c b/src/battery/linux.c index 87d392c..9335f73 100644 --- a/src/battery/linux.c +++ b/src/battery/linux.c @@ -68,7 +68,7 @@ static struct uevent_notify psy_change = {UEVENT_CHANGE, "power_supply", NULL, u static void uevent_battery_plug() { - fprintf(stderr, "reinitialize batteries after HW change\n"); + fprintf(stderr, "tint2: reinitialize batteries after HW change\n"); reinit_battery(); } static struct uevent_notify psy_plug = {UEVENT_ADD | UEVENT_REMOVE, "power_supply", NULL, uevent_battery_plug}; @@ -76,7 +76,7 @@ static struct uevent_notify psy_plug = {UEVENT_ADD | UEVENT_REMOVE, "power_suppl #define RETURN_ON_ERROR(err) \ if (err) { \ g_error_free(err); \ - fprintf(stderr, RED "%s:%d: errror" RESET "\n", __FILE__, __LINE__); \ + fprintf(stderr, RED "tint2: %s:%d: errror" RESET "\n", __FILE__, __LINE__); \ return FALSE; \ } @@ -98,7 +98,7 @@ static enum psy_type power_supply_get_type(const gchar *entryname) g_file_get_contents(path_type, &type, &typelen, &error); g_free(path_type); if (error) { - fprintf(stderr, RED "%s:%d: read failed" RESET "\n", __FILE__, __LINE__); + fprintf(stderr, RED "tint2: %s:%d: read failed" RESET "\n", __FILE__, __LINE__); g_error_free(error); return PSY_UNKNOWN; } @@ -124,7 +124,7 @@ static gboolean init_linux_battery(struct psy_battery *bat) bat->path_present = g_build_filename(battery_sys_prefix, "/sys/class/power_supply", entryname, "present", NULL); if (!g_file_test(bat->path_present, G_FILE_TEST_EXISTS)) { - fprintf(stderr, RED "%s:%d: read failed" RESET "\n", __FILE__, __LINE__); + fprintf(stderr, RED "tint2: %s:%d: read failed" RESET "\n", __FILE__, __LINE__); goto err0; } @@ -152,13 +152,13 @@ static gboolean init_linux_battery(struct psy_battery *bat) if (!g_file_test(bat->path_level_now, G_FILE_TEST_EXISTS) || !g_file_test(bat->path_level_full, G_FILE_TEST_EXISTS) || !g_file_test(bat->path_rate_now, G_FILE_TEST_EXISTS)) { - fprintf(stderr, RED "%s:%d: read failed" RESET "\n", __FILE__, __LINE__); + fprintf(stderr, RED "tint2: %s:%d: read failed" RESET "\n", __FILE__, __LINE__); goto err1; } bat->path_status = g_build_filename(battery_sys_prefix, "/sys/class/power_supply", entryname, "status", NULL); if (!g_file_test(bat->path_status, G_FILE_TEST_EXISTS)) { - fprintf(stderr, RED "%s:%d: read failed" RESET "\n", __FILE__, __LINE__); + fprintf(stderr, RED "tint2: %s:%d: read failed" RESET "\n", __FILE__, __LINE__); goto err2; } @@ -182,7 +182,7 @@ static gboolean init_linux_mains(struct psy_mains *ac) ac->path_online = g_build_filename(battery_sys_prefix, "/sys/class/power_supply", entryname, "online", NULL); if (!g_file_test(ac->path_online, G_FILE_TEST_EXISTS)) { - fprintf(stderr, RED "%s:%d: read failed" RESET "\n", __FILE__, __LINE__); + fprintf(stderr, RED "tint2: %s:%d: read failed" RESET "\n", __FILE__, __LINE__); g_free(ac->path_online); return FALSE; } @@ -228,10 +228,10 @@ static void add_battery(const char *entryname) if (init_linux_battery(bat)) { batteries = g_list_append(batteries, bat); - fprintf(stdout, GREEN "Found battery \"%s\"" RESET "\n", bat->name); + fprintf(stderr, GREEN "Found battery \"%s\"" RESET "\n", bat->name); } else { g_free(bat); - fprintf(stderr, RED "Failed to initialize battery \"%s\"" RESET "\n", entryname); + fprintf(stderr, RED "tint2: Failed to initialize battery \"%s\"" RESET "\n", entryname); } } @@ -242,10 +242,10 @@ static void add_mains(const char *entryname) if (init_linux_mains(ac)) { mains = g_list_append(mains, ac); - fprintf(stdout, GREEN "Found mains \"%s\"" RESET "\n", ac->name); + fprintf(stderr, GREEN "Found mains \"%s\"" RESET "\n", ac->name); } else { g_free(ac); - fprintf(stderr, RED "Failed to initialize mains \"%s\"" RESET "\n", entryname); + fprintf(stderr, RED "tint2: Failed to initialize mains \"%s\"" RESET "\n", entryname); } } @@ -263,7 +263,7 @@ gboolean battery_os_init() RETURN_ON_ERROR(error); while ((entryname = g_dir_read_name(directory))) { - fprintf(stderr, GREEN "Found power device %s" RESET "\n", entryname); + fprintf(stderr, GREEN "tint2: Found power device %s" RESET "\n", entryname); enum psy_type type = power_supply_get_type(entryname); switch (type) { diff --git a/src/button/button.c b/src/button/button.c index c1b0c7a..7a36dda 100644 --- a/src/button/button.c +++ b/src/button/button.c @@ -78,7 +78,7 @@ void destroy_button(void *obj) free_and_null(button->backend->uwheel_command); if (button->backend->instances) { - fprintf(stderr, "Error: Attempt to destroy backend while there are still frontend instances!\n"); + fprintf(stderr, "tint2: Error: Attempt to destroy backend while there are still frontend instances!\n"); exit(-1); } free(button->backend); diff --git a/src/clock/clock.c b/src/clock/clock.c index 8213ddb..d26520f 100644 --- a/src/clock/clock.c +++ b/src/clock/clock.c @@ -321,9 +321,9 @@ void draw_clock(void *obj, cairo_t *c) void clock_dump_geometry(void *obj, int indent) { Clock *clock = (Clock *)obj; - fprintf(stderr, "%*sText 1: y = %d, text = %s\n", indent, "", clock->time1_posy, buf_time); + fprintf(stderr, "tint2: %*sText 1: y = %d, text = %s\n", indent, "", clock->time1_posy, buf_time); if (time2_format) { - fprintf(stderr, "%*sText 2: y = %d, text = %s\n", indent, "", clock->time2_posy, buf_date); + fprintf(stderr, "tint2: %*sText 2: y = %d, text = %s\n", indent, "", clock->time2_posy, buf_date); } } diff --git a/src/config.c b/src/config.c index f3024d6..ae8e768 100644 --- a/src/config.c +++ b/src/config.c @@ -119,7 +119,7 @@ void get_action(char *event, MouseAction *action) else if (strcmp(event, "prev_task") == 0) *action = PREV_TASK; else - fprintf(stderr, "Error: unrecognized action '%s'. Please fix your config file.\n", event); + fprintf(stderr, "tint2: Error: unrecognized action '%s'. Please fix your config file.\n", event); } int get_task_status(char *status) @@ -215,7 +215,7 @@ void load_launcher_app_dir(const char *path) Separator *get_or_create_last_separator() { if (!panel_config.separator_list) { - fprintf(stderr, "Warning: separator items should shart with 'separator = new'\n"); + fprintf(stderr, "tint2: Warning: separator items should shart with 'separator = new'\n"); panel_config.separator_list = g_list_append(panel_config.separator_list, create_separator()); } return (Separator *)g_list_last(panel_config.separator_list)->data; @@ -224,7 +224,7 @@ Separator *get_or_create_last_separator() Execp *get_or_create_last_execp() { if (!panel_config.execp_list) { - fprintf(stderr, "Warning: execp items should start with 'execp = new'\n"); + fprintf(stderr, "tint2: Warning: execp items should start with 'execp = new'\n"); panel_config.execp_list = g_list_append(panel_config.execp_list, create_execp()); } return (Execp *)g_list_last(panel_config.execp_list)->data; @@ -233,7 +233,7 @@ Execp *get_or_create_last_execp() Button *get_or_create_last_button() { if (!panel_config.button_list) { - fprintf(stderr, "Warning: button items should start with 'button = new'\n"); + fprintf(stderr, "tint2: Warning: button items should start with 'button = new'\n"); panel_config.button_list = g_list_append(panel_config.button_list, create_button()); } return (Button *)g_list_last(panel_config.button_list)->data; @@ -433,7 +433,7 @@ void add_entry(char *key, char *value) #ifdef ENABLE_BATTERY battery_enabled = 1; #else - fprintf(stderr, "tint2 is build without battery support\n"); + fprintf(stderr, "tint2: tint2 has been compiled without battery support\n"); #endif } if (panel_items_order[j] == 'S') { @@ -654,7 +654,7 @@ void add_entry(char *key, char *value) else if (g_str_equal(value, "dots")) separator->style = SEPARATOR_DOTS; else - fprintf(stderr, RED "Invalid separator_style value: %s" RESET "\n", value); + fprintf(stderr, RED "tint2: Invalid separator_style value: %s" RESET "\n", value); } else if (strcmp(key, "separator_size") == 0) { Separator *separator = get_or_create_last_separator(); separator->thickness = atoi(value); @@ -681,7 +681,7 @@ void add_entry(char *key, char *value) execp->backend->interval = 0; int v = atoi(value); if (v < 0) { - fprintf(stderr, "execp_interval must be an integer >= 0\n"); + fprintf(stderr, "tint2: execp_interval must be an integer >= 0\n"); } else { execp->backend->interval = v; } @@ -737,7 +737,7 @@ void add_entry(char *key, char *value) Execp *execp = get_or_create_last_execp(); int v = atoi(value); if (v < 0) { - fprintf(stderr, "execp_icon_w must be an integer >= 0\n"); + fprintf(stderr, "tint2: execp_icon_w must be an integer >= 0\n"); } else { execp->backend->icon_w = v; } @@ -745,7 +745,7 @@ void add_entry(char *key, char *value) Execp *execp = get_or_create_last_execp(); int v = atoi(value); if (v < 0) { - fprintf(stderr, "execp_icon_h must be an integer >= 0\n"); + fprintf(stderr, "tint2: execp_icon_h must be an integer >= 0\n"); } else { execp->backend->icon_h = v; } @@ -1290,7 +1290,7 @@ void add_entry(char *key, char *value) else if (strcmp(key, "primary_monitor_first") == 0) { fprintf(stderr, "tint2: deprecated config option \"%s\"\n" - " Please see the documentation regarding the alternatives.\n", + " Please see the documentation regarding the alternatives.\n", key); } else fprintf(stderr, "tint2: invalid option \"%s\",\n upgrade tint2 or correct your config file\n", key); @@ -1305,7 +1305,7 @@ void add_entry(char *key, char *value) gboolean config_read_file(const char *path) { - fprintf(stderr, "Loading config file: %s\n", path); + fprintf(stderr, "tint2: Loading config file: %s\n", path); FILE *fp = fopen(path, "r"); if (!fp) @@ -1375,7 +1375,7 @@ gboolean config_read_default_path() // copy tint2rc from system directory to user directory - fprintf(stderr, "tint2 warning: could not find a config file! Creating a default one.\n"); + fprintf(stderr, "tint2: could not find a config file! Creating a default one.\n"); // According to the XDG Base Directory Specification // (https://specifications.freedesktop.org/basedir-spec/basedir-spec-0.6.html) // if the user's config directory does not exist, we should create it with permissions set to 0700. diff --git a/src/drag_and_drop.c b/src/drag_and_drop.c index 9baddd5..01277b3 100644 --- a/src/drag_and_drop.c +++ b/src/drag_and_drop.c @@ -55,16 +55,16 @@ void handle_dnd_enter(XClientMessageEvent *e) dnd_version = (e->data.l[1] >> 24); if (dnd_debug) { - fprintf(stderr, "DnD %s:%d: DnDEnter\n", __FILE__, __LINE__); + fprintf(stderr, "tint2: DnD %s:%d: DnDEnter\n", __FILE__, __LINE__); fprintf(stderr, "DnD %s:%d: DnDEnter. Supports > 3 types = %s\n", __FILE__, __LINE__, more_than_3 ? "yes" : "no"); - fprintf(stderr, "DnD %s:%d: Protocol version = %d\n", __FILE__, __LINE__, dnd_version); - fprintf(stderr, "DnD %s:%d: Type 1 = %s\n", __FILE__, __LINE__, GetAtomName(server.display, e->data.l[2])); - fprintf(stderr, "DnD %s:%d: Type 2 = %s\n", __FILE__, __LINE__, GetAtomName(server.display, e->data.l[3])); - fprintf(stderr, "DnD %s:%d: Type 3 = %s\n", __FILE__, __LINE__, GetAtomName(server.display, e->data.l[4])); + fprintf(stderr, "tint2: DnD %s:%d: Protocol version = %d\n", __FILE__, __LINE__, dnd_version); + fprintf(stderr, "tint2: DnD %s:%d: Type 1 = %s\n", __FILE__, __LINE__, GetAtomName(server.display, e->data.l[2])); + fprintf(stderr, "tint2: DnD %s:%d: Type 2 = %s\n", __FILE__, __LINE__, GetAtomName(server.display, e->data.l[3])); + fprintf(stderr, "tint2: DnD %s:%d: Type 3 = %s\n", __FILE__, __LINE__, GetAtomName(server.display, e->data.l[4])); } // Query which conversions are available and pick the best @@ -80,7 +80,7 @@ void handle_dnd_enter(XClientMessageEvent *e) } if (dnd_debug) - fprintf(stderr, "DnD %s:%d: Requested type = %s\n", __FILE__, __LINE__, GetAtomName(server.display, dnd_atom)); + fprintf(stderr, "tint2: DnD %s:%d: Requested type = %s\n", __FILE__, __LINE__, GetAtomName(server.display, dnd_atom)); } void handle_dnd_position(XClientMessageEvent *e) @@ -167,13 +167,13 @@ void handle_dnd_selection_notify(XSelectionEvent *e) Atom target = e->target; if (dnd_debug) { - fprintf(stderr, "DnD %s:%d: A selection notify has arrived!\n", __FILE__, __LINE__); + fprintf(stderr, "tint2: DnD %s:%d: A selection notify has arrived!\n", __FILE__, __LINE__); fprintf(stderr, "DnD %s:%d: Selection atom = %s\n", __FILE__, __LINE__, GetAtomName(server.display, e->selection)); - fprintf(stderr, "DnD %s:%d: Target atom = %s\n", __FILE__, __LINE__, GetAtomName(server.display, target)); + fprintf(stderr, "tint2: DnD %s:%d: Target atom = %s\n", __FILE__, __LINE__, GetAtomName(server.display, target)); fprintf(stderr, "DnD %s:%d: Property atom = %s\n", __FILE__, @@ -191,11 +191,11 @@ void handle_dnd_selection_notify(XSelectionEvent *e) if (dnd_atom == None) { if (dnd_debug) - fprintf(stderr, "No matching datatypes.\n"); + fprintf(stderr, "tint2: No matching datatypes.\n"); } else { // Request the data type we are able to select if (dnd_debug) - fprintf(stderr, "Now requsting type %s", GetAtomName(server.display, dnd_atom)); + fprintf(stderr, "tint2: Now requsting type %s", GetAtomName(server.display, dnd_atom)); XConvertSelection(server.display, dnd_selection, dnd_atom, @@ -206,11 +206,11 @@ void handle_dnd_selection_notify(XSelectionEvent *e) } else if (target == dnd_atom) { // Dump the binary data if (dnd_debug) { - fprintf(stderr, "DnD %s:%d: Data begins:\n", __FILE__, __LINE__); - fprintf(stderr, "--------\n"); + fprintf(stderr, "tint2: DnD %s:%d: Data begins:\n", __FILE__, __LINE__); + fprintf(stderr, "tint2: --------\n"); for (int i = 0; i < prop.nitems * prop.format / 8; i++) - fprintf(stderr, "%c", ((char *)prop.data)[i]); - fprintf(stderr, "--------\n"); + fprintf(stderr, "tint2: %c", ((char *)prop.data)[i]); + fprintf(stderr, "tint2: --------\n"); } int cmd_length = 0; @@ -262,7 +262,7 @@ void handle_dnd_selection_notify(XSelectionEvent *e) strcat(cmd, "\""); strcat(cmd, "&)"); if (dnd_debug) - fprintf(stderr, "DnD %s:%d: Running command: %s\n", __FILE__, __LINE__, cmd); + fprintf(stderr, "tint2: DnD %s:%d: Running command: %s\n", __FILE__, __LINE__, cmd); tint_exec(cmd, NULL, NULL, e->time, NULL, 0, 0); free(cmd); diff --git a/src/execplugin/execplugin.c b/src/execplugin/execplugin.c index 324e9dd..87a4ca2 100644 --- a/src/execplugin/execplugin.c +++ b/src/execplugin/execplugin.c @@ -108,7 +108,7 @@ void destroy_execp(void *obj) free_and_null(execp->backend->uwheel_command); if (execp->backend->instances) { - fprintf(stderr, "Error: Attempt to destroy backend while there are still frontend instances!\n"); + fprintf(stderr, "tint2: Error: Attempt to destroy backend while there are still frontend instances!\n"); exit(-1); } free(execp->backend); @@ -609,7 +609,7 @@ void execp_timer_callback(void *arg) int pipe_fd_stdout[2]; if (pipe(pipe_fd_stdout)) { // TODO maybe write this in tooltip, but if this happens we're screwed anyways - fprintf(stderr, "Execp: Creating pipe failed!\n"); + fprintf(stderr, "tint2: Execp: Creating pipe failed!\n"); return; } @@ -620,7 +620,7 @@ void execp_timer_callback(void *arg) close(pipe_fd_stdout[1]); close(pipe_fd_stdout[0]); // TODO maybe write this in tooltip, but if this happens we're screwed anyways - fprintf(stderr, "Execp: Creating pipe failed!\n"); + fprintf(stderr, "tint2: Execp: Creating pipe failed!\n"); return; } @@ -630,14 +630,14 @@ void execp_timer_callback(void *arg) pid_t child = fork(); if (child == -1) { // TODO maybe write this in tooltip, but if this happens we're screwed anyways - fprintf(stderr, "Fork failed.\n"); + fprintf(stderr, "tint2: Fork failed.\n"); close(pipe_fd_stdout[1]); close(pipe_fd_stdout[0]); close(pipe_fd_stderr[1]); close(pipe_fd_stderr[0]); return; } else if (child == 0) { - fprintf(stderr, "Executing: %s\n", execp->backend->command); + fprintf(stderr, "tint2: Executing: %s\n", execp->backend->command); // We are in the child close(pipe_fd_stdout[0]); dup2(pipe_fd_stdout[1], 1); // 1 is stdout @@ -649,8 +649,7 @@ void execp_timer_callback(void *arg) setpgid(0, 0); execl("/bin/sh", "/bin/sh", "-c", execp->backend->command, NULL); // This should never happen! - fprintf(stdout, "execl() failed\nexecl() failed\n"); - fflush(stdout); + fprintf(stderr, "execl() failed\nexecl() failed\n"); exit(0); } close(pipe_fd_stdout[1]); diff --git a/src/init.c b/src/init.c index 463763a..6c0425b 100644 --- a/src/init.c +++ b/src/init.c @@ -115,7 +115,7 @@ void detect_compositor(void *arg) if (XGetSelectionOwner(server.display, server.atom._NET_WM_CM_S0) != None) { stop_timeout(detect_compositor_timer); // Restart tint2 - fprintf(stderr, "Detected compositor, restarting tint2...\n"); + fprintf(stderr, "tint2: Detected compositor, restarting tint2...\n"); kill(getpid(), SIGUSR1); } } @@ -181,7 +181,7 @@ void init_X11_pre_config() { server.display = XOpenDisplay(NULL); if (!server.display) { - fprintf(stderr, "tint2: could not open display.\n"); + fprintf(stderr, "tint2: could not open display!\n"); exit(1); } server.x11_fd = ConnectionNumber(server.display); @@ -220,7 +220,7 @@ void init(int argc, char **argv) init_X11_pre_config(); if (!config_read()) { - fprintf(stderr, "Could not read config file.\n"); + fprintf(stderr, "tint2: Could not read config file.\n"); print_usage(); cleanup(); return; diff --git a/src/launcher/apps-common.c b/src/launcher/apps-common.c index 581d3ae..a6d2b5b 100644 --- a/src/launcher/apps-common.c +++ b/src/launcher/apps-common.c @@ -116,7 +116,7 @@ gboolean read_desktop_file_full_path(const char *path, DesktopEntry *entry) FILE *fp = fopen(path, "rt"); if (fp == NULL) { - fprintf(stderr, "Could not open file %s\n", path); + fprintf(stderr, "tint2: Could not open file %s\n", path); return FALSE; } @@ -126,14 +126,14 @@ gboolean read_desktop_file_full_path(const char *path, DesktopEntry *entry) int lang_index_default = 1; #define LANG_DBG 0 if (LANG_DBG) - fprintf(stderr, "Languages:"); + fprintf(stderr, "tint2: Languages:"); for (int i = 0; languages[i]; i++) { lang_index_default = i + 1; if (LANG_DBG) - fprintf(stderr, " %s", languages[i]); + fprintf(stderr, "tint2: %s", languages[i]); } if (LANG_DBG) - fprintf(stderr, "\n"); + fprintf(stderr, "tint2: \n"); // we currently do not know about any Name key at all, so use an invalid index int lang_index_name = lang_index_default + 1; int lang_index_generic_name = lang_index_default + 1; @@ -278,11 +278,11 @@ void free_desktop_entry(DesktopEntry *entry) void test_read_desktop_file() { - fprintf(stdout, "\033[1;33m"); + fprintf(stderr, YELLOW); DesktopEntry entry; read_desktop_file("/usr/share/applications/firefox.desktop", &entry); - fprintf(stderr, "Name:%s GenericName:%s Icon:%s Exec:%s\n", entry.name, entry.generic_name, entry.icon, entry.exec); - fprintf(stdout, "\033[0m"); + fprintf(stderr, "tint2: Name:%s GenericName:%s Icon:%s Exec:%s\n", entry.name, entry.generic_name, entry.icon, entry.exec); + fprintf(stderr, RESET); } GSList *apps_locations = NULL; diff --git a/src/launcher/icon-theme-common.c b/src/launcher/icon-theme-common.c index 1d0222a..a43058c 100644 --- a/src/launcher/icon-theme-common.c +++ b/src/launcher/icon-theme-common.c @@ -92,7 +92,7 @@ IconTheme *load_theme_from_index(const char *file_name, const char *name) size_t line_size; if ((f = fopen(file_name, "rt")) == NULL) { - fprintf(stderr, "Could not open theme '%s'\n", file_name); + fprintf(stderr, "tint2: Could not open theme '%s'\n", file_name); return NULL; } @@ -327,22 +327,22 @@ void free_themes(IconThemeWrapper *wrapper) void test_launcher_read_theme_file() { - fprintf(stdout, "\033[1;33m"); + fprintf(stdout, YELLOW); IconTheme *theme = load_theme("oxygen"); if (!theme) { - fprintf(stderr, "Could not load theme\n"); + fprintf(stderr, "tint2: Could not load theme\n"); return; } - fprintf(stderr, "Loaded theme: %s\n", theme->name); + fprintf(stderr, "tint2: Loaded theme: %s\n", theme->name); GSList *item = theme->list_inherits; while (item != NULL) { - fprintf(stderr, "Inherits:%s\n", (char *)item->data); + fprintf(stderr, "tint2: Inherits:%s\n", (char *)item->data); item = g_slist_next(item); } item = theme->list_directories; while (item != NULL) { IconThemeDir *dir = item->data; - fprintf(stderr, "Dir:%s Size=%d MinSize=%d MaxSize=%d Threshold=%d Type=%s\n", + fprintf(stderr, "tint2: Dir:%s Size=%d MinSize=%d MaxSize=%d Threshold=%d Type=%s\n", dir->name, dir->size, dir->min_size, @@ -354,7 +354,7 @@ void test_launcher_read_theme_file() : "?????"); item = g_slist_next(item); } - fprintf(stdout, "\033[0m"); + fprintf(stdout, RESET); } gboolean str_list_contains(const GSList *list, const char *value) @@ -381,7 +381,7 @@ void load_themes_helper(const char *name, GSList **themes, GSList **queued) char *queued_name = queue->data; queue = g_slist_remove(queue, queued_name); - fprintf(stderr, " '%s',", queued_name); + fprintf(stderr, "tint2: '%s',", queued_name); IconTheme *theme = load_theme(queued_name); if (theme != NULL) { *themes = g_slist_append(*themes, theme); @@ -401,7 +401,7 @@ void load_themes_helper(const char *name, GSList **themes, GSList **queued) free(queued_name); } - fprintf(stderr, "\n"); + fprintf(stderr, "tint2: \n"); // Free the queue GSList *l; @@ -415,7 +415,7 @@ void load_default_theme(IconThemeWrapper *wrapper) if (wrapper->_themes_loaded) return; - fprintf(stderr, GREEN "Loading icon theme %s:" RESET "\n", wrapper->icon_theme_name); + fprintf(stderr, GREEN "tint2: Loading icon theme %s:" RESET "\n", wrapper->icon_theme_name); load_themes_helper(wrapper->icon_theme_name, &wrapper->themes, &wrapper->_queued); load_themes_helper("hicolor", &wrapper->themes, &wrapper->_queued); @@ -428,7 +428,7 @@ void load_fallbacks(IconThemeWrapper *wrapper) if (wrapper->_fallback_loaded) return; - fprintf(stderr, RED "Loading additional icon themes (this means your icon theme is incomplete)..." RESET "\n"); + fprintf(stderr, RED "tint2: Loading additional icon themes (this means your icon theme is incomplete)..." RESET "\n"); // Load wrapper->themes_fallback const GSList *location; @@ -461,7 +461,7 @@ void load_icon_cache(IconThemeWrapper *wrapper) if (wrapper->_cache.loaded) return; - fprintf(stderr, GREEN "Loading icon theme cache..." RESET "\n"); + fprintf(stderr, GREEN "tint2: Loading icon theme cache..." RESET "\n"); gchar *cache_path = get_icon_cache_path(); load_cache(&wrapper->_cache, cache_path); @@ -473,7 +473,7 @@ void save_icon_cache(IconThemeWrapper *wrapper) if (!wrapper || !wrapper->_cache.dirty) return; - fprintf(stderr, GREEN "Saving icon theme cache..." RESET "\n"); + fprintf(stderr, GREEN "tint2: Saving icon theme cache..." RESET "\n"); gchar *cache_path = get_icon_cache_path(); save_cache(&wrapper->_cache, cache_path); g_free(cache_path); @@ -484,7 +484,7 @@ IconThemeWrapper *load_themes(const char *icon_theme_name) IconThemeWrapper *wrapper = calloc(1, sizeof(IconThemeWrapper)); if (!icon_theme_name) { - fprintf(stderr, "Missing icon_theme_name theme, default to 'hicolor'.\n"); + fprintf(stderr, "tint2: Missing icon_theme_name theme, default to 'hicolor'.\n"); icon_theme_name = "hicolor"; } @@ -587,7 +587,7 @@ char *get_icon_path_helper(GSList *themes, const char *icon_name, int size) for (theme = themes; theme; theme = g_slist_next(theme)) { if (debug_icons) - fprintf(stderr, "Searching theme: %s\n", ((IconTheme *)theme->data)->name); + fprintf(stderr, "tint2: Searching theme: %s\n", ((IconTheme *)theme->data)->name); ((IconTheme *)theme->data)->list_directories = g_slist_sort_with_data(((IconTheme *)theme->data)->list_directories, compare_theme_directories, @@ -604,7 +604,7 @@ char *get_icon_path_helper(GSList *themes, const char *icon_name, int size) if (!possible) continue; if (debug_icons) - fprintf(stderr, "Searching directory: %s\n", ((IconThemeDir *)dir->data)->name); + fprintf(stderr, "tint2: Searching directory: %s\n", ((IconThemeDir *)dir->data)->name); const GSList *base; for (base = basenames; base; base = g_slist_next(base)) { for (GSList *ext = extensions; ext; ext = g_slist_next(ext)) { @@ -623,10 +623,10 @@ char *get_icon_path_helper(GSList *themes, const char *icon_name, int size) // filename = directory/$(themename)/subdirectory/iconname.extension sprintf(file_name, "%s/%s/%s/%s%s", base_name, theme_name, dir_name, icon_name, extension); if (debug_icons) - fprintf(stderr, "Checking %s\n", file_name); + fprintf(stderr, "tint2: Checking %s\n", file_name); if (g_file_test(file_name, G_FILE_TEST_EXISTS)) { if (debug_icons) - fprintf(stderr, "Found potential match: %s\n", file_name); + fprintf(stderr, "tint2: Found potential match: %s\n", file_name); // Closest match if (directory_size_distance((IconThemeDir *)dir->data, size) < minimal_size && (!best_file_theme ? 1 : theme == best_file_theme)) { @@ -638,7 +638,7 @@ char *get_icon_path_helper(GSList *themes, const char *icon_name, int size) minimal_size = directory_size_distance((IconThemeDir *)dir->data, size); best_file_theme = theme; if (debug_icons) - fprintf(stderr, "best_file_name = %s; minimal_size = %d\n", best_file_name, minimal_size); + fprintf(stderr, "tint2: best_file_name = %s; minimal_size = %d\n", best_file_name, minimal_size); } // Next larger match if (((IconThemeDir *)dir->data)->size >= size && @@ -652,7 +652,7 @@ char *get_icon_path_helper(GSList *themes, const char *icon_name, int size) next_larger_size = ((IconThemeDir *)dir->data)->size; next_larger_theme = theme; if (debug_icons) - fprintf(stderr, "next_larger = %s; next_larger_size = %d\n", next_larger, next_larger_size); + fprintf(stderr, "tint2: next_larger = %s; next_larger_size = %d\n", next_larger, next_larger_size); } } } @@ -674,7 +674,7 @@ char *get_icon_path_helper(GSList *themes, const char *icon_name, int size) // Look in unthemed icons { if (debug_icons) - fprintf(stderr, "Searching unthemed icons\n"); + fprintf(stderr, "tint2: Searching unthemed icons\n"); for (const GSList *base = basenames; base; base = g_slist_next(base)) { for (GSList *ext = extensions; ext; ext = g_slist_next(ext)) { char *base_name = (char *)base->data; @@ -683,10 +683,10 @@ char *get_icon_path_helper(GSList *themes, const char *icon_name, int size) // filename = directory/iconname.extension sprintf(file_name, "%s/%s%s", base_name, icon_name, extension); if (debug_icons) - fprintf(stderr, "Checking %s\n", file_name); + fprintf(stderr, "tint2: Checking %s\n", file_name); if (g_file_test(file_name, G_FILE_TEST_EXISTS)) { if (debug_icons) - fprintf(stderr, "Found %s\n", file_name); + fprintf(stderr, "tint2: Found %s\n", file_name); g_slist_free(extensions); return file_name; } else { @@ -724,7 +724,7 @@ char *get_icon_path_from_cache(IconThemeWrapper *wrapper, const char *icon_name, if (!g_file_test(value, G_FILE_TEST_EXISTS)) return NULL; - // fprintf(stderr, "Icon path found in cache: theme = %s, icon = %s, size = %d, path = %s\n", + // fprintf(stderr, "tint2: Icon path found in cache: theme = %s, icon = %s, size = %d, path = %s\n", // wrapper->icon_theme_name, icon_name, size, value); return strdup(value); @@ -781,14 +781,14 @@ char *get_icon_path(IconThemeWrapper *wrapper, const char *icon_name, int size, path = get_icon_path_helper(wrapper->themes, icon_name, size); if (path) { if (debug_icons) - fprintf(stderr, "Icon found: %s\n", path); + fprintf(stderr, "tint2: Icon found: %s\n", path); add_icon_path_to_cache(wrapper, icon_name, size, path); return path; } if (!use_fallbacks) goto notfound; - fprintf(stderr, YELLOW "Icon not found in default theme: %s" RESET "\n", icon_name); + fprintf(stderr, YELLOW "tint2: Icon not found in default theme: %s" RESET "\n", icon_name); load_fallbacks(wrapper); path = get_icon_path_helper(wrapper->themes_fallback, icon_name, size); @@ -798,7 +798,7 @@ char *get_icon_path(IconThemeWrapper *wrapper, const char *icon_name, int size, } notfound: - fprintf(stderr, RED "Could not find icon '%s', using default." RESET "\n", icon_name); + fprintf(stderr, RED "tint2: Could not find icon '%s', using default." RESET "\n", icon_name); path = get_icon_path_helper(wrapper->themes, DEFAULT_ICON, size); if (path) return path; diff --git a/src/launcher/launcher.c b/src/launcher/launcher.c index f36c234..cbef1ad 100644 --- a/src/launcher/launcher.c +++ b/src/launcher/launcher.c @@ -297,7 +297,7 @@ gboolean resize_launcher(void *obj) launcherIcon->y = posy; launcherIcon->x = posx; launcher_icon_on_change_layout(launcherIcon); - // fprintf(stderr, "launcher %d : %d,%d\n", i, posx, posy); + // fprintf(stderr, "tint2: launcher %d : %d,%d\n", i, posx, posy); if (panel_horizontal) { if (i % icons_per_column) { posy += launcher->icon_size + launcher->area.paddingx; @@ -385,7 +385,7 @@ void draw_launcher_icon(void *obj, cairo_t *c) void launcher_icon_dump_geometry(void *obj, int indent) { LauncherIcon *launcherIcon = (LauncherIcon *)obj; - fprintf(stderr, "%*sIcon: w = h = %d, name = %s\n", indent, "", launcherIcon->icon_size, launcherIcon->icon_name); + fprintf(stderr, "tint2: %*sIcon: w = h = %d, name = %s\n", indent, "", launcherIcon->icon_size, launcherIcon->icon_name); } Imlib_Image scale_icon(Imlib_Image original, int icon_size) @@ -545,7 +545,7 @@ void launcher_reload_icon_image(Launcher *launcher, LauncherIcon *launcherIcon) free_icon(original); free(launcherIcon->icon_path); launcherIcon->icon_path = new_icon_path; - // fprintf(stderr, "launcher.c %d: Using icon %s\n", __LINE__, launcherIcon->icon_path); + // fprintf(stderr, "tint2: launcher.c %d: Using icon %s\n", __LINE__, launcherIcon->icon_path); if (panel_config.mouse_effects) { launcherIcon->image_hover = adjust_icon(launcherIcon->image, diff --git a/src/launcher/xsettings-client.c b/src/launcher/xsettings-client.c index 405b8df..59057fa 100644 --- a/src/launcher/xsettings-client.c +++ b/src/launcher/xsettings-client.c @@ -48,7 +48,7 @@ void xsettings_notify_cb(const char *name, XSettingsAction action, XSettingsSett { if ((action == XSETTINGS_ACTION_NEW || action == XSETTINGS_ACTION_CHANGED) && name != NULL && setting != NULL) { if (strcmp(name, "Net/IconThemeName") == 0 && setting->type == XSETTINGS_TYPE_STRING) { - fprintf(stderr, "xsettings: %s = %s\n", name, setting->data.v_string); + fprintf(stderr, "tint2: xsettings: %s = %s\n", name, setting->data.v_string); if (icon_theme_name_xsettings) { if (strcmp(icon_theme_name_xsettings, setting->data.v_string) == 0) return; @@ -57,7 +57,7 @@ void xsettings_notify_cb(const char *name, XSettingsAction action, XSettingsSett icon_theme_name_xsettings = strdup(setting->data.v_string); default_icon_theme_changed(); } else if (strcmp(name, "Gtk/FontName") == 0 && setting->type == XSETTINGS_TYPE_STRING) { - fprintf(stderr, "xsettings: %s = %s\n", name, setting->data.v_string); + fprintf(stderr, "tint2: xsettings: %s = %s\n", name, setting->data.v_string); if (default_font) { if (strcmp(default_font, setting->data.v_string) == 0) return; @@ -191,7 +191,7 @@ static XSettingsList *parse_settings(unsigned char *data, size_t len) result = fetch_card8(&buffer, (CARD8 *)&buffer.byte_order); if (buffer.byte_order != MSBFirst && buffer.byte_order != LSBFirst) { - fprintf(stderr, "Invalid byte order %x in XSETTINGS property\n", buffer.byte_order); + fprintf(stderr, "tint2: Invalid byte order %x in XSETTINGS property\n", buffer.byte_order); result = XSETTINGS_FAILED; goto out; } @@ -312,13 +312,13 @@ out: if (result != XSETTINGS_SUCCESS) { switch (result) { case XSETTINGS_NO_MEM: - fprintf(stderr, "Out of memory reading XSETTINGS property\n"); + fprintf(stderr, "tint2: Out of memory reading XSETTINGS property\n"); break; case XSETTINGS_ACCESS: - fprintf(stderr, "Invalid XSETTINGS property (read off end)\n"); + fprintf(stderr, "tint2: Invalid XSETTINGS property (read off end)\n"); break; case XSETTINGS_DUPLICATE_ENTRY: - fprintf(stderr, "Duplicate XSETTINGS entry for '%s'\n", setting->name); + fprintf(stderr, "tint2: Duplicate XSETTINGS entry for '%s'\n", setting->name); case XSETTINGS_FAILED: case XSETTINGS_SUCCESS: case XSETTINGS_NO_ENTRY: @@ -365,7 +365,7 @@ static void read_settings(XSettingsClient *client) if (result == Success && type == server.atom._XSETTINGS_SETTINGS) { if (format != 8) { - fprintf(stderr, "Invalid format for XSETTINGS property %d", format); + fprintf(stderr, "tint2: Invalid format for XSETTINGS property %d", format); } else client->settings = parse_settings(data, n_items); XFree(data); @@ -420,7 +420,7 @@ XSettingsClient *xsettings_client_new(Display *display, check_manager_window(client); if (client->manager_window == None) { - fprintf(stderr, "No XSETTINGS manager, tint2 uses config option 'launcher_icon_theme'.\n"); + fprintf(stderr, "tint2: No XSETTINGS manager, tint2 uses config option 'launcher_icon_theme'.\n"); free(client); return NULL; } else { diff --git a/src/main.c b/src/main.c index b626316..8af7602 100644 --- a/src/main.c +++ b/src/main.c @@ -104,7 +104,7 @@ void handle_event_property_notify(XEvent *e) // Change name of desktops else if (at == server.atom._NET_DESKTOP_NAMES) { if (debug) - fprintf(stderr, "%s %d: win = root, atom = _NET_DESKTOP_NAMES\n", __FUNCTION__, __LINE__); + fprintf(stderr, "tint2: %s %d: win = root, atom = _NET_DESKTOP_NAMES\n", __FUNCTION__, __LINE__); update_desktop_names(); } // Change desktops @@ -112,7 +112,7 @@ void handle_event_property_notify(XEvent *e) at == server.atom._NET_DESKTOP_VIEWPORT || at == server.atom._NET_WORKAREA || at == server.atom._NET_CURRENT_DESKTOP) { if (debug) - fprintf(stderr, "%s %d: win = root, atom = ?? desktops changed\n", __FUNCTION__, __LINE__); + fprintf(stderr, "tint2: %s %d: win = root, atom = ?? desktops changed\n", __FUNCTION__, __LINE__); if (!taskbar_enabled) return; int old_num_desktops = server.num_desktops; @@ -202,7 +202,7 @@ void handle_event_property_notify(XEvent *e) // Window list else if (at == server.atom._NET_CLIENT_LIST) { if (debug) - fprintf(stderr, "%s %d: win = root, atom = _NET_CLIENT_LIST\n", __FUNCTION__, __LINE__); + fprintf(stderr, "tint2: %s %d: win = root, atom = _NET_CLIENT_LIST\n", __FUNCTION__, __LINE__); taskbar_refresh_tasklist(); update_all_taskbars_visibility(); schedule_panel_redraw(); @@ -210,12 +210,12 @@ void handle_event_property_notify(XEvent *e) // Change active else if (at == server.atom._NET_ACTIVE_WINDOW) { if (debug) - fprintf(stderr, "%s %d: win = root, atom = _NET_ACTIVE_WINDOW\n", __FUNCTION__, __LINE__); + fprintf(stderr, "tint2: %s %d: win = root, atom = _NET_ACTIVE_WINDOW\n", __FUNCTION__, __LINE__); reset_active_task(); schedule_panel_redraw(); } else if (at == server.atom._XROOTPMAP_ID || at == server.atom._XROOTMAP_ID) { if (debug) - fprintf(stderr, "%s %d: win = root, atom = _XROOTPMAP_ID\n", __FUNCTION__, __LINE__); + fprintf(stderr, "tint2: %s %d: win = root, atom = _XROOTPMAP_ID\n", __FUNCTION__, __LINE__); // change Wallpaper for (int i = 0; i < num_panels; i++) { set_panel_background(&panels[i]); @@ -243,7 +243,7 @@ void handle_event_property_notify(XEvent *e) } if (!task) { if (debug) - fprintf(stderr, "%s %d\n", __FUNCTION__, __LINE__); + fprintf(stderr, "tint2: %s %d\n", __FUNCTION__, __LINE__); if (at == server.atom._NET_WM_STATE) { // xfce4 sends _NET_WM_STATE after minimized to tray, so we need to check if window is mapped // if it is mapped and not set as skip_taskbar, we must add it to our task list @@ -256,7 +256,7 @@ void handle_event_property_notify(XEvent *e) } return; } - // fprintf(stderr, "atom root_win = %s, %s\n", XGetAtomName(server.display, at), task->title); + // fprintf(stderr, "tint2: atom root_win = %s, %s\n", XGetAtomName(server.display, at), task->title); // Window title changed if (at == server.atom._NET_WM_VISIBLE_NAME || at == server.atom._NET_WM_NAME || at == server.atom.WM_NAME) { @@ -277,7 +277,7 @@ void handle_event_property_notify(XEvent *e) Atom *atom_state = server_get_property(win, server.atom._NET_WM_STATE, XA_ATOM, &count); for (int j = 0; j < count; j++) { char *atom_state_name = XGetAtomName(server.display, atom_state[j]); - fprintf(stderr, "%s %d: _NET_WM_STATE = %s\n", __FUNCTION__, __LINE__, atom_state_name); + fprintf(stderr, "tint2: %s %d: _NET_WM_STATE = %s\n", __FUNCTION__, __LINE__, atom_state_name); XFree(atom_state_name); } XFree(atom_state); @@ -305,7 +305,7 @@ void handle_event_property_notify(XEvent *e) // Window desktop changed else if (at == server.atom._NET_WM_DESKTOP) { int desktop = get_window_desktop(win); - // fprintf(stderr, " Window desktop changed %d, %d\n", task->desktop, desktop); + // fprintf(stderr, "tint2: Window desktop changed %d, %d\n", task->desktop, desktop); // bug in windowmaker : send unecessary 'desktop changed' when focus changed if (desktop != task->desktop) { task_update_desktop(task); @@ -779,13 +779,13 @@ void tint2(int argc, char **argv, gboolean *restart) if (get_signal_pending()) { cleanup(); if (get_signal_pending() == SIGUSR1) { - fprintf(stderr, YELLOW "%s %d: restarting tint2..." RESET "\n", __FILE__, __LINE__); + fprintf(stderr, YELLOW "tint2: %s %d: restarting tint2..." RESET "\n", __FILE__, __LINE__); *restart = TRUE; return; } else if (get_signal_pending() == SIGUSR2) { - fprintf(stderr, YELLOW "%s %d: reexecuting tint2..." RESET "\n", __FILE__, __LINE__); + fprintf(stderr, YELLOW "tint2: %s %d: reexecuting tint2..." RESET "\n", __FILE__, __LINE__); if (execvp(argv[0], argv) == -1) { - fprintf(stderr, RED "%s %d: failed!" RESET "\n", __FILE__, __LINE__); + fprintf(stderr, RED "tint2: %s %d: failed!" RESET "\n", __FILE__, __LINE__); return; } } else { diff --git a/src/panel.c b/src/panel.c index 25287ab..a5063ab 100644 --- a/src/panel.c +++ b/src/panel.c @@ -177,11 +177,11 @@ void init_panel() { if (panel_config.monitor > (server.num_monitors - 1)) { // server.num_monitors minimum value is 1 (see get_monitors()) - fprintf(stderr, "warning : monitor not found. tint2 default to all monitors.\n"); + fprintf(stderr, "tint2: warning : monitor not found. tint2 default to all monitors.\n"); panel_config.monitor = 0; } - fprintf(stderr, "panel items: %s\n", panel_items_order); + fprintf(stderr, "tint2: panel items: %s\n", panel_items_order); icon_theme_wrapper = NULL; @@ -209,7 +209,7 @@ void init_panel() } fprintf(stderr, - "tint2 : nb monitors %d, nb monitors used %d, nb desktops %d\n", + "tint2: nb monitors %d, nb monitors used %d, nb desktops %d\n", server.num_monitors, num_panels, server.num_desktops); @@ -289,7 +289,7 @@ void init_panel() XGCValues gcv; server.gc = XCreateGC(server.display, p->main_win, 0, &gcv); } - // fprintf(stderr, "panel %d : %d, %d, %d, %d\n", i, p->posx, p->posy, p->area.width, p->area.height); + // fprintf(stderr, "tint2: panel %d : %d, %d, %d, %d\n", i, p->posx, p->posy, p->area.width, p->area.height); set_panel_properties(p); set_panel_background(p); if (!snapshot_path) { @@ -322,7 +322,7 @@ void panel_compute_size(Panel *panel) if (panel->fractional_height) panel->area.height = (server.monitors[panel->monitor].height - panel->marginy) * panel->area.height / 100; if (panel->area.bg->border.radius > panel->area.height / 2) { - fprintf(stderr, "panel_background_id rounded is too big... please fix your tint2rc\n"); + fprintf(stderr, "tint2: panel_background_id rounded is too big... please fix your tint2rc\n"); g_array_append_val(backgrounds, *panel->area.bg); panel->area.bg = &g_array_index(backgrounds, Background, backgrounds->len - 1); panel->area.bg->border.radius = panel->area.height / 2; @@ -348,7 +348,7 @@ void panel_compute_size(Panel *panel) panel->area.width = old_panel_height; if (panel->area.bg->border.radius > panel->area.width / 2) { - fprintf(stderr, "panel_background_id rounded is too big... please fix your tint2rc\n"); + fprintf(stderr, "tint2: panel_background_id rounded is too big... please fix your tint2rc\n"); g_array_append_val(backgrounds, *panel->area.bg); panel->area.bg = &g_array_index(backgrounds, Background, backgrounds->len - 1); panel->area.bg->border.radius = panel->area.width / 2; @@ -401,7 +401,7 @@ void panel_compute_position(Panel *panel) panel->hidden_width = panel->area.width - diff; panel->hidden_height = panel->area.height; } - // fprintf(stderr, "panel : posx %d, posy %d, width %d, height %d\n", panel->posx, panel->posy, panel->area.width, + // fprintf(stderr, "tint2: panel : posx %d, posy %d, width %d, height %d\n", panel->posx, panel->posy, panel->area.width, // panel->area.height); } @@ -416,7 +416,7 @@ gboolean resize_panel(void *obj) Panel *panel = (Panel *)obj; relayout_with_constraint(&panel->area, 0); - // fprintf(stderr, "resize_panel\n"); + // fprintf(stderr, "tint2: resize_panel\n"); if (taskbar_mode != MULTI_DESKTOP && taskbar_enabled) { // propagate width/height on hidden taskbar int width = panel->taskbar[server.desktop].area.width; @@ -1146,7 +1146,7 @@ void _schedule_panel_redraw(const char *file, const char *function, const int li { panel_refresh = TRUE; if (debug_fps) { - fprintf(stderr, YELLOW "%s %s %d: triggering panel redraw" RESET "\n", file, function, line); + fprintf(stderr, YELLOW "tint2: %s %s %d: triggering panel redraw" RESET "\n", file, function, line); } } diff --git a/src/server.c b/src/server.c index b021281..a2daacd 100644 --- a/src/server.c +++ b/src/server.c @@ -162,10 +162,10 @@ struct Property read_property(Display *disp, Window w, Atom property) read_bytes *= 2; } while (bytes_after != 0); - fprintf(stderr, "DnD %s:%d: Property:\n", __FILE__, __LINE__); - fprintf(stderr, "DnD %s:%d: Actual type: %s\n", __FILE__, __LINE__, GetAtomName(disp, actual_type)); - fprintf(stderr, "DnD %s:%d: Actual format: %d\n", __FILE__, __LINE__, actual_format); - fprintf(stderr, "DnD %s:%d: Number of items: %lu\n", __FILE__, __LINE__, nitems); + fprintf(stderr, "tint2: DnD %s:%d: Property:\n", __FILE__, __LINE__); + fprintf(stderr, "tint2: DnD %s:%d: Actual type: %s\n", __FILE__, __LINE__, GetAtomName(disp, actual_type)); + fprintf(stderr, "tint2: DnD %s:%d: Actual format: %d\n", __FILE__, __LINE__, actual_format); + fprintf(stderr, "tint2: DnD %s:%d: Number of items: %lu\n", __FILE__, __LINE__, nitems); Property p; p.data = ret; @@ -185,7 +185,7 @@ Atom pick_target_from_list(Display *disp, Atom *atom_list, int nitems) int i; for (i = 0; i < nitems; i++) { const char *atom_name = GetAtomName(disp, atom_list[i]); - fprintf(stderr, "DnD %s:%d: Type %d = %s\n", __FILE__, __LINE__, i, atom_name); + fprintf(stderr, "tint2: DnD %s:%d: Type %d = %s\n", __FILE__, __LINE__, i, atom_name); // See if this data type is allowed and of higher priority (closer to zero) // than the present one. @@ -365,7 +365,7 @@ void get_root_pixmap() server.root_pmap = ret; if (server.root_pmap == None) { - fprintf(stderr, "tint2 : pixmap background detection failed\n"); + fprintf(stderr, "tint2: pixmap background detection failed\n"); } else { XGCValues gcv; gcv.ts_x_origin = 0; @@ -425,14 +425,14 @@ void get_monitors() if (res && res->ncrtc >= num_monitors) { // use xrandr to identify monitors (does not work with proprietery nvidia drivers) - fprintf(stderr, "xRandr: Found crtc's: %d\n", res->ncrtc); + fprintf(stderr, "tint2: xRandr: Found crtc's: %d\n", res->ncrtc); server.monitors = calloc(res->ncrtc, sizeof(Monitor)); num_monitors = 0; for (int i = 0; i < res->ncrtc; ++i) { XRRCrtcInfo *crtc_info = XRRGetCrtcInfo(server.display, res, res->crtcs[i]); // Ignore empty crtc if (!crtc_info->width || !crtc_info->height) { - fprintf(stderr, "xRandr: crtc %d seems disabled\n", i); + fprintf(stderr, "tint2: xRandr: crtc %d seems disabled\n", i); XRRFreeCrtcInfo(crtc_info); continue; } @@ -445,7 +445,7 @@ void get_monitors() server.monitors[i_monitor].names = calloc((crtc_info->noutput + 1), sizeof(gchar *)); for (int j = 0; j < crtc_info->noutput; ++j) { XRROutputInfo *output_info = XRRGetOutputInfo(server.display, res, crtc_info->outputs[j]); - fprintf(stderr, "xRandr: Linking output %s with crtc %d\n", output_info->name, i); + fprintf(stderr, "tint2: xRandr: Linking output %s with crtc %d\n", output_info->name, i); server.monitors[i_monitor].names[j] = g_strdup(output_info->name); XRRFreeOutputInfo(output_info); server.monitors[i_monitor].primary = crtc_info->outputs[j] == primary_output; @@ -502,7 +502,7 @@ void get_monitors() void print_monitors() { - fprintf(stderr, "Number of monitors: %d\n", server.num_monitors); + fprintf(stderr, "tint2: Number of monitors: %d\n", server.num_monitors); for (int i = 0; i < server.num_monitors; i++) { fprintf(stderr, "Monitor %d: x = %d, y = %d, w = %d, h = %d\n", @@ -624,10 +624,10 @@ int get_current_desktop() int ncols = x_screen_width / work_area_width; - // fprintf(stderr, "\n"); - // fprintf(stderr, "Work area size: %d x %d\n", work_area_width, work_area_height); - // fprintf(stderr, "Viewport pos: %d x %d\n", viewport_x, viewport_y); - // fprintf(stderr, "Viewport i: %d\n", (viewport_y / work_area_height) * ncols + viewport_x / work_area_width); + // fprintf(stderr, "tint2: \n"); + // fprintf(stderr, "tint2: Work area size: %d x %d\n", work_area_width, work_area_height); + // fprintf(stderr, "tint2: Viewport pos: %d x %d\n", viewport_x, viewport_y); + // fprintf(stderr, "tint2: Viewport i: %d\n", (viewport_y / work_area_height) * ncols + viewport_x / work_area_width); int result = (viewport_y / work_area_height) * ncols + viewport_x / work_area_width; return MAX(0, MIN(server.num_desktops - 1, result)); @@ -658,7 +658,7 @@ void get_desktops() } if (server.num_desktops == 0) { server.num_desktops = 1; - fprintf(stderr, "warning : WM doesn't respect NETWM specs. tint2 default to 1 desktop.\n"); + fprintf(stderr, "tint2: warning : WM doesn't respect NETWM specs. tint2 default to 1 desktop.\n"); } } @@ -702,14 +702,14 @@ void server_init_visual() server.real_transparency = TRUE; server.depth = 32; - fprintf(stderr, "real transparency on... depth: %d\n", server.depth); + fprintf(stderr, "tint2: real transparency on... depth: %d\n", server.depth); server.colormap = XCreateColormap(server.display, server.root_win, visual, AllocNone); server.visual = visual; } else { // no composite manager or snapshot mode => fake transparency server.real_transparency = FALSE; server.depth = DefaultDepth(server.display, server.screen); - fprintf(stderr, "real transparency off.... depth: %d\n", server.depth); + fprintf(stderr, "tint2: real transparency off.... depth: %d\n", server.depth); server.colormap = DefaultColormap(server.display, server.screen); server.visual = DefaultVisual(server.display, server.screen); } @@ -732,7 +732,7 @@ void forward_click(XEvent *e) // and xfce doesn't open at all. e->xbutton.x = e->xbutton.x_root; e->xbutton.y = e->xbutton.y_root; - // fprintf(stderr, "**** %d, %d\n", e->xbutton.x, e->xbutton.y); + // fprintf(stderr, "tint2: **** %d, %d\n", e->xbutton.x, e->xbutton.y); // XSetInputFocus(server.display, e->xbutton.window, RevertToParent, e->xbutton.time); XSendEvent(server.display, e->xbutton.window, False, ButtonPressMask, e); } @@ -743,7 +743,7 @@ void handle_crash(const char *reason) char path[4096]; sprintf(path, "%s/.tint2-crash.log", get_home_dir()); int log_fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0600); - log_string(log_fd, RED "tint2 crashed, reason: "); + log_string(log_fd, RED "tint2: crashed, reason: "); log_string(log_fd, reason); log_string(log_fd, RESET "\n"); dump_backtrace(log_fd); @@ -768,7 +768,7 @@ void error_trap_push(SnDisplay *display, Display *xdisplay) void error_trap_pop(SnDisplay *display, Display *xdisplay) { if (error_trap_depth == 0) { - fprintf(stderr, "Error trap underflow!\n"); + fprintf(stderr, "tint2: Error trap underflow!\n"); return; } diff --git a/src/signals.c b/src/signals.c index 6431a14..478f326 100644 --- a/src/signals.c +++ b/src/signals.c @@ -125,7 +125,7 @@ void init_signals_postconfig() if (need_sigchld) { // Setup a handler for child termination if (pipe(sigchild_pipe) != 0) { - fprintf(stderr, "Creating pipe failed.\n"); + fprintf(stderr, "tint2: Creating pipe failed.\n"); } else { fcntl(sigchild_pipe[0], F_SETFL, O_NONBLOCK | fcntl(sigchild_pipe[0], F_GETFL)); fcntl(sigchild_pipe[1], F_SETFL, O_NONBLOCK | fcntl(sigchild_pipe[1], F_GETFL)); diff --git a/src/systray/systraybar.c b/src/systray/systraybar.c index f5dd2b9..8d94db5 100644 --- a/src/systray/systraybar.c +++ b/src/systray/systraybar.c @@ -114,10 +114,10 @@ void init_systray() return; systray_composited = !server.disable_transparency && server.visual32 && server.colormap32; - fprintf(stderr, "Systray composited rendering %s\n", systray_composited ? "on" : "off"); + fprintf(stderr, "tint2: Systray composited rendering %s\n", systray_composited ? "on" : "off"); if (!systray_composited) { - fprintf(stderr, "systray_asb forced to 100 0 0\n"); + fprintf(stderr, "tint2: systray_asb forced to 100 0 0\n"); systray.alpha = 100; systray.brightness = systray.saturation = 0; } @@ -184,7 +184,7 @@ int systray_compute_desired_size(void *obj) gboolean resize_systray(void *obj) { if (systray_profile) - fprintf(stderr, "[%f] %s:%d\n", profiling_get_time(), __FUNCTION__, __LINE__); + fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __FUNCTION__, __LINE__); int size; systray_compute_geometry(&size); @@ -227,7 +227,7 @@ gboolean resize_systray(void *obj) void draw_systray(void *obj, cairo_t *c) { if (systray_profile) - fprintf(stderr, BLUE "[%f] %s:%d" RESET "\n", profiling_get_time(), __FUNCTION__, __LINE__); + fprintf(stderr, BLUE "tint2: [%f] %s:%d" RESET "\n", profiling_get_time(), __FUNCTION__, __LINE__); if (systray_composited) { if (render_background) XFreePixmap(server.display, render_background); @@ -252,7 +252,7 @@ void systray_dump_geometry(void *obj, int indent) { Systray *tray = (Systray *)obj; - fprintf(stderr, "%*sIcons:\n", indent, ""); + fprintf(stderr, "tint2: %*sIcons:\n", indent, ""); indent += 2; for (GSList *l = tray->list_icons; l; l = l->next) { TrayWindow *traywin = (TrayWindow *)l->data; @@ -271,7 +271,7 @@ void systray_dump_geometry(void *obj, int indent) void on_change_systray(void *obj) { if (systray_profile) - fprintf(stderr, "[%f] %s:%d\n", profiling_get_time(), __FUNCTION__, __LINE__); + fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __FUNCTION__, __LINE__); if (systray.icons_per_column == 0 || systray.icons_per_row == 0) return; @@ -332,7 +332,7 @@ void on_change_systray(void *obj) unsigned int width, height, depth; Window root; if (!XGetGeometry(server.display, traywin->parent, &root, &xpos, &ypos, &width, &height, &border_width, &depth)) { - fprintf(stderr, RED "Couldn't get geometry of window!" RESET "\n"); + fprintf(stderr, RED "tint2: Couldn't get geometry of window!" RESET "\n"); } if (width != traywin->width || height != traywin->height || xpos != traywin->x || ypos != traywin->y) { if (systray_profile) @@ -358,7 +358,7 @@ void on_change_systray(void *obj) void start_net() { if (systray_profile) - fprintf(stderr, "[%f] %s:%d\n", profiling_get_time(), __FUNCTION__, __LINE__); + fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __FUNCTION__, __LINE__); if (net_sel_win) { // protocol already started if (!systray_enabled) @@ -395,11 +395,11 @@ void start_net() &bytes_after, &prop); - fprintf(stderr, RED "tint2 : another systray is running" RESET); + fprintf(stderr, RED "tint2: another systray is running, cannot use systray" RESET); if (ret == Success && prop) { pid = prop[1] * 256; pid += prop[0]; - fprintf(stderr, " pid=%d", pid); + fprintf(stderr, "tint2: pid=%d", pid); } fprintf(stderr, RESET "\n"); return; @@ -407,7 +407,7 @@ void start_net() // init systray protocol net_sel_win = XCreateSimpleWindow(server.display, server.root_win, -1, -1, 1, 1, 0, 0, 0); - fprintf(stderr, "systray window %ld\n", net_sel_win); + fprintf(stderr, "tint2: systray window %ld\n", net_sel_win); // v0.3 trayer specification. tint2 always horizontal. // Vertical panel will draw the systray horizontal. @@ -458,13 +458,13 @@ void start_net() XSetSelectionOwner(server.display, server.atom._NET_SYSTEM_TRAY_SCREEN, net_sel_win, CurrentTime); if (XGetSelectionOwner(server.display, server.atom._NET_SYSTEM_TRAY_SCREEN) != net_sel_win) { stop_net(); - fprintf(stderr, RED "tint2 : can't get systray manager" RESET "\n"); + fprintf(stderr, RED "tint2: cannot find systray manager" RESET "\n"); return; } - fprintf(stderr, GREEN "tint2 : systray started" RESET "\n"); + fprintf(stderr, GREEN "tint2: systray started" RESET "\n"); if (systray_profile) - fprintf(stderr, "[%f] %s:%d\n", profiling_get_time(), __FUNCTION__, __LINE__); + fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __FUNCTION__, __LINE__); XClientMessageEvent ev; ev.type = ClientMessage; ev.window = server.root_win; @@ -481,7 +481,7 @@ void start_net() void handle_systray_event(XClientMessageEvent *e) { if (systray_profile) - fprintf(stderr, "[%f] %s:%d\n", profiling_get_time(), __FUNCTION__, __LINE__); + fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __FUNCTION__, __LINE__); Window win; unsigned long opcode = e->data.l[1]; @@ -499,9 +499,9 @@ void handle_systray_event(XClientMessageEvent *e) default: if (opcode == server.atom._NET_SYSTEM_TRAY_MESSAGE_DATA) - fprintf(stderr, "message from dockapp: %s\n", e->data.b); + fprintf(stderr, "tint2: message from dockapp: %s\n", e->data.b); else - fprintf(stderr, RED "SYSTEM_TRAY : unknown message type" RESET "\n"); + fprintf(stderr, RED "tint2: SYSTEM_TRAY : unknown message type" RESET "\n"); break; } } @@ -509,7 +509,7 @@ void handle_systray_event(XClientMessageEvent *e) void stop_net() { if (systray_profile) - fprintf(stderr, "[%f] %s:%d\n", profiling_get_time(), __FUNCTION__, __LINE__); + fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __FUNCTION__, __LINE__); if (systray.list_icons) { // remove_icon change systray.list_icons while (systray.list_icons) @@ -529,10 +529,10 @@ gboolean error; int window_error_handler(Display *d, XErrorEvent *e) { if (systray_profile) - fprintf(stderr, RED "[%f] %s:%d" RESET "\n", profiling_get_time(), __FUNCTION__, __LINE__); + fprintf(stderr, RED "tint2: [%f] %s:%d" RESET "\n", profiling_get_time(), __FUNCTION__, __LINE__); error = TRUE; if (e->error_code != BadWindow) { - fprintf(stderr, RED "systray: error code %d" RESET "\n", e->error_code); + fprintf(stderr, RED "tint2: systray: error code %d" RESET "\n", e->error_code); } return 0; } @@ -564,18 +564,18 @@ static gint compare_traywindows(gconstpointer a, gconstpointer b) void print_icons() { - fprintf(stderr, "systray.list_icons: \n"); + fprintf(stderr, "tint2: systray.list_icons: \n"); for (GSList *l = systray.list_icons; l; l = l->next) { TrayWindow *t = l->data; - fprintf(stderr, "%s\n", t->name); + fprintf(stderr, "tint2: %s\n", t->name); } - fprintf(stderr, "systray.list_icons order: \n"); + fprintf(stderr, "tint2: systray.list_icons order: \n"); for (GSList *l = systray.list_icons; l; l = l->next) { if (l->next) { TrayWindow *t = l->data; TrayWindow *u = l->next->data; int cmp = compare_traywindows(t, u); - fprintf(stderr, "%s %s %s\n", t->name, cmp < 0 ? "<" : cmp == 0 ? "=" : ">", u->name); + fprintf(stderr, "tint2: %s %s %s\n", t->name, cmp < 0 ? "<" : cmp == 0 ? "=" : ">", u->name); } } } @@ -586,14 +586,14 @@ gboolean reject_icon(Window win) if (!systray_hide_name_regex) { systray_hide_name_regex = (regex_t *)calloc(1, sizeof(*systray_hide_name_regex)); if (regcomp(systray_hide_name_regex, systray_hide_name_filter, 0) != 0) { - fprintf(stderr, RED "Could not compile regex %s" RESET "\n", systray_hide_name_filter); + fprintf(stderr, RED "tint2: Could not compile regex %s" RESET "\n", systray_hide_name_filter); free_and_null(systray_hide_name_regex); return FALSE; } } char *name = get_window_name(win); if (regexec(systray_hide_name_regex, name, 0, NULL, 0) == 0) { - fprintf(stderr, GREEN "Filtering out systray icon '%s'" RESET "\n", name); + fprintf(stderr, GREEN "tint2: Filtering out systray icon '%s'" RESET "\n", name); return TRUE; } } @@ -623,7 +623,7 @@ gboolean add_icon(Window win) char *name = get_window_name(win); if (systray_profile) - fprintf(stderr, "[%f] %s:%d win = %lu (%s)\n", profiling_get_time(), __FUNCTION__, __LINE__, win, name); + fprintf(stderr, "tint2: [%f] %s:%d win = %lu (%s)\n", profiling_get_time(), __FUNCTION__, __LINE__, win, name); Panel *panel = systray.area.panel; // Get the process ID of the application that created the window @@ -655,7 +655,7 @@ gboolean add_icon(Window win) // Create the parent window that will embed the icon XWindowAttributes attr; if (systray_profile) - fprintf(stderr, "XGetWindowAttributes(server.display, win = %ld, &attr)\n", win); + fprintf(stderr, "tint2: XGetWindowAttributes(server.display, win = %ld, &attr)\n", win); if (XGetWindowAttributes(server.display, win, &attr) == False) { free(name); XSelectInput(server.display, win, NoEventMask); @@ -706,7 +706,7 @@ gboolean add_icon(Window win) } if (systray_profile) - fprintf(stderr, "XCreateWindow(...)\n"); + fprintf(stderr, "tint2: XCreateWindow(...)\n"); Window parent = XCreateWindow(server.display, panel->main_win, 0, @@ -743,12 +743,12 @@ gboolean add_icon(Window win) if (!panel->is_hidden) { if (systray_profile) - fprintf(stderr, "XMapRaised(server.display, traywin->parent)\n"); + fprintf(stderr, "tint2: XMapRaised(server.display, traywin->parent)\n"); XMapRaised(server.display, traywin->parent); } if (systray_profile) - fprintf(stderr, "[%f] %s:%d\n", profiling_get_time(), __FUNCTION__, __LINE__); + fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __FUNCTION__, __LINE__); // Resize and redraw the systray if (systray_profile) @@ -808,7 +808,7 @@ gboolean reparent_icon(TrayWindow *traywin) e.xclient.data.l[3] = traywin->parent; e.xclient.data.l[4] = 0; if (systray_profile) - fprintf(stderr, "XSendEvent(server.display, traywin->win, False, NoEventMask, &e)\n"); + fprintf(stderr, "tint2: XSendEvent(server.display, traywin->win, False, NoEventMask, &e)\n"); XSendEvent(server.display, traywin->win, False, NoEventMask, &e); } @@ -862,10 +862,10 @@ gboolean embed_icon(TrayWindow *traywin) // Redirect rendering when using compositing if (systray_composited) { if (systray_profile) - fprintf(stderr, "XDamageCreate(server.display, traywin->parent, XDamageReportRawRectangles)\n"); + fprintf(stderr, "tint2: XDamageCreate(server.display, traywin->parent, XDamageReportRawRectangles)\n"); traywin->damage = XDamageCreate(server.display, traywin->parent, XDamageReportRawRectangles); if (systray_profile) - fprintf(stderr, "XCompositeRedirectWindow(server.display, traywin->parent, CompositeRedirectManual)\n"); + fprintf(stderr, "tint2: XCompositeRedirectWindow(server.display, traywin->parent, CompositeRedirectManual)\n"); XCompositeRedirectWindow(server.display, traywin->parent, CompositeRedirectManual); } @@ -873,16 +873,16 @@ gboolean embed_icon(TrayWindow *traywin) // Make the icon visible if (systray_profile) - fprintf(stderr, "XMapWindow(server.display, traywin->win)\n"); + fprintf(stderr, "tint2: XMapWindow(server.display, traywin->win)\n"); XMapWindow(server.display, traywin->win); if (!panel->is_hidden) { if (systray_profile) - fprintf(stderr, "XMapRaised(server.display, traywin->parent)\n"); + fprintf(stderr, "tint2: XMapRaised(server.display, traywin->parent)\n"); XMapRaised(server.display, traywin->parent); } if (systray_profile) - fprintf(stderr, "XSync(server.display, False)\n"); + fprintf(stderr, "tint2: XSync(server.display, False)\n"); XSync(server.display, False); XSetErrorHandler(old); if (error != FALSE) { @@ -925,7 +925,7 @@ void remove_icon(TrayWindow *traywin) // remove from our list systray.list_icons = g_slist_remove(systray.list_icons, traywin); - fprintf(stderr, YELLOW "remove_icon: %lu (%s)" RESET "\n", traywin->win, traywin->name); + fprintf(stderr, YELLOW "tint2: remove_icon: %lu (%s)" RESET "\n", traywin->win, traywin->name); XSelectInput(server.display, traywin->win, NoEventMask); if (traywin->damage) @@ -1279,7 +1279,7 @@ void systray_render_icon_composited(void *t) } else if (traywin->depth == 32) { f = XRenderFindStandardFormat(server.display, PictStandardARGB32); } else { - fprintf(stderr, RED "Strange tray icon found with depth: %d" RESET "\n", traywin->depth); + fprintf(stderr, RED "tint2: Strange tray icon found with depth: %d" RESET "\n", traywin->depth); XFreePixmap(server.display, tmp_pmap); return; } @@ -1478,7 +1478,7 @@ void systray_render_icon(void *t) } if (systray_profile) - fprintf(stderr, "rendering tray icon\n"); + fprintf(stderr, "tint2: rendering tray icon\n"); if (systray_composited) { systray_render_icon_composited(traywin); @@ -1500,7 +1500,7 @@ void systray_render_icon(void *t) void refresh_systray_icons() { if (systray_profile) - fprintf(stderr, BLUE "[%f] %s:%d" RESET "\n", profiling_get_time(), __FUNCTION__, __LINE__); + fprintf(stderr, BLUE "tint2: [%f] %s:%d" RESET "\n", profiling_get_time(), __FUNCTION__, __LINE__); TrayWindow *traywin; GSList *l; for (l = systray.list_icons; l; l = l->next) { diff --git a/src/taskbar/task.c b/src/taskbar/task.c index 50149aa..75896dc 100644 --- a/src/taskbar/task.c +++ b/src/taskbar/task.c @@ -93,9 +93,9 @@ Task *add_task(Window win) (int)win, task_template.title ? task_template.title : "null"); - // fprintf(stderr, "%s %d: win = %ld, task = %s\n", __FUNCTION__, __LINE__, win, task_template.title ? + // fprintf(stderr, "tint2: %s %d: win = %ld, task = %s\n", __FUNCTION__, __LINE__, win, task_template.title ? // task_template.title : "??"); - // fprintf(stderr, "new task %s win %u: desktop %d, monitor %d\n", new_task.title, win, new_task.desktop, monitor); + // fprintf(stderr, "tint2: new task %s win %u: desktop %d, monitor %d\n", new_task.title, win, new_task.desktop, monitor); GPtrArray *task_buttons = g_ptr_array_new(); for (int j = 0; j < panels[monitor].num_desktops; j++) { @@ -118,7 +118,7 @@ Task *add_task(Window win) task_instance->win_h = task_template.win_h; task_instance->current_state = TASK_UNDEFINED; // to update the current state later in set_task_state... if (task_instance->desktop == ALL_DESKTOPS && server.desktop != j) { - // fprintf(stderr, "%s %d: win = %ld hiding task: another desktop\n", __FUNCTION__, __LINE__, win); + // fprintf(stderr, "tint2: %s %d: win = %ld hiding task: another desktop\n", __FUNCTION__, __LINE__, win); task_instance->area.on_screen = always_show_all_desktop_tasks; } task_instance->title = task_template.title; @@ -186,7 +186,7 @@ void remove_task(Task *task) if (!task) return; - // fprintf(stderr, "%s %d: win = %ld, task = %s\n", __FUNCTION__, __LINE__, task->win, task->title ? task->title : + // fprintf(stderr, "tint2: %s %d: win = %ld, task = %s\n", __FUNCTION__, __LINE__, task->win, task->title ? task->title : // "??"); if (taskbar_mode == MULTI_DESKTOP) { @@ -198,7 +198,7 @@ void remove_task(Task *task) // free title and icon just for the first task // even with task_on_all_desktop and with task_on_all_panel - // fprintf(stderr, "remove_task %s %d\n", task->title, task->desktop); + // fprintf(stderr, "tint2: remove_task %s %d\n", task->title, task->desktop); if (task->title) free(task->title); task_remove_icon(task); @@ -591,7 +591,7 @@ void reset_active_task() } Window w1 = get_active_window(); - // fprintf(stderr, "Change active task %ld\n", w1); + // fprintf(stderr, "tint2: Change active task %ld\n", w1); if (w1) { if (!get_task_buttons(w1)) { @@ -783,7 +783,7 @@ void task_handle_mouse_event(Task *task, MouseAction action) void task_update_desktop(Task *task) { - // fprintf(stderr, "%s %d:\n", __FUNCTION__, __LINE__); + // fprintf(stderr, "tint2: %s %d:\n", __FUNCTION__, __LINE__); Window win = task->win; remove_task(task); task = add_task(win); diff --git a/src/taskbar/taskbar.c b/src/taskbar/taskbar.c index 2dd1945..c6b59e3 100644 --- a/src/taskbar/taskbar.c +++ b/src/taskbar/taskbar.c @@ -267,7 +267,7 @@ void init_taskbar_panel(void *p) if (!panel->g_task.background[j]) panel->g_task.background[j] = &g_array_index(backgrounds, Background, 0); if (panel->g_task.background[j]->border.radius > panel->g_task.area.height / 2) { - fprintf(stderr, "task%sbackground_id has a too large rounded value. Please fix your tint2rc\n", + fprintf(stderr, "tint2: task%sbackground_id has a too large rounded value. Please fix your tint2rc\n", j == 0 ? "_" : j == 1 ? "_active_" : j == 2 ? "_iconified_" : "_urgent_"); g_array_append_val(backgrounds, *panel->g_task.background[j]); panel->g_task.background[j] = &g_array_index(backgrounds, Background, backgrounds->len - 1); @@ -385,7 +385,7 @@ void taskbar_refresh_tasklist() { if (!taskbar_enabled) return; - // fprintf(stderr, "%s %d:\n", __FUNCTION__, __LINE__); + // fprintf(stderr, "tint2: %s %d:\n", __FUNCTION__, __LINE__); int num_results; Window *win = server_get_property(server.root_win, server.atom._NET_CLIENT_LIST, XA_WINDOW, &num_results); @@ -432,7 +432,7 @@ gboolean resize_taskbar(void *obj) Taskbar *taskbar = (Taskbar *)obj; Panel *panel = (Panel *)taskbar->area.panel; - // fprintf(stderr, "resize_taskbar %d %d\n", taskbar->area.posx, taskbar->area.posy); + // fprintf(stderr, "tint2: resize_taskbar %d %d\n", taskbar->area.posx, taskbar->area.posy); if (panel_horizontal) { relayout_with_constraint(&taskbar->area, panel->g_task.maximum_width); diff --git a/src/tint2conf/properties.c b/src/tint2conf/properties.c index dc6630a..0db8bcb 100644 --- a/src/tint2conf/properties.c +++ b/src/tint2conf/properties.c @@ -1839,7 +1839,7 @@ void load_desktop_file(const char *file, gboolean selected) if (pixbuf) g_object_unref(pixbuf); } else { - fprintf(stderr, "Could not load %s\n", file); + fprintf(stderr, "tint2: Could not load %s\n", file); GdkPixbuf *pixbuf = load_icon(DEFAULT_ICON); GtkTreeIter iter; gtk_list_store_append(store, &iter); @@ -1897,7 +1897,7 @@ void load_desktop_entry(const char *file, GList **entries) DesktopEntry *entry = calloc(1, sizeof(DesktopEntry)); if (!read_desktop_file(file, entry)) - fprintf(stderr, "Could not load %s\n", file); + fprintf(stderr, "tint2: Could not load %s\n", file); if (entry->hidden_from_menus) { free(entry); return; @@ -2480,7 +2480,7 @@ void create_launcher(GtkWidget *parent, GtkWindow *window) change_paragraph(parent); - fprintf(stderr, "Loading icon themes\n"); + fprintf(stderr, "tint2: Loading icon themes\n"); GList *themes = NULL; const GSList *location; for (location = get_icon_locations(); location; location = g_slist_next(location)) { @@ -2509,9 +2509,9 @@ void create_launcher(GtkWidget *parent, GtkWindow *window) free_icon_theme((IconTheme *)l->data); } g_list_free(themes); - fprintf(stderr, "Icon themes loaded\n"); + fprintf(stderr, "tint2: Icon themes loaded\n"); - fprintf(stderr, "Loading .desktop files\n"); + fprintf(stderr, "tint2: Loading .desktop files\n"); GList *entries = NULL; for (location = get_apps_locations(); location; location = g_slist_next(location)) { const gchar *path = (gchar *)location->data; @@ -2528,7 +2528,7 @@ void create_launcher(GtkWidget *parent, GtkWindow *window) icon_theme_changed(window); load_icons(launcher_apps); load_icons(all_apps); - fprintf(stderr, "Desktop files loaded\n"); + fprintf(stderr, "tint2: Desktop files loaded\n"); } void create_taskbar(GtkWidget *parent) diff --git a/src/tint2conf/properties_rw.c b/src/tint2conf/properties_rw.c index b4e9729..4246170 100644 --- a/src/tint2conf/properties_rw.c +++ b/src/tint2conf/properties_rw.c @@ -981,7 +981,7 @@ unsigned short checksum_txt(FILE *f) void config_save_file(const char *path) { - fprintf(stderr, "config_save_file : %s\n", path); + fprintf(stderr, "tint2: config_save_file : %s\n", path); FILE *fp; if ((fp = fopen(path, "w+t")) == NULL) diff --git a/src/tracing.c b/src/tracing.c index f202b99..ecb4d79 100644 --- a/src/tracing.c +++ b/src/tracing.c @@ -100,7 +100,7 @@ void print_tracing_events() if (e->enter) { // Push a new function on the stack for (int d = 0; d < depth; d++) - fprintf(stderr, " "); + fprintf(stderr, "tint2: "); char *name = addr2name(e->address); char *caller = addr2name(e->caller); fprintf(stderr, @@ -116,7 +116,7 @@ void print_tracing_events() if (old->address == e->address) { depth--; for (int d = 0; d < depth; d++) - fprintf(stderr, " "); + fprintf(stderr, "tint2: "); char *name = addr2name(e->address); double duration = (e->time - old->time) * 1.0e3; fprintf(stderr, @@ -124,13 +124,13 @@ void print_tracing_events() name, duration); if (duration >= 1.0) { - fprintf(stderr, YELLOW " "); + fprintf(stderr, YELLOW "tint2: "); for (int d = 0; d < duration; d++) { - fprintf(stderr, "#"); + fprintf(stderr, "tint2: #"); } fprintf(stderr, RESET); } - fprintf(stderr, "\n"); + fprintf(stderr, "tint2: \n"); free(name); stack = g_list_delete_link(stack, g_list_last(stack)); } @@ -141,7 +141,7 @@ void print_tracing_events() TracingEvent *old = (TracingEvent *)g_list_last(stack)->data; depth--; for (int d = 0; d < depth; d++) - fprintf(stderr, " "); + fprintf(stderr, "tint2: "); char *name = addr2name(old->address); double duration = (now - old->time) * 1.0e3; fprintf(stderr, @@ -149,13 +149,13 @@ void print_tracing_events() name, duration); if (duration >= 1.0) { - fprintf(stderr, YELLOW " "); + fprintf(stderr, YELLOW "tint2: "); for (int d = 0; d < duration; d++) { - fprintf(stderr, "#"); + fprintf(stderr, "tint2: #"); } fprintf(stderr, RESET); } - fprintf(stderr, "\n"); + fprintf(stderr, "tint2: \n"); free(name); stack = g_list_delete_link(stack, g_list_last(stack)); } diff --git a/src/util/area.c b/src/util/area.c index 48c4d64..38a9fa1 100644 --- a/src/util/area.c +++ b/src/util/area.c @@ -224,7 +224,7 @@ int compute_desired_size(Area *a) if (a->_compute_desired_size) return a->_compute_desired_size(a); if (a->size_mode == LAYOUT_FIXED) - fprintf(stderr, YELLOW "Area %s does not set desired size!" RESET "\n", a->name); + fprintf(stderr, YELLOW "tint2: Area %s does not set desired size!" RESET "\n", a->name); return container_compute_desired_size(a); } @@ -385,7 +385,7 @@ void draw_tree(Area *a) a->posx, a->posy); else - fprintf(stderr, RED "%s %d: area %s has no pixmap!!!" RESET "\n", __FILE__, __LINE__, a->name); + fprintf(stderr, RED "tint2: %s %d: area %s has no pixmap!!!" RESET "\n", __FILE__, __LINE__, a->name); for (GList *l = a->children; l; l = l->next) draw_tree((Area *)l->data); @@ -843,10 +843,10 @@ int top_bottom_bg_border_width(Background *bg) void area_dump_geometry(Area *area, int indent) { - fprintf(stderr, "%*s%s:\n", indent, "", area->name); + fprintf(stderr, "tint2: %*s%s:\n", indent, "", area->name); indent += 2; if (!area->on_screen) { - fprintf(stderr, "%*shidden\n", indent, ""); + fprintf(stderr, "tint2: %*shidden\n", indent, ""); return; } fprintf(stderr, @@ -876,7 +876,7 @@ void area_dump_geometry(Area *area, int indent) if (area->_dump_geometry) area->_dump_geometry(area, indent); if (area->children) { - fprintf(stderr, "%*sChildren:\n", indent, ""); + fprintf(stderr, "tint2: %*sChildren:\n", indent, ""); indent += 2; for (GList *l = area->children; l; l = l->next) area_dump_geometry((Area *)l->data, indent); @@ -1132,7 +1132,7 @@ void free_gradient_instance(GradientInstance *gi) void instantiate_area_gradients(Area *area) { if (debug_gradients) - fprintf(stderr, "Initializing gradients for area %s\n", area->name); + fprintf(stderr, "tint2: Initializing gradients for area %s\n", area->name); for (int i = 0; i < MOUSE_STATE_COUNT; i++) { g_assert_null(area->gradient_instances_by_state[i]); GradientClass *g = area->bg->gradients[i]; @@ -1147,7 +1147,7 @@ void instantiate_area_gradients(Area *area) void free_area_gradient_instances(Area *area) { if (debug_gradients) - fprintf(stderr, "Freeing gradients for area %s\n", area->name); + fprintf(stderr, "tint2: Freeing gradients for area %s\n", area->name); for (int i = 0; i < MOUSE_STATE_COUNT; i++) { for (GList *l = area->gradient_instances_by_state[i]; l; l = l->next) { GradientInstance *gi = (GradientInstance *)l->data; diff --git a/src/util/cache.c b/src/util/cache.c index c30c88c..e5a429a 100644 --- a/src/util/cache.c +++ b/src/util/cache.c @@ -117,14 +117,14 @@ void save_cache(Cache *cache, const gchar *cache_path) fd = open(cache_path, O_RDONLY | O_CREAT, 0600); } if (fd == -1) { - fprintf(stderr, RED "Could not save icon theme cache!" RESET "\n"); + fprintf(stderr, RED "tint2: Could not save icon theme cache!" RESET "\n"); return; } flock(fd, LOCK_EX); FILE *f = fopen(cache_path, "w"); if (!f) { - fprintf(stderr, RED "Could not save icon theme cache!" RESET "\n"); + fprintf(stderr, RED "tint2: Could not save icon theme cache!" RESET "\n"); goto unlock; } g_hash_table_foreach(cache->_table, write_cache_line, f); diff --git a/src/util/common.c b/src/util/common.c index 3bb9611..da2091b 100644 --- a/src/util/common.c +++ b/src/util/common.c @@ -223,7 +223,7 @@ void copy_file(const char *path_src, const char *path_dest) while ((nb = fread(buffer, 1, sizeof(buffer), file_src)) > 0) { if (nb != fwrite(buffer, 1, nb, file_dest)) { - fprintf(stderr, "Error while copying file %s to %s\n", path_src, path_dest); + fprintf(stderr, "tint2: Error while copying file %s to %s\n", path_src, path_dest); } } @@ -373,7 +373,7 @@ pid_t tint_exec(const char *command, const char *dir, const char *tooltip, Time pid_t pid; pid = fork(); if (pid < 0) { - fprintf(stderr, "Could not fork\n"); + fprintf(stderr, "tint2: Could not fork\n"); } else if (pid == 0) { // Child process #if HAVE_SN @@ -388,7 +388,7 @@ pid_t tint_exec(const char *command, const char *dir, const char *tooltip, Time chdir(dir); close_all_fds(); execl("/bin/sh", "/bin/sh", "-c", command, NULL); - fprintf(stderr, "Failed to execlp %s\n", command); + fprintf(stderr, "tint2: Failed to execlp %s\n", command); #if HAVE_SN if (startup_notifications && time) { sn_launcher_context_unref(ctx); @@ -776,7 +776,7 @@ Imlib_Image load_image(const char *path, int cached) RsvgHandle *svg = rsvg_handle_new_from_file(path, &err); if (err != NULL) { - fprintf(stderr, "Could not load svg image!: %s", err->message); + fprintf(stderr, "tint2: Could not load svg image!: %s", err->message); g_error_free(err); } else { GdkPixbuf *pixbuf = rsvg_handle_get_pixbuf(svg); @@ -931,7 +931,7 @@ void get_text_size2(const PangoFontDescription *font, *height_ink = rect_ink.height; *height = rect.height; *width = rect.width; - // fprintf(stderr, "dimension : %d - %d\n", rect_ink.height, rect.height); + // fprintf(stderr, "tint2: dimension : %d - %d\n", rect_ink.height, rect.height); g_object_unref(layout); cairo_destroy(c); diff --git a/src/util/fps_distribution.c b/src/util/fps_distribution.c index bd666c5..953f3de 100644 --- a/src/util/fps_distribution.c +++ b/src/util/fps_distribution.c @@ -65,7 +65,7 @@ void sample_fps(double fps) } } } - // fprintf(stderr, "fps = %.0f => i = %d\n", fps, i); + // fprintf(stderr, "tint2: fps = %.0f => i = %d\n", fps, i); fps_distribution[i] += 1.; fps_distribution[0] += 1.; } @@ -85,7 +85,7 @@ void fps_compute_stats(double *low, double *median, double *high, double *sample double value = (i < 60) ? i : (i < 74) ? (60 + (i - 60) * 10) : (i < 146) ? (200 + (i - 74) * 25) : (i < 165) ? (2000 + (i - 146) * 1000) : 20000; - // fprintf(stderr, "%6.0f (i = %3d) : %.0f | ", value, i, (double)fps_distribution[i]); + // fprintf(stderr, "tint2: %6.0f (i = %3d) : %.0f | ", value, i, (double)fps_distribution[i]); cum += fps_distribution[i]; if (*low < 0 && cum >= cum_low) *low = value; diff --git a/src/util/gradient.c b/src/util/gradient.c index 98ad04e..74f6996 100644 --- a/src/util/gradient.c +++ b/src/util/gradient.c @@ -40,7 +40,7 @@ GradientType gradient_type_from_string(const char *str) return GRADIENT_VERTICAL; if (g_str_equal(str, "radial")) return GRADIENT_CENTERED; - fprintf(stderr, RED "Invalid gradient type: %s" RESET "\n", str); + fprintf(stderr, RED "tint2: Invalid gradient type: %s" RESET "\n", str); return GRADIENT_VERTICAL; } diff --git a/src/util/uevent.c b/src/util/uevent.c index a8084af..1d0d11e 100644 --- a/src/util/uevent.c +++ b/src/util/uevent.c @@ -184,17 +184,17 @@ int uevent_init() /* open socket */ uevent_fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); if (uevent_fd < 0) { - fprintf(stderr, "Error: socket open failed\n"); + fprintf(stderr, "tint2: Error: socket open failed\n"); return -1; } /* Listen to netlink socket */ if (bind(uevent_fd, (void *)&nls, sizeof(struct sockaddr_nl))) { - fprintf(stderr, "Bind failed\n"); + fprintf(stderr, "tint2: Bind failed\n"); return -1; } - fprintf(stderr, "Kernel uevent interface initialized...\n"); + fprintf(stderr, "tint2: Kernel uevent interface initialized...\n"); return uevent_fd; } diff --git a/src/util/window.c b/src/util/window.c index 9f9175f..861cd0b 100644 --- a/src/util/window.c +++ b/src/util/window.c @@ -157,7 +157,7 @@ int get_window_desktop(Window win) if (best_match < 0) best_match = 0; - // fprintf(stderr, "window %lx %s : viewport %d, (%d, %d)\n", win, get_task(win) ? get_task(win)->title : "??", + // fprintf(stderr, "tint2: window %lx %s : viewport %d, (%d, %d)\n", win, get_task(win) ? get_task(win)->title : "??", // best_match+1, x, y); return best_match; } @@ -185,7 +185,7 @@ int get_window_monitor(Window win) if (best_match < 0) best_match = 0; - // fprintf(stderr, "desktop %d, window %lx %s : monitor %d, (%d, %d)\n", 1 + get_current_desktop(), win, + // fprintf(stderr, "tint2: desktop %d, window %lx %s : monitor %d, (%d, %d)\n", 1 + get_current_desktop(), win, // get_task(win) ? get_task(win)->title : "??", best_match+1, x, y); return best_match; }