all repos — tint2 @ ec7e9e18adb480af1a755975fc9e336731a7dcc8

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

Move terminal color reset code to the same line (issue #545)
o9000 mrovi9000@gmail.com
commit

ec7e9e18adb480af1a755975fc9e336731a7dcc8

parent

5966b198b65cebde6ae72d30ba499d204b54c46b

3 files changed, 41 insertions(+), 42 deletions(-)

jump to
M src/battery/linux.csrc/battery/linux.c

@@ -235,7 +235,7 @@ batteries = g_list_append(batteries, bat);

fprintf(stdout, "found battery \"%s\"\n", bat->name); } else { g_free(bat); - fprintf(stderr, RED "failed to initialize battery \"%s\"\n" RESET, entryname); + fprintf(stderr, RED "failed to initialize battery \"%s\"" RESET "\n", entryname); } }

@@ -249,7 +249,7 @@ mains = g_list_append(mains, ac);

fprintf(stdout, "found mains \"%s\"\n", ac->name); } else { g_free(ac); - fprintf(stderr, RED "failed to initialize mains \"%s\"\n" RESET, entryname); + fprintf(stderr, RED "failed to initialize mains \"%s\"" RESET "\n", entryname); } }
M src/systray/systraybar.csrc/systray/systraybar.c

@@ -156,7 +156,7 @@ continue;

count++; } if (systray_profile) - fprintf(stderr, BLUE "%s:%d number of icons = %d\n" RESET, __FUNCTION__, __LINE__, count); + fprintf(stderr, BLUE "%s:%d number of icons = %d" RESET "\n", __FUNCTION__, __LINE__, count); if (panel_horizontal) { int height = sysbar->area.height - 2 * sysbar->area.bg->border.width - 2 * sysbar->area.paddingy;

@@ -190,7 +190,7 @@

void draw_systray(void *obj, cairo_t *c) { if (systray_profile) - fprintf(stderr, BLUE "[%f] %s:%d\n" RESET, profiling_get_time(), __FUNCTION__, __LINE__); + fprintf(stderr, BLUE "[%f] %s:%d" RESET "\n", profiling_get_time(), __FUNCTION__, __LINE__); if (systray_composited) { if (render_background) XFreePixmap(server.display, render_background);

@@ -276,7 +276,7 @@ int xpos, ypos;

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!\n" RESET); + fprintf(stderr, RED "Couldn't get geometry of window!" RESET "\n"); } if (width != traywin->width || height != traywin->height || xpos != traywin->x || ypos != traywin->y) { if (systray_profile)

@@ -345,7 +345,7 @@ pid = prop[1] * 256;

pid += prop[0]; fprintf(stderr, " pid=%d", pid); } - fprintf(stderr, "\n" RESET); + fprintf(stderr, RESET "\n"); return; }

@@ -402,11 +402,11 @@

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\n" RESET); + fprintf(stderr, RED "tint2 : can't get systray manager" RESET "\n"); return; } - fprintf(stderr, GREEN "tint2 : systray started\n" RESET); + fprintf(stderr, GREEN "tint2 : systray started" RESET "\n"); if (systray_profile) fprintf(stderr, "[%f] %s:%d\n", profiling_get_time(), __FUNCTION__, __LINE__); XClientMessageEvent ev;

@@ -445,7 +445,7 @@ default:

if (opcode == server.atom._NET_SYSTEM_TRAY_MESSAGE_DATA) fprintf(stderr, "message from dockapp: %s\n", e->data.b); else - fprintf(stderr, RED "SYSTEM_TRAY : unknown message type\n" RESET); + fprintf(stderr, RED "SYSTEM_TRAY : unknown message type" RESET "\n"); break; } }

@@ -473,10 +473,10 @@ gboolean error;

int window_error_handler(Display *d, XErrorEvent *e) { if (systray_profile) - fprintf(stderr, RED "[%f] %s:%d\n" RESET, profiling_get_time(), __FUNCTION__, __LINE__); + fprintf(stderr, RED "[%f] %s:%d" RESET "\n", profiling_get_time(), __FUNCTION__, __LINE__); error = TRUE; if (e->error_code != BadWindow) { - fprintf(stderr, RED "systray: error code %d\n" RESET, e->error_code); + fprintf(stderr, RED "systray: error code %d" RESET "\n", e->error_code); } return 0; }

@@ -643,7 +643,7 @@ if (pid && ((TrayWindow *)l->data)->pid == pid && ((TrayWindow *)l->data)->empty) {

num_empty_same_pid++; fprintf(stderr, RED - "Removing tray icon %lu (%s) from misbehaving application with pid=%d (too many icons)\n" RESET, + "Removing tray icon %lu (%s) from misbehaving application with pid=%d (too many icons)" RESET "\n", ((TrayWindow *)l->data)->win, ((TrayWindow *)l->data)->name, pid);

@@ -666,7 +666,7 @@ unsigned long mask = 0;

XSetWindowAttributes set_attr; Visual *visual = server.visual; fprintf(stderr, - GREEN "add_icon: %lu (%s), pid %d, %d, visual %p, colormap %lu, depth %d, width %d, height %d\n" RESET, + GREEN "add_icon: %lu (%s), pid %d, %d, visual %p, colormap %lu, depth %d, width %d, height %d" RESET "\n", win, name, pid,

@@ -745,7 +745,7 @@ fprintf(stderr, "[%f] %s:%d\n", profiling_get_time(), __FUNCTION__, __LINE__);

// Resize and redraw the systray if (systray_profile) - fprintf(stderr, BLUE "[%f] %s:%d trigger resize & redraw\n" RESET, profiling_get_time(), __FUNCTION__, __LINE__); + fprintf(stderr, BLUE "[%f] %s:%d trigger resize & redraw" RESET "\n", profiling_get_time(), __FUNCTION__, __LINE__); systray.area.resize_needed = TRUE; schedule_redraw(&systray.area); panel->area.resize_needed = TRUE;

@@ -808,7 +808,7 @@ XSync(server.display, False);

XSetErrorHandler(old); if (error != FALSE) { fprintf(stderr, - RED "systray %d: cannot embed icon for window %lu (%s) parent %lu pid %d\n" RESET, + RED "systray %d: cannot embed icon for window %lu (%s) parent %lu pid %d" RESET "\n", __LINE__, traywin->win, traywin->name,

@@ -887,7 +887,7 @@ // Race can be triggered with PyGtk(2) apps.

// We could defer this for later (if we set PropertyChangeMask in XSelectInput we get notified) // but // for some reason it breaks transparency for Qt icons. So we don't. - // fprintf(stderr, RED "tint2: window refused embedding\n" RESET); + // fprintf(stderr, RED "tint2: window refused embedding" RESET "\n"); // remove_icon(traywin); // XFree(data); // return FALSE;

@@ -896,7 +896,7 @@ }

XFree(data); } } else { - fprintf(stderr, RED "tint2 : xembed error\n" RESET); + fprintf(stderr, RED "tint2 : xembed error" RESET "\n"); remove_icon(traywin); return FALSE; }

@@ -932,7 +932,7 @@ XSync(server.display, False);

XSetErrorHandler(old); if (error != FALSE) { fprintf(stderr, - RED "systray %d: cannot embed icon for window %lu (%s) parent %lu pid %d\n" RESET, + RED "systray %d: cannot embed icon for window %lu (%s) parent %lu pid %d" RESET "\n", __LINE__, traywin->win, traywin->name,

@@ -972,7 +972,7 @@ Panel *panel = systray.area.panel;

// remove from our list systray.list_icons = g_slist_remove(systray.list_icons, traywin); - fprintf(stderr, YELLOW "remove_icon: %lu (%s)\n" RESET, traywin->win, traywin->name); + fprintf(stderr, YELLOW "remove_icon: %lu (%s)" RESET "\n", traywin->win, traywin->name); XSelectInput(server.display, traywin->win, NoEventMask); if (traywin->damage)

@@ -1010,7 +1010,7 @@ hide(&systray.area);

// Resize and redraw the systray if (systray_profile) - fprintf(stderr, BLUE "[%f] %s:%d trigger resize & redraw\n" RESET, profiling_get_time(), __FUNCTION__, __LINE__); + fprintf(stderr, BLUE "[%f] %s:%d trigger resize & redraw" RESET "\n", profiling_get_time(), __FUNCTION__, __LINE__); systray.area.resize_needed = TRUE; schedule_redraw(&systray.area); panel->area.resize_needed = TRUE;

@@ -1111,7 +1111,7 @@ } else {

if (traywin->bad_size_counter == max_bad_resize_events) { traywin->bad_size_counter++; fprintf(stderr, - RED "Detected resize loop for tray icon %lu (%s), throttling resize events\n" RESET, + RED "Detected resize loop for tray icon %lu (%s), throttling resize events" RESET "\n", traywin->win, traywin->name); }

@@ -1131,7 +1131,7 @@ }

// Resize and redraw the systray if (systray_profile) - fprintf(stderr, BLUE "[%f] %s:%d trigger resize & redraw\n" RESET, profiling_get_time(), __FUNCTION__, __LINE__); + fprintf(stderr, BLUE "[%f] %s:%d trigger resize & redraw" RESET "\n", profiling_get_time(), __FUNCTION__, __LINE__); panel_refresh = TRUE; refresh_systray = 1; }

@@ -1196,7 +1196,7 @@ } else {

if (traywin->bad_size_counter == max_bad_resize_events) { traywin->bad_size_counter++; fprintf(stderr, - RED "Detected resize loop for tray icon %lu (%s), throttling resize events\n" RESET, + RED "Detected resize loop for tray icon %lu (%s), throttling resize events" RESET "\n", traywin->win, traywin->name); }

@@ -1216,7 +1216,7 @@ }

// Resize and redraw the systray if (systray_profile) - fprintf(stderr, BLUE "[%f] %s:%d trigger resize & redraw\n" RESET, profiling_get_time(), __FUNCTION__, __LINE__); + fprintf(stderr, BLUE "[%f] %s:%d trigger resize & redraw" RESET "\n", profiling_get_time(), __FUNCTION__, __LINE__); panel_refresh = TRUE; refresh_systray = 1; }

@@ -1278,7 +1278,7 @@ traywin->render_timeout =

add_timeout(min_refresh_period, 0, systray_render_icon_composited, traywin, &traywin->render_timeout); if (systray_profile) fprintf(stderr, - YELLOW "[%f] %s:%d win = %lu (%s) delaying rendering\n" RESET, + YELLOW "[%f] %s:%d win = %lu (%s) delaying rendering" RESET "\n", profiling_get_time(), __FUNCTION__, __LINE__,

@@ -1298,7 +1298,7 @@ traywin->render_timeout =

add_timeout(min_refresh_period, 0, systray_render_icon_composited, traywin, &traywin->render_timeout); if (systray_profile) fprintf(stderr, - YELLOW "[%f] %s:%d win = %lu (%s) delaying rendering\n" RESET, + YELLOW "[%f] %s:%d win = %lu (%s) delaying rendering" RESET "\n", profiling_get_time(), __FUNCTION__, __LINE__,

@@ -1330,7 +1330,7 @@ f = XRenderFindStandardFormat(server.display, PictStandardRGB24);

} else if (traywin->depth == 32) { f = XRenderFindStandardFormat(server.display, PictStandardARGB32); } else { - fprintf(stderr, RED "Strange tray icon found with depth: %d\n" RESET, traywin->depth); + fprintf(stderr, RED "Strange tray icon found with depth: %d" RESET "\n", traywin->depth); XFreePixmap(server.display, tmp_pmap); return; }

@@ -1434,7 +1434,7 @@ // print_icons();

// Resize and redraw the systray if (systray_profile) fprintf(stderr, - BLUE "[%f] %s:%d trigger resize & redraw\n" RESET, + BLUE "[%f] %s:%d trigger resize & redraw" RESET "\n", profiling_get_time(), __FUNCTION__, __LINE__);

@@ -1459,7 +1459,7 @@ return;

on_error: fprintf(stderr, - RED "systray %d: rendering error for icon %lu (%s) pid %d\n" RESET, + RED "systray %d: rendering error for icon %lu (%s) pid %d" RESET "\n", __LINE__, traywin->win, traywin->name,

@@ -1469,7 +1469,7 @@

on_systray_error: fprintf(stderr, RED "systray %d: rendering error for icon %lu (%s) pid %d. " - "Disabling compositing and restarting systray...\n" RESET, + "Disabling compositing and restarting systray..." RESET "\n", __LINE__, traywin->win, traywin->name,

@@ -1494,7 +1494,7 @@ traywin->name);

if (!traywin->reparented || !traywin->embedded) { if (systray_profile) fprintf(stderr, - YELLOW "[%f] %s:%d win = %lu (%s) delaying rendering\n" RESET, + YELLOW "[%f] %s:%d win = %lu (%s) delaying rendering" RESET "\n", profiling_get_time(), __FUNCTION__, __LINE__,

@@ -1532,7 +1532,7 @@ add_timeout(min_refresh_period, 0, systray_render_icon, traywin, &traywin->render_timeout);

systray_render_icon_from_image(traywin); if (systray_profile) fprintf(stderr, - YELLOW "[%f] %s:%d win = %lu (%s) delaying rendering\n" RESET, + YELLOW "[%f] %s:%d win = %lu (%s) delaying rendering" RESET "\n", profiling_get_time(), __FUNCTION__, __LINE__,

@@ -1568,7 +1568,7 @@

void refresh_systray_icons() { if (systray_profile) - fprintf(stderr, BLUE "[%f] %s:%d\n" RESET, profiling_get_time(), __FUNCTION__, __LINE__); + fprintf(stderr, BLUE "[%f] %s:%d" RESET "\n", profiling_get_time(), __FUNCTION__, __LINE__); TrayWindow *traywin; GSList *l; for (l = systray.list_icons; l; l = l->next) {
M src/tint.csrc/tint.c

@@ -191,7 +191,7 @@ }

void dump_backtrace(int log_fd) { - log_string(log_fd, YELLOW "\nBacktrace:\n"); + log_string(log_fd, "\n" YELLOW "Backtrace:" RESET "\n"); #ifdef ENABLE_LIBUNWIND unw_cursor_t cursor;

@@ -226,7 +226,6 @@ log_string(log_fd, "Backtrace support disabled at compile time.\n");

#endif #endif #endif - log_string(log_fd, RESET); } // sleep() returns early when signals arrive. This function does not.

@@ -251,7 +250,7 @@ log_string(log_fd, RED "tint2 crashed, reason: ");

log_string(log_fd, reason); log_string(log_fd, RESET "\n"); dump_backtrace(log_fd); - log_string(log_fd, RED "Please create a bug report with this log output.\n" RESET); + log_string(log_fd, RED "Please create a bug report with this log output." RESET "\n"); close(log_fd); }

@@ -1161,7 +1160,7 @@ }

// change in root window (xrandr) if (win == server.root_win) { - fprintf(stderr, YELLOW "%s %d: triggering tint2 restart due to configuration change in the root window\n" RESET, __FILE__, __LINE__); + fprintf(stderr, YELLOW "%s %d: triggering tint2 restart due to configuration change in the root window" RESET "\n", __FILE__, __LINE__); signal_pending = SIGUSR1; return; }

@@ -1477,7 +1476,7 @@

while (1) { if (panel_refresh) { if (systray_profile) - fprintf(stderr, BLUE "[%f] %s:%d redrawing panel\n" RESET, profiling_get_time(), __FUNCTION__, __LINE__); + fprintf(stderr, BLUE "[%f] %s:%d redrawing panel" RESET "\n", profiling_get_time(), __FUNCTION__, __LINE__); panel_refresh = FALSE; for (int i = 0; i < num_panels; i++) {

@@ -1704,7 +1703,7 @@

case DestroyNotify: if (e.xany.window == server.composite_manager) { // Stop real_transparency - fprintf(stderr, YELLOW "%s %d: triggering tint2 restart due to compositor shutdown\n" RESET, __FILE__, __LINE__); + fprintf(stderr, YELLOW "%s %d: triggering tint2 restart due to compositor shutdown" RESET "\n", __FILE__, __LINE__); signal_pending = SIGUSR1; break; }

@@ -1723,11 +1722,11 @@ XClientMessageEvent *ev = &e.xclient;

if (ev->data.l[1] == server.atom._NET_WM_CM_S0) { if (ev->data.l[2] == None) { // Stop real_transparency - fprintf(stderr, YELLOW "%s %d: triggering tint2 restart due to change in transparency\n" RESET, __FILE__, __LINE__); + fprintf(stderr, YELLOW "%s %d: triggering tint2 restart due to change in transparency" RESET "\n", __FILE__, __LINE__); signal_pending = SIGUSR1; } else { // Start real_transparency - fprintf(stderr, YELLOW "%s %d: triggering tint2 restart due to change in transparency\n" RESET, __FILE__, __LINE__); + fprintf(stderr, YELLOW "%s %d: triggering tint2 restart due to change in transparency" RESET "\n", __FILE__, __LINE__); signal_pending = SIGUSR1; } }

@@ -1881,7 +1880,7 @@

if (signal_pending) { cleanup(); if (signal_pending == SIGUSR1) { - fprintf(stderr, YELLOW "%s %d: restarting tint2...\n" RESET, __FILE__, __LINE__); + fprintf(stderr, YELLOW "%s %d: restarting tint2..." RESET "\n", __FILE__, __LINE__); // restart tint2 // SIGUSR1 used when : user's signal, composite manager stop/start or xrandr goto start;