all repos — tint2 @ 333ed7a20767f78ec2356b19fc0c5b879e6a4f23

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

Fix missing redraw
o9000 mrovi9000@gmail.com
commit

333ed7a20767f78ec2356b19fc0c5b879e6a4f23

parent

29b3c590cdb2fd7045a96b4cf5897add903cfa70

4 files changed, 52 insertions(+), 13 deletions(-)

jump to
M src/taskbar/task.csrc/taskbar/task.c

@@ -48,8 +48,10 @@ Task *add_task(Window win)

{ if (!win) return NULL; - if (window_is_hidden(win)) + if (window_is_hidden(win)) { + // fprintf(stderr, "%s %d: win = %ld not adding task: window hidden\n", __FUNCTION__, __LINE__, win); return NULL; + } XSelectInput(server.dsp, win, PropertyChangeMask | StructureNotifyMask); XFlush(server.dsp);

@@ -83,7 +85,8 @@ }

get_title(&task_template); get_icon(&task_template); - // printf("new task %s win %u: desktop %d, monitor %d\n", new_task.title, win, new_task.desktop, monitor); + // fprintf(stderr, "%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); GPtrArray *task_group = g_ptr_array_new(); for (int j = 0; j < panels[monitor].num_desktops; j++) {

@@ -103,7 +106,7 @@ task_instance->win_w = task_template.win_w;

task_instance->win_h = task_template.win_h; task_instance->current_state = -1; // to update the current state later in set_task_state... if (task_instance->desktop == ALL_DESKTOPS && server.desktop != j) { - // hide ALL_DESKTOPS task on non-current desktop + // fprintf(stderr, "%s %d: win = %ld hiding task: another desktop\n", __FUNCTION__, __LINE__, win); task_instance->area.on_screen = FALSE; } task_instance->title = task_template.title;

@@ -120,7 +123,6 @@ task_instance->icon_height = task_template.icon_height;

add_area(&task_instance->area, &taskbar->area); g_ptr_array_add(task_group, task_instance); - // printf("add_task panel %d, desktop %d, task %s\n", i, j, task_instance->title); } Window *key = calloc(1, sizeof(Window)); *key = task_template.win;

@@ -146,6 +148,8 @@ 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 : "??"); if (taskbar_mode == MULTI_DESKTOP) { Panel *panel = task->area.panel;
M src/taskbar/taskbar.csrc/taskbar/taskbar.c

@@ -308,6 +308,7 @@ void task_refresh_tasklist()

{ if (!taskbar_enabled) return; + // fprintf(stderr, "%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);
M src/tint.csrc/tint.c

@@ -719,6 +719,7 @@ }

void update_task_desktop(Task *task) { + // fprintf(stderr, "%s %d:\n", __FUNCTION__, __LINE__); Window win = task->win; remove_task(task); task = add_task(win);

@@ -728,6 +729,8 @@ }

void event_property_notify(XEvent *e) { + gboolean debug = FALSE; + int i; Window win = e->xproperty.window; Atom at = e->xproperty.atom;

@@ -742,6 +745,8 @@ }

// 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__); update_desktop_names(); } // Change desktops

@@ -750,6 +755,8 @@ at == server.atom._NET_DESKTOP_GEOMETRY ||

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__); if (!taskbar_enabled) return; int old_num_desktops = server.num_desktops;

@@ -835,14 +842,20 @@ }

} // 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__); task_refresh_tasklist(); panel_refresh = TRUE; } // 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__); reset_active_task(); panel_refresh = TRUE; } 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__); // change Wallpaper for (i = 0; i < num_panels; i++) { set_panel_background(&panels[i]);

@@ -851,11 +864,15 @@ panel_refresh = TRUE;

} } else { Task *task = task_get_task(win); - // printf("change win = %u, task = %p\n", win, task); + if (debug) { + char *atom_name = XGetAtomName(server.dsp, at); + fprintf(stderr, "%s %d: win = %ld, task = %s, atom = %s\n", __FUNCTION__, __LINE__, win, task ? (task->title ? task->title : "??") : "null", atom_name); + XFree(atom_name); + } if (!task) { - if (at != server.atom._NET_WM_STATE) - return; - else { + if (debug) + fprintf(stderr, "%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 XWindowAttributes wa;

@@ -863,11 +880,9 @@ XGetWindowAttributes(server.dsp, win, &wa);

if (wa.map_state == IsViewable && !window_is_skip_taskbar(win)) { if ((task = add_task(win))) panel_refresh = TRUE; - else - return; - } else - return; + } } + return; } // printf("atom root_win = %s, %s\n", XGetAtomName(server.dsp, at), task->title);

@@ -885,6 +900,16 @@ }

} // Demand attention else if (at == server.atom._NET_WM_STATE) { + if (debug) { + int count; + 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.dsp, atom_state[j]); + fprintf(stderr, "%s %d: _NET_WM_STATE = %s\n", __FUNCTION__, __LINE__, atom_state_name); + XFree(atom_state_name); + } + XFree(atom_state); + } if (window_is_urgent(win)) { add_urgent(task); }

@@ -939,6 +964,11 @@

void event_configure_notify(XEvent *e) { Window win = e->xconfigure.window; + + if (0) { + Task *task = task_get_task(win); + fprintf(stderr, "%s %d: win = %ld, task = %s\n", __FUNCTION__, __LINE__, win, task ? (task->title ? task->title : "??") : "null"); + } // change in root window (xrandr) if (win == server.root_win) {
M src/util/area.csrc/util/area.c

@@ -328,6 +328,7 @@ a->redraw_needed = TRUE;

for (GList *l = a->children; l; l = l->next) schedule_redraw((Area *)l->data); + panel_refresh = TRUE; } void hide(Area *a)

@@ -447,7 +448,8 @@ Area *parent = (Area *)area->parent;

if (parent) { parent->children = g_list_remove(parent->children, area); - parent->resize_needed = 1; + parent->resize_needed = TRUE; + panel_refresh = TRUE; schedule_redraw(parent); }

@@ -463,7 +465,9 @@

a->parent = parent; if (parent) { parent->children = g_list_append(parent->children, a); + parent->resize_needed = TRUE; schedule_redraw(parent); + panel_refresh = TRUE; } }