all repos — tint2 @ f11d30f07661d02411e08dd5251cbae275ee725b

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

Taskbar: thumbnails (only print debug info if DEBUG_THUMBNAILS environment variable is set)
o9000 mrovi9000@gmail.com
commit

f11d30f07661d02411e08dd5251cbae275ee725b

parent

c0eaa8274f8c9d5951a0f5e0889f79fdc033bc10

6 files changed, 29 insertions(+), 43 deletions(-)

jump to
M src/init.csrc/init.c

@@ -93,6 +93,7 @@ debug_icons = getenv("DEBUG_ICONS") != NULL;

debug_fps = getenv("DEBUG_FPS") != NULL; debug_frames = getenv("DEBUG_FRAMES") != NULL; debug_dnd = getenv("DEBUG_DND") != NULL; + debug_thumbnails = getenv("DEBUG_THUMBNAILS") != NULL; if (debug_fps) { init_fps_distribution(); char *s = getenv("TRACING_FPS_THRESHOLD");
M src/panel.csrc/panel.c

@@ -58,6 +58,7 @@ char *panel_window_name = NULL;

gboolean debug_geometry; gboolean debug_gradients; gboolean startup_notifications; +gboolean debug_thumbnails; gboolean panel_autohide; int panel_autohide_show_timeout;
M src/panel.hsrc/panel.h

@@ -94,6 +94,7 @@ extern gboolean debug_geometry;

extern gboolean debug_fps; extern double tracing_fps_threshold; extern gboolean debug_frames; +extern gboolean debug_thumbnails; typedef struct Panel { Area area;
M src/taskbar/task.csrc/taskbar/task.c

@@ -105,10 +105,6 @@ "Task %d %s",

(int)win, task_template.title ? task_template.title : "null"); - // fprintf(stderr, "tint2: %s %d: win = %ld, task = %s\n", __func__, __LINE__, win, task_template.title ? - // task_template.title : "??"); - // 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++) { if (task_template.desktop != ALL_DESKTOPS && task_template.desktop != j)

@@ -130,7 +126,6 @@ task_instance->win_w = task_template.win_w;

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, "tint2: %s %d: win = %ld hiding task: another desktop\n", __func__, __LINE__, win); task_instance->area.on_screen = always_show_all_desktop_tasks; } task_instance->title = task_template.title;

@@ -199,9 +194,6 @@ void remove_task(Task *task)

{ if (!task) return; - - // fprintf(stderr, "tint2: %s %d: win = %ld, task = %s\n", __func__, __LINE__, task->win, task->title ? task->title : - // "??"); if (taskbar_mode == MULTI_DESKTOP) { Panel *panel = task->area.panel;

@@ -212,7 +204,6 @@ Window win = task->win;

// free title and icon just for the first task // even with task_on_all_desktop and with task_on_all_panel - // fprintf(stderr, "tint2: remove_task %s %d\n", task->title, task->desktop); if (task->title) free(task->title); if (task->thumbnail)

@@ -307,13 +298,6 @@ DATA32 icon_data[w * h];

for (int j = 0; j < w * h; ++j) icon_data[j] = tmp_data[j]; img = imlib_create_image_using_copied_data(w, h, icon_data); - if (0 && img) - fprintf(stderr, - "%s: Got %dx%d icon via _NET_WM_ICON for %s\n", - __func__, - w, - h, - task->title ? task->title : "task"); } } XFree(data);

@@ -333,13 +317,6 @@

XGetGeometry(server.display, hints->icon_pixmap, &root, &icon_x, &icon_y, &w, &h, &border_width, &bpp); imlib_context_set_drawable(hints->icon_pixmap); img = imlib_create_image_from_drawable(hints->icon_mask, 0, 0, w, h, 0); - if (0 && img) - fprintf(stderr, - "%s: Got %dx%d pixmap icon via WM_HINTS for %s\n", - __func__, - w, - h, - task->title ? task->title : "task"); } XFree(hints); }

@@ -609,7 +586,6 @@ active_task = NULL;

} Window w1 = get_active_window(); - // fprintf(stderr, "tint2: Change active task %ld\n", w1); if (w1) { if (!get_task_buttons(w1)) {

@@ -630,7 +606,8 @@ return;

double now = get_time(); if (now - task->thumbnail_last_update < 0.1) return; - fprintf(stderr, "tint2: thumbnail for window: %s" RESET "\n", task->title ? task->title : ""); + if (debug_thumbnails) + fprintf(stderr, "tint2: thumbnail for window: %s" RESET "\n", task->title ? task->title : ""); cairo_surface_t *thumbnail = get_window_thumbnail(task->win, panel_config.g_task.thumbnail_width); if (!thumbnail) return;

@@ -638,7 +615,8 @@ if (task->thumbnail)

cairo_surface_destroy(task->thumbnail); task->thumbnail = thumbnail; task->thumbnail_last_update = get_time(); - fprintf(stderr, YELLOW "tint2: %s took %f ms (window: %s)" RESET "\n", __func__, 1000 * (task->thumbnail_last_update - now), task->title ? task->title : ""); + if (debug_thumbnails) + fprintf(stderr, YELLOW "tint2: %s took %f ms (window: %s)" RESET "\n", __func__, 1000 * (task->thumbnail_last_update - now), task->title ? task->title : ""); if (g_tooltip.mapped && (g_tooltip.area == &task->area)) { tooltip_update_contents_for(&task->area); tooltip_update();

@@ -833,7 +811,6 @@ }

void task_update_desktop(Task *task) { - // fprintf(stderr, "tint2: %s %d:\n", __func__, __LINE__); Window win = task->win; remove_task(task); task = add_task(win);
M src/taskbar/taskbar.csrc/taskbar/taskbar.c

@@ -376,7 +376,8 @@ void taskbar_start_thumbnail_timer(ThumbnailUpdateMode mode)

{ if (!panel_config.g_task.thumbnail_enabled) return; - fprintf(stderr, BLUE "tint2: taskbar_start_thumbnail_timer %s" RESET "\n", mode == THUMB_MODE_ACTIVE_WINDOW ? "active" : mode == THUMB_MODE_TOOLTIP_WINDOW ? "tooltip" : "all"); + if (debug_thumbnails) + fprintf(stderr, BLUE "tint2: taskbar_start_thumbnail_timer %s" RESET "\n", mode == THUMB_MODE_ACTIVE_WINDOW ? "active" : mode == THUMB_MODE_TOOLTIP_WINDOW ? "tooltip" : "all"); change_timeout(mode == THUMB_MODE_ALL ? &thumbnail_update_timer_all : mode == THUMB_MODE_ACTIVE_WINDOW ? &thumbnail_update_timer_active : &thumbnail_update_timer_tooltip, mode == THUMB_MODE_TOOLTIP_WINDOW ? 1000 : 500,

@@ -497,7 +498,6 @@ void taskbar_refresh_tasklist()

{ if (!taskbar_enabled) return; - // fprintf(stderr, "tint2: %s %d:\n", __func__, __LINE__); int num_results; Window *win = server_get_property(server.root_win, server.atom._NET_CLIENT_LIST, XA_WINDOW, &num_results);

@@ -551,7 +551,6 @@ {

Taskbar *taskbar = (Taskbar *)obj; Panel *panel = (Panel *)taskbar->area.panel; - // 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);

@@ -815,7 +814,8 @@ {

if (!panel_config.g_task.thumbnail_enabled) return; ThumbnailUpdateMode mode = (ThumbnailUpdateMode)(long)arg; - fprintf(stderr, BLUE "tint2: taskbar_update_thumbnails %s" RESET "\n", mode == THUMB_MODE_ACTIVE_WINDOW ? "active" : mode == THUMB_MODE_TOOLTIP_WINDOW ? "tooltip" : "all"); + if (debug_thumbnails) + fprintf(stderr, BLUE "tint2: taskbar_update_thumbnails %s" RESET "\n", mode == THUMB_MODE_ACTIVE_WINDOW ? "active" : mode == THUMB_MODE_TOOLTIP_WINDOW ? "tooltip" : "all"); double start_time = get_time(); for (int i = 0; i < num_panels; i++) { Panel *panel = &panels[i];
M src/util/window.csrc/util/window.c

@@ -637,10 +637,12 @@ if (image_surface && cairo_surface_is_blank(image_surface)) {

cairo_surface_destroy(image_surface); image_surface = NULL; } - if (!image_surface) - fprintf(stderr, YELLOW "tint2: XShmGetImage failed, trying slower method" RESET "\n"); - else - fprintf(stderr, "tint2: captured window using XShmGetImage\n"); + if (debug_thumbnails) { + if (!image_surface) + fprintf(stderr, YELLOW "tint2: XShmGetImage failed, trying slower method" RESET "\n"); + else + fprintf(stderr, "tint2: captured window using XShmGetImage\n"); + } } if (!image_surface) {

@@ -649,10 +651,12 @@ if (image_surface && cairo_surface_is_blank(image_surface)) {

cairo_surface_destroy(image_surface); image_surface = NULL; } - if (!image_surface) - fprintf(stderr, YELLOW "tint2: XGetImage failed, trying slower method" RESET "\n"); - else - fprintf(stderr, "tint2: captured window using XGetImage\n"); + if (debug_thumbnails) { + if (!image_surface) + fprintf(stderr, YELLOW "tint2: XGetImage failed, trying slower method" RESET "\n"); + else + fprintf(stderr, "tint2: captured window using XGetImage\n"); + } } if (!image_surface) {

@@ -661,10 +665,12 @@ if (image_surface && cairo_surface_is_blank(image_surface)) {

cairo_surface_destroy(image_surface); image_surface = NULL; } - if (!image_surface) - fprintf(stderr, YELLOW "tint2: capturing window failed" RESET "\n"); - else - fprintf(stderr, "tint2: captured window using cairo\n"); + if (debug_thumbnails) { + if (!image_surface) + fprintf(stderr, YELLOW "tint2: capturing window failed" RESET "\n"); + else + fprintf(stderr, "tint2: captured window using cairo\n"); + } } if (!image_surface)