all repos — tint2 @ 7162c5dea18cf5e513e6b5fa4288f8ba0e9e51f3

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

taskbar: Add logging for window_get_monitor()
o9000 o9000
commit

7162c5dea18cf5e513e6b5fa4288f8ba0e9e51f3

parent

e3939a56e11b34faa20a56b92a295228358ea66f

4 files changed, 39 insertions(+), 4 deletions(-)

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

@@ -364,6 +364,20 @@ server.monitor[0].names = 0;

} } +void print_monitors() +{ + fprintf(stderr, "Number of monitors: %d\n", server.nb_monitor); + int i; + for (i = 0; i < server.nb_monitor; i++) { + fprintf(stderr, "Monitor %d: x = %d, y = %d, w = %d, h = %d\n", + i+1, + server.monitor[i].x, + server.monitor[i].y, + server.monitor[i].width, + server.monitor[i].height); + } +} + int server_get_number_of_desktops() { return get_property32(server.root_win, server.atom._NET_NUMBER_OF_DESKTOPS, XA_CARDINAL);
M src/server.hsrc/server.h

@@ -153,6 +153,7 @@ void get_root_pixmap();

// detect monitors and desktops void get_monitors(); +void print_monitors(); void get_desktops(); int server_get_number_of_desktops();
M src/taskbar/task.csrc/taskbar/task.c

@@ -533,6 +533,12 @@ (hide_task_diff_monitor || nb_panel > 1)) {

hide = 1; } if (1 - hide != tsk1->area.on_screen) { + fprintf(stderr, "%s %s task %ld '%s' (panel monitor = %d)\n", + __FUNCTION__, + hide ? "hiding" : "showing", + tsk->win, + tsk->title ? tsk->title : "??", + ((Panel*)tsk->area.panel)->monitor + 1); tsk1->area.on_screen = 1 - hide; set_task_redraw(tsk1); Panel *p = (Panel*)tsk->area.panel;
M src/util/window.csrc/util/window.c

@@ -130,7 +130,16 @@ {

int i, x, y; Window src; - XTranslateCoordinates(server.dsp, win, server.root_win, 0, 0, &x, &y, &src); + XTextProperty xname; + char *name; + if (XGetWMName(server.dsp, win, &xname)) { + name = strdup((char*)xname.value); + XFree(xname.value); + } else { + name = strdup("??"); + } + + Bool result = XTranslateCoordinates(server.dsp, win, server.root_win, 0, 0, &x, &y, &src); x += 2; y += 2; for (i = 0; i < server.nb_monitor; i++) {

@@ -139,9 +148,14 @@ if (y >= server.monitor[i].y && y <= (server.monitor[i].y + server.monitor[i].height))

break; } - //printf("window %lx : ecran %d, (%d, %d)\n", win, i, x, y); - if (i == server.nb_monitor) return 0; - else return i; + if (i == server.nb_monitor) + i = 0; + + printf("\n%s: window %ld '%s': monitor %d, x = %d, y = %d, result = %s\n", __FUNCTION__, win, name, i+1, x, y, result ? "True" : "False"); + print_monitors(); + free(name); + + return i; } void window_get_coordinates (Window win, int *x, int *y, int *w, int *h)