enhance windows screen moving when windows are floating

This commit is contained in:
Julien Danjou 2007-09-28 16:40:20 +02:00
parent ca169340b1
commit 7beabd32d3
3 changed files with 15 additions and 6 deletions

View File

@ -403,7 +403,6 @@ manage(Display *disp, DC *drawcontext, Window w, XWindowAttributes *wa, awesome_
ScreenInfo *si = get_display_info(disp, awesomeconf->screen, &awesomeconf->statusbar); ScreenInfo *si = get_display_info(disp, awesomeconf->screen, &awesomeconf->statusbar);
c = p_new(Client, 1); c = p_new(Client, 1);
move_client_to_screen(c, awesomeconf);
c->win = w; c->win = w;
c->ftview = True; c->ftview = True;
c->x = c->rw = wa->x; 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); grabbuttons(c, False, awesomeconf->modkey, awesomeconf->numlockmask);
updatetitle(c); updatetitle(c);
move_client_to_screen(c, awesomeconf, False);
if((rettrans = XGetTransientForHint(disp, w, &trans) == Success)) if((rettrans = XGetTransientForHint(disp, w, &trans) == Success))
for(t = clients; t && t->win != trans; t = t->next); for(t = clients; t && t->win != trans; t = t->next);
if(t) 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); XSync(c->display, False);
if(XineramaIsActive(c->display)) if(XineramaIsActive(c->display))
{ {
c->screen = get_screen_bycoord(c->display, c->x, c->y); int new_screen = get_screen_bycoord(c->display, c->x, c->y);
move_client_to_screen(c, &awesomeconf[c->screen - awesomeconf->screen]); if(c->screen != new_screen)
move_client_to_screen(c, &awesomeconf[new_screen - awesomeconf->screen], False);
} }
} }
} }

View File

@ -153,14 +153,22 @@ get_real_screen(Display *disp, int screen)
} }
void 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; int i;
ScreenInfo *si;
c->screen = acf_new->screen; c->screen = acf_new->screen;
p_realloc(&c->tags, acf_new->ntags); p_realloc(&c->tags, acf_new->ntags);
for(i = 0; i < acf_new->ntags; i++) for(i = 0; i < acf_new->ntags; i++)
c->tags[i] = acf_new->tags[i].selected; 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 static void
@ -233,7 +241,7 @@ uicb_movetoscreen(Display *disp,
else else
screen = sel->screen + 1 >= get_screen_count(disp) ? 0 : sel->screen + 1; 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); move_mouse_pointer_to_screen(disp, screen);
arrange(disp, drawcontext, awesomeconf); arrange(disp, drawcontext, awesomeconf);
arrange(disp, &drawcontext[screen - awesomeconf->screen], &awesomeconf[screen - awesomeconf->screen]); arrange(disp, &drawcontext[screen - awesomeconf->screen], &awesomeconf[screen - awesomeconf->screen]);

View File

@ -33,7 +33,7 @@ ScreenInfo * get_display_info(Display *, int, Statusbar *);
int get_screen_bycoord(Display *, int, int); int get_screen_bycoord(Display *, int, int);
int get_screen_count(Display *); int get_screen_count(Display *);
int get_real_screen(Display *, int); 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_focusnextscreen);
UICB_PROTO(uicb_focusprevscreen); UICB_PROTO(uicb_focusprevscreen);
UICB_PROTO(uicb_movetoscreen); UICB_PROTO(uicb_movetoscreen);