Fix missing redraw
This commit is contained in:
parent
29b3c590cd
commit
333ed7a207
4 changed files with 52 additions and 13 deletions
|
@ -48,8 +48,10 @@ Task *add_task(Window win)
|
||||||
{
|
{
|
||||||
if (!win)
|
if (!win)
|
||||||
return NULL;
|
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;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
XSelectInput(server.dsp, win, PropertyChangeMask | StructureNotifyMask);
|
XSelectInput(server.dsp, win, PropertyChangeMask | StructureNotifyMask);
|
||||||
XFlush(server.dsp);
|
XFlush(server.dsp);
|
||||||
|
@ -83,7 +85,8 @@ Task *add_task(Window win)
|
||||||
get_title(&task_template);
|
get_title(&task_template);
|
||||||
get_icon(&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();
|
GPtrArray *task_group = g_ptr_array_new();
|
||||||
for (int j = 0; j < panels[monitor].num_desktops; j++) {
|
for (int j = 0; j < panels[monitor].num_desktops; j++) {
|
||||||
|
@ -103,7 +106,7 @@ Task *add_task(Window win)
|
||||||
task_instance->win_h = task_template.win_h;
|
task_instance->win_h = task_template.win_h;
|
||||||
task_instance->current_state = -1; // to update the current state later in set_task_state...
|
task_instance->current_state = -1; // to update the current state later in set_task_state...
|
||||||
if (task_instance->desktop == ALL_DESKTOPS && server.desktop != j) {
|
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->area.on_screen = FALSE;
|
||||||
}
|
}
|
||||||
task_instance->title = task_template.title;
|
task_instance->title = task_template.title;
|
||||||
|
@ -120,7 +123,6 @@ Task *add_task(Window win)
|
||||||
|
|
||||||
add_area(&task_instance->area, &taskbar->area);
|
add_area(&task_instance->area, &taskbar->area);
|
||||||
g_ptr_array_add(task_group, task_instance);
|
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));
|
Window *key = calloc(1, sizeof(Window));
|
||||||
*key = task_template.win;
|
*key = task_template.win;
|
||||||
|
@ -147,6 +149,8 @@ void remove_task(Task *task)
|
||||||
if (!task)
|
if (!task)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// fprintf(stderr, "%s %d: win = %ld, task = %s\n", __FUNCTION__, __LINE__, task->win, task->title ? task->title : "??");
|
||||||
|
|
||||||
if (taskbar_mode == MULTI_DESKTOP) {
|
if (taskbar_mode == MULTI_DESKTOP) {
|
||||||
Panel *panel = task->area.panel;
|
Panel *panel = task->area.panel;
|
||||||
panel->area.resize_needed = 1;
|
panel->area.resize_needed = 1;
|
||||||
|
|
|
@ -308,6 +308,7 @@ void task_refresh_tasklist()
|
||||||
{
|
{
|
||||||
if (!taskbar_enabled)
|
if (!taskbar_enabled)
|
||||||
return;
|
return;
|
||||||
|
// fprintf(stderr, "%s %d:\n", __FUNCTION__, __LINE__);
|
||||||
|
|
||||||
int num_results;
|
int num_results;
|
||||||
Window *win = server_get_property(server.root_win, server.atom._NET_CLIENT_LIST, XA_WINDOW, &num_results);
|
Window *win = server_get_property(server.root_win, server.atom._NET_CLIENT_LIST, XA_WINDOW, &num_results);
|
||||||
|
|
46
src/tint.c
46
src/tint.c
|
@ -719,6 +719,7 @@ void update_desktop_names()
|
||||||
|
|
||||||
void update_task_desktop(Task *task)
|
void update_task_desktop(Task *task)
|
||||||
{
|
{
|
||||||
|
// fprintf(stderr, "%s %d:\n", __FUNCTION__, __LINE__);
|
||||||
Window win = task->win;
|
Window win = task->win;
|
||||||
remove_task(task);
|
remove_task(task);
|
||||||
task = add_task(win);
|
task = add_task(win);
|
||||||
|
@ -728,6 +729,8 @@ void update_task_desktop(Task *task)
|
||||||
|
|
||||||
void event_property_notify(XEvent *e)
|
void event_property_notify(XEvent *e)
|
||||||
{
|
{
|
||||||
|
gboolean debug = FALSE;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
Window win = e->xproperty.window;
|
Window win = e->xproperty.window;
|
||||||
Atom at = e->xproperty.atom;
|
Atom at = e->xproperty.atom;
|
||||||
|
@ -742,6 +745,8 @@ void event_property_notify(XEvent *e)
|
||||||
|
|
||||||
// Change name of desktops
|
// Change name of desktops
|
||||||
else if (at == server.atom._NET_DESKTOP_NAMES) {
|
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();
|
update_desktop_names();
|
||||||
}
|
}
|
||||||
// Change desktops
|
// Change desktops
|
||||||
|
@ -750,6 +755,8 @@ void event_property_notify(XEvent *e)
|
||||||
at == server.atom._NET_DESKTOP_VIEWPORT ||
|
at == server.atom._NET_DESKTOP_VIEWPORT ||
|
||||||
at == server.atom._NET_WORKAREA ||
|
at == server.atom._NET_WORKAREA ||
|
||||||
at == server.atom._NET_CURRENT_DESKTOP) {
|
at == server.atom._NET_CURRENT_DESKTOP) {
|
||||||
|
if (debug)
|
||||||
|
fprintf(stderr, "%s %d: win = root, atom = ?? desktops changed\n", __FUNCTION__, __LINE__);
|
||||||
if (!taskbar_enabled)
|
if (!taskbar_enabled)
|
||||||
return;
|
return;
|
||||||
int old_num_desktops = server.num_desktops;
|
int old_num_desktops = server.num_desktops;
|
||||||
|
@ -835,14 +842,20 @@ void event_property_notify(XEvent *e)
|
||||||
}
|
}
|
||||||
// Window list
|
// Window list
|
||||||
else if (at == server.atom._NET_CLIENT_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();
|
task_refresh_tasklist();
|
||||||
panel_refresh = TRUE;
|
panel_refresh = TRUE;
|
||||||
}
|
}
|
||||||
// Change active
|
// Change active
|
||||||
else if (at == server.atom._NET_ACTIVE_WINDOW) {
|
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();
|
reset_active_task();
|
||||||
panel_refresh = TRUE;
|
panel_refresh = TRUE;
|
||||||
} else if (at == server.atom._XROOTPMAP_ID || at == server.atom._XROOTMAP_ID) {
|
} 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
|
// change Wallpaper
|
||||||
for (i = 0; i < num_panels; i++) {
|
for (i = 0; i < num_panels; i++) {
|
||||||
set_panel_background(&panels[i]);
|
set_panel_background(&panels[i]);
|
||||||
|
@ -851,11 +864,15 @@ void event_property_notify(XEvent *e)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Task *task = task_get_task(win);
|
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 (!task) {
|
||||||
if (at != server.atom._NET_WM_STATE)
|
if (debug)
|
||||||
return;
|
fprintf(stderr, "%s %d\n", __FUNCTION__, __LINE__);
|
||||||
else {
|
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
|
// 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
|
// if it is mapped and not set as skip_taskbar, we must add it to our task list
|
||||||
XWindowAttributes wa;
|
XWindowAttributes wa;
|
||||||
|
@ -863,12 +880,10 @@ void event_property_notify(XEvent *e)
|
||||||
if (wa.map_state == IsViewable && !window_is_skip_taskbar(win)) {
|
if (wa.map_state == IsViewable && !window_is_skip_taskbar(win)) {
|
||||||
if ((task = add_task(win)))
|
if ((task = add_task(win)))
|
||||||
panel_refresh = TRUE;
|
panel_refresh = TRUE;
|
||||||
else
|
|
||||||
return;
|
|
||||||
} else
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
// printf("atom root_win = %s, %s\n", XGetAtomName(server.dsp, at), task->title);
|
// printf("atom root_win = %s, %s\n", XGetAtomName(server.dsp, at), task->title);
|
||||||
|
|
||||||
// Window title changed
|
// Window title changed
|
||||||
|
@ -885,6 +900,16 @@ void event_property_notify(XEvent *e)
|
||||||
}
|
}
|
||||||
// Demand attention
|
// Demand attention
|
||||||
else if (at == server.atom._NET_WM_STATE) {
|
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)) {
|
if (window_is_urgent(win)) {
|
||||||
add_urgent(task);
|
add_urgent(task);
|
||||||
}
|
}
|
||||||
|
@ -940,6 +965,11 @@ void event_configure_notify(XEvent *e)
|
||||||
{
|
{
|
||||||
Window win = e->xconfigure.window;
|
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)
|
// change in root window (xrandr)
|
||||||
if (win == server.root_win) {
|
if (win == server.root_win) {
|
||||||
signal_pending = SIGUSR1;
|
signal_pending = SIGUSR1;
|
||||||
|
|
|
@ -328,6 +328,7 @@ void schedule_redraw(Area *a)
|
||||||
|
|
||||||
for (GList *l = a->children; l; l = l->next)
|
for (GList *l = a->children; l; l = l->next)
|
||||||
schedule_redraw((Area *)l->data);
|
schedule_redraw((Area *)l->data);
|
||||||
|
panel_refresh = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void hide(Area *a)
|
void hide(Area *a)
|
||||||
|
@ -447,7 +448,8 @@ void remove_area(Area *a)
|
||||||
|
|
||||||
if (parent) {
|
if (parent) {
|
||||||
parent->children = g_list_remove(parent->children, area);
|
parent->children = g_list_remove(parent->children, area);
|
||||||
parent->resize_needed = 1;
|
parent->resize_needed = TRUE;
|
||||||
|
panel_refresh = TRUE;
|
||||||
schedule_redraw(parent);
|
schedule_redraw(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -463,7 +465,9 @@ void add_area(Area *a, Area *parent)
|
||||||
a->parent = parent;
|
a->parent = parent;
|
||||||
if (parent) {
|
if (parent) {
|
||||||
parent->children = g_list_append(parent->children, a);
|
parent->children = g_list_append(parent->children, a);
|
||||||
|
parent->resize_needed = TRUE;
|
||||||
schedule_redraw(parent);
|
schedule_redraw(parent);
|
||||||
|
panel_refresh = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue