Taskbar: thumbnails (only print debug info if DEBUG_THUMBNAILS environment variable is set)
This commit is contained in:
parent
c0eaa8274f
commit
f11d30f076
6 changed files with 29 additions and 43 deletions
|
@ -93,6 +93,7 @@ void handle_env_vars()
|
|||
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");
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -105,10 +105,6 @@ Task *add_task(Window win)
|
|||
(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 *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, "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;
|
||||
|
@ -200,9 +195,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;
|
||||
panel->area.resize_needed = 1;
|
||||
|
@ -212,7 +204,6 @@ 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, "tint2: remove_task %s %d\n", task->title, task->desktop);
|
||||
if (task->title)
|
||||
free(task->title);
|
||||
if (task->thumbnail)
|
||||
|
@ -307,13 +298,6 @@ void task_update_icon(Task *task)
|
|||
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 @@ void task_update_icon(Task *task)
|
|||
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 @@ void reset_active_task()
|
|||
}
|
||||
|
||||
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 @@ void task_refresh_thumbnail(Task *task)
|
|||
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 @@ void task_refresh_thumbnail(Task *task)
|
|||
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_handle_mouse_event(Task *task, MouseAction action)
|
|||
|
||||
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);
|
||||
|
|
|
@ -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 @@ gboolean resize_taskbar(void *obj)
|
|||
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 @@ void taskbar_update_thumbnails(void *arg)
|
|||
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];
|
||||
|
|
|
@ -637,10 +637,12 @@ cairo_surface_t *get_window_thumbnail(Window win, int size)
|
|||
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 @@ cairo_surface_t *get_window_thumbnail(Window win, int size)
|
|||
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 @@ cairo_surface_t *get_window_thumbnail(Window win, int size)
|
|||
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)
|
||||
|
|
Loading…
Reference in a new issue