diff --git a/client.c b/client.c index f4faa4db..523d4c1a 100644 --- a/client.c +++ b/client.c @@ -403,7 +403,6 @@ manage(Display *disp, DC *drawcontext, Window w, XWindowAttributes *wa, awesome_ ScreenInfo *si = get_display_info(disp, awesomeconf->screen, &awesomeconf->statusbar); c = p_new(Client, 1); - move_client_to_screen(c, awesomeconf); c->win = w; c->ftview = True; c->x = c->rw = wa->x; @@ -444,6 +443,7 @@ manage(Display *disp, DC *drawcontext, Window w, XWindowAttributes *wa, awesome_ } grabbuttons(c, False, awesomeconf->modkey, awesomeconf->numlockmask); updatetitle(c); + move_client_to_screen(c, awesomeconf, False); if((rettrans = XGetTransientForHint(disp, w, &trans) == Success)) for(t = clients; t && t->win != trans; t = t->next); if(t) @@ -536,8 +536,9 @@ resize(Client *c, int x, int y, int w, int h, awesome_config *awesomeconf, Bool XSync(c->display, False); if(XineramaIsActive(c->display)) { - c->screen = get_screen_bycoord(c->display, c->x, c->y); - move_client_to_screen(c, &awesomeconf[c->screen - awesomeconf->screen]); + int new_screen = get_screen_bycoord(c->display, c->x, c->y); + if(c->screen != new_screen) + move_client_to_screen(c, &awesomeconf[new_screen - awesomeconf->screen], False); } } } diff --git a/screen.c b/screen.c index 972f3f10..cdea5702 100644 --- a/screen.c +++ b/screen.c @@ -153,14 +153,22 @@ get_real_screen(Display *disp, int screen) } void -move_client_to_screen(Client *c, awesome_config *acf_new) +move_client_to_screen(Client *c, awesome_config *acf_new, Bool doresize) { int i; + ScreenInfo *si; c->screen = acf_new->screen; p_realloc(&c->tags, acf_new->ntags); for(i = 0; i < acf_new->ntags; i++) c->tags[i] = acf_new->tags[i].selected; + + si = get_screen_info(c->display, c->screen, &acf_new->statusbar, &i); + c->rx = si[c->screen].x_org; + c->ry = si[c->screen].y_org; + if(doresize) + resize(c, c->rx, c->ry, c->rw, c->rh, acf_new, True); + XFree(si); } static void @@ -233,7 +241,7 @@ uicb_movetoscreen(Display *disp, else screen = sel->screen + 1 >= get_screen_count(disp) ? 0 : sel->screen + 1; - move_client_to_screen(sel, &awesomeconf[screen - awesomeconf->screen]); + move_client_to_screen(sel, &awesomeconf[screen - awesomeconf->screen], True); move_mouse_pointer_to_screen(disp, screen); arrange(disp, drawcontext, awesomeconf); arrange(disp, &drawcontext[screen - awesomeconf->screen], &awesomeconf[screen - awesomeconf->screen]); diff --git a/screen.h b/screen.h index 89d53a6e..b45d5869 100644 --- a/screen.h +++ b/screen.h @@ -33,7 +33,7 @@ ScreenInfo * get_display_info(Display *, int, Statusbar *); int get_screen_bycoord(Display *, int, int); int get_screen_count(Display *); int get_real_screen(Display *, int); -void move_client_to_screen(Client *, awesome_config *); +void move_client_to_screen(Client *, awesome_config *, Bool); UICB_PROTO(uicb_focusnextscreen); UICB_PROTO(uicb_focusprevscreen); UICB_PROTO(uicb_movetoscreen);