bugfix: save rx/ry/rw/rh when resizing a floating window
This commit is contained in:
parent
bd08d8a119
commit
530a6ef104
7
client.c
7
client.c
|
@ -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->y = wc.y = y;
|
||||||
c->w = wc.width = w;
|
c->w = wc.width = w;
|
||||||
c->h = wc.height = h;
|
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;
|
wc.border_width = c->border;
|
||||||
XConfigureWindow(c->display, c->win, CWX | CWY | CWWidth | CWHeight | CWBorderWidth, &wc);
|
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);
|
window_configure(c->display, c->win, c->x, c->y, c->w, c->h, c->border);
|
||||||
|
|
45
screen.c
45
screen.c
|
@ -23,6 +23,7 @@
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
|
#include "statusbar.h"
|
||||||
|
|
||||||
/** Get screens info
|
/** Get screens info
|
||||||
* \param disp Display ref
|
* \param disp Display ref
|
||||||
|
@ -155,31 +156,41 @@ void
|
||||||
move_client_to_screen(Client *c, awesome_config *acf_new, Bool doresize)
|
move_client_to_screen(Client *c, awesome_config *acf_new, Bool doresize)
|
||||||
{
|
{
|
||||||
int i, old_screen = c->screen;
|
int i, old_screen = c->screen;
|
||||||
ScreenInfo *si, *si_old;
|
|
||||||
|
|
||||||
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, 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)
|
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);
|
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
|
/** Move mouse pointer to x_org and y_xorg of specified screen
|
||||||
|
|
25
tag.c
25
tag.c
|
@ -171,23 +171,16 @@ uicb_togglefloating(awesome_config * awesomeconf,
|
||||||
{
|
{
|
||||||
if(!*awesomeconf->client_sel)
|
if(!*awesomeconf->client_sel)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
(*awesomeconf->client_sel)->isfloating = !(*awesomeconf->client_sel)->isfloating;
|
(*awesomeconf->client_sel)->isfloating = !(*awesomeconf->client_sel)->isfloating;
|
||||||
if((*awesomeconf->client_sel)->isfloating)
|
|
||||||
/*restore last known float dimensions*/
|
resize(*awesomeconf->client_sel,
|
||||||
resize(*awesomeconf->client_sel,
|
(*awesomeconf->client_sel)->rx,
|
||||||
(*awesomeconf->client_sel)->rx,
|
(*awesomeconf->client_sel)->ry,
|
||||||
(*awesomeconf->client_sel)->ry,
|
(*awesomeconf->client_sel)->rw,
|
||||||
(*awesomeconf->client_sel)->rw,
|
(*awesomeconf->client_sel)->rh,
|
||||||
(*awesomeconf->client_sel)->rh,
|
awesomeconf, True);
|
||||||
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;
|
|
||||||
}
|
|
||||||
client_untab(*awesomeconf->client_sel);
|
client_untab(*awesomeconf->client_sel);
|
||||||
saveprops(*awesomeconf->client_sel, awesomeconf->ntags);
|
saveprops(*awesomeconf->client_sel, awesomeconf->ntags);
|
||||||
arrange(awesomeconf);
|
arrange(awesomeconf);
|
||||||
|
|
Loading…
Reference in New Issue