Fix compiz support with multiple desktops and monitors (issue #94)
This commit is contained in:
@@ -162,29 +162,6 @@ int get_window_monitor(Window win)
|
|||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
get_window_coordinates(win, &x, &y, &w, &h);
|
get_window_coordinates(win, &x, &y, &w, &h);
|
||||||
|
|
||||||
if (server.viewports) {
|
|
||||||
int desktop = MIN(get_current_desktop(), server.num_desktops - 1);
|
|
||||||
// Window coordinates are relative to the current viewport, make them absolute
|
|
||||||
x += server.viewports[desktop].x;
|
|
||||||
y += server.viewports[desktop].y;
|
|
||||||
|
|
||||||
if (x < 0 || y < 0) {
|
|
||||||
int num_results;
|
|
||||||
long *x_screen_size = server_get_property(server.root_win, server.atom._NET_DESKTOP_GEOMETRY, XA_CARDINAL, &num_results);
|
|
||||||
if (!x_screen_size)
|
|
||||||
return 0;
|
|
||||||
int x_screen_width = x_screen_size[0];
|
|
||||||
int x_screen_height = x_screen_size[1];
|
|
||||||
XFree(x_screen_size);
|
|
||||||
|
|
||||||
// Wrap
|
|
||||||
if (x < 0)
|
|
||||||
x += x_screen_width;
|
|
||||||
if (y < 0)
|
|
||||||
y += x_screen_height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int best_match = -1;
|
int best_match = -1;
|
||||||
int match_right = 0;
|
int match_right = 0;
|
||||||
int match_bottom = 0;
|
int match_bottom = 0;
|
||||||
@@ -203,7 +180,7 @@ int get_window_monitor(Window win)
|
|||||||
|
|
||||||
if (best_match < 0)
|
if (best_match < 0)
|
||||||
best_match = 0;
|
best_match = 0;
|
||||||
// fprintf(stderr, "desktop %d, window %lx %s : monitor %d, (%d, %d)\n", 1 + get_current_desktop(), win, get_task(win) ? get_task(win)->title : "??", best_match+1, x, y);
|
//fprintf(stderr, "desktop %d, window %lx %s : monitor %d, (%d, %d)\n", 1 + get_current_desktop(), win, get_task(win) ? get_task(win)->title : "??", best_match+1, x, y);
|
||||||
return best_match;
|
return best_match;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user