bugfix: save rx/ry/rw/rh when resizing a floating window

This commit is contained in:
Julien Danjou 2007-10-25 13:57:02 +02:00
parent bd08d8a119
commit 530a6ef104
3 changed files with 44 additions and 33 deletions

View File

@ -596,6 +596,13 @@ resize(Client *c, int x, int y, int w, int h, awesome_config *awesomeconf, Bool
c->y = wc.y = y;
c->w = wc.width = w;
c->h = wc.height = h;
if(c->isfloating)
{
c->rx = c->x;
c->ry = c->y;
c->rw = c->w;
c->rh = c->h;
}
wc.border_width = c->border;
XConfigureWindow(c->display, c->win, CWX | CWY | CWWidth | CWHeight | CWBorderWidth, &wc);
window_configure(c->display, c->win, c->x, c->y, c->w, c->h, c->border);

View File

@ -23,6 +23,7 @@
#include "screen.h"
#include "tag.h"
#include "layout.h"
#include "statusbar.h"
/** Get screens info
* \param disp Display ref
@ -155,31 +156,41 @@ void
move_client_to_screen(Client *c, awesome_config *acf_new, Bool doresize)
{
int i, old_screen = c->screen;
ScreenInfo *si, *si_old;
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, NULL);
si_old = get_screen_info(c->display, old_screen, NULL);
/* compute new coords in new screen */
c->rx -= si_old[old_screen].x_org + si[c->screen].x_org;
c->ry -= si_old[old_screen].y_org + si[c->screen].y_org;
/* check that new coords are still in the screen */
if(c->rw > si[c->screen].width)
c->rw = si[c->screen].width;
if(c->rh > si[c->screen].height)
c->rh = si[c->screen].height;
if(c->rx >= si[c->screen].x_org + si[c->screen].width)
c->rx = si[c->screen].x_org - c->rw;
if(c->ry >= si[c->screen].y_org + si[c->screen].height)
c->ry = si[c->screen].y_org - c->rh;
if(doresize)
{
ScreenInfo *si, *si_old;
si = get_screen_info(c->display, c->screen, NULL);
si_old = get_screen_info(c->display, old_screen, NULL);
/* compute new coords in new screen */
c->rx -= si_old[old_screen].x_org + si[c->screen].x_org;
c->ry -= si_old[old_screen].y_org + si[c->screen].y_org;
/* check that new coords are still in the screen */
if(c->rw > si[c->screen].width)
c->rw = si[c->screen].width;
if(c->rh > si[c->screen].height)
c->rh = si[c->screen].height;
if(c->rx >= si[c->screen].x_org + si[c->screen].width)
c->rx = si[c->screen].x_org - c->rw;
if(c->ry >= si[c->screen].y_org + si[c->screen].height)
c->ry = si[c->screen].y_org - c->rh;
resize(c, c->rx, c->ry, c->rw, c->rh, acf_new, True);
p_delete(&si);
p_delete(&si_old);
p_delete(&si);
p_delete(&si_old);
}
/* redraw statusbar on all screens */
drawstatusbar(&acf_new[old_screen - acf_new->screen]);
drawstatusbar(acf_new);
}
/** Move mouse pointer to x_org and y_xorg of specified screen

25
tag.c
View File

@ -171,23 +171,16 @@ uicb_togglefloating(awesome_config * awesomeconf,
{
if(!*awesomeconf->client_sel)
return;
(*awesomeconf->client_sel)->isfloating = !(*awesomeconf->client_sel)->isfloating;
if((*awesomeconf->client_sel)->isfloating)
/*restore last known float dimensions*/
resize(*awesomeconf->client_sel,
(*awesomeconf->client_sel)->rx,
(*awesomeconf->client_sel)->ry,
(*awesomeconf->client_sel)->rw,
(*awesomeconf->client_sel)->rh,
awesomeconf, True);
else
{
/*save last known float dimensions*/
(*awesomeconf->client_sel)->rx = (*awesomeconf->client_sel)->x;
(*awesomeconf->client_sel)->ry = (*awesomeconf->client_sel)->y;
(*awesomeconf->client_sel)->rw = (*awesomeconf->client_sel)->w;
(*awesomeconf->client_sel)->rh = (*awesomeconf->client_sel)->h;
}
resize(*awesomeconf->client_sel,
(*awesomeconf->client_sel)->rx,
(*awesomeconf->client_sel)->ry,
(*awesomeconf->client_sel)->rw,
(*awesomeconf->client_sel)->rh,
awesomeconf, True);
client_untab(*awesomeconf->client_sel);
saveprops(*awesomeconf->client_sel, awesomeconf->ntags);
arrange(awesomeconf);