taskbar: Add logging for window_get_monitor()
This commit is contained in:
parent
e3939a56e1
commit
7162c5dea1
4 changed files with 39 additions and 4 deletions
14
src/server.c
14
src/server.c
|
@ -364,6 +364,20 @@ next:
|
|||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -533,6 +533,12 @@ void set_task_state(Task *tsk, int state)
|
|||
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;
|
||||
|
|
|
@ -130,7 +130,16 @@ int window_get_monitor (Window win)
|
|||
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 @@ int window_get_monitor (Window win)
|
|||
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)
|
||||
|
|
Loading…
Reference in a new issue