mirror of
https://github.com/0intro/wmii
synced 2024-11-22 22:02:30 +03:00
Added size revert handling between floating/managed mode. Fixed term sizing bug (I think)
This commit is contained in:
parent
6c8280846a
commit
edae9ff3ee
@ -210,6 +210,13 @@ place_client(Area *a, Client *c)
|
||||
void
|
||||
send_to_area(Area *to, Area *from, Frame *f)
|
||||
{
|
||||
cext_assert(to->view == f->view);
|
||||
|
||||
if(to->floating != from->floating) {
|
||||
XRectangle temp = f->revert;
|
||||
f->revert = f->rect;
|
||||
f->rect = temp;
|
||||
}
|
||||
f->client->revert = from;
|
||||
detach_from_area(from, f);
|
||||
attach_to_area(to, f, True);
|
||||
|
@ -63,8 +63,8 @@ create_client(Window w, XWindowAttributes *wa)
|
||||
c->rect.x = wa->x;
|
||||
c->rect.y = wa->y;
|
||||
c->border = wa->border_width;
|
||||
c->rect.width = wa->width + 2 * c->border;
|
||||
c->rect.height = wa->height + 2 * c->border;
|
||||
c->rect.width = wa->width;
|
||||
c->rect.height = wa->height;
|
||||
XSetWindowBorderWidth(blz.display, c->win, 0);
|
||||
c->proto = win_proto(c->win);
|
||||
XGetTransientForHint(blz.display, c->win, &c->trans);
|
||||
@ -355,6 +355,7 @@ manage_client(Client *c)
|
||||
apply_tags(c, c->tags);
|
||||
|
||||
reparent_client(c, c->framewin, c->rect.x, c->rect.y);
|
||||
|
||||
if(!starting)
|
||||
update_views();
|
||||
map_client(c);
|
||||
|
@ -147,47 +147,50 @@ handle_configurerequest(XEvent *e)
|
||||
{
|
||||
XConfigureRequestEvent *ev = &e->xconfigurerequest;
|
||||
XWindowChanges wc;
|
||||
XRectangle *frect;
|
||||
Client *c;
|
||||
|
||||
c = client_of_win(ev->window);
|
||||
ev->value_mask &= ~CWSibling;
|
||||
if(c) {
|
||||
if(c->frame && c->sel->area->floating) {
|
||||
gravitate_client(c, True);
|
||||
gravitate_client(c, True);
|
||||
|
||||
if(c->frame) {
|
||||
if(ev->value_mask & CWX)
|
||||
c->rect.x = ev->x;
|
||||
if(ev->value_mask & CWY)
|
||||
c->rect.y = ev->y;
|
||||
if(ev->value_mask & CWWidth)
|
||||
c->rect.width = ev->width;
|
||||
if(ev->value_mask & CWHeight)
|
||||
c->rect.height = ev->height;
|
||||
if(ev->value_mask & CWX)
|
||||
c->rect.x = ev->x;
|
||||
if(ev->value_mask & CWY)
|
||||
c->rect.y = ev->y;
|
||||
if(ev->value_mask & CWWidth)
|
||||
c->rect.width = ev->width;
|
||||
if(ev->value_mask & CWHeight)
|
||||
c->rect.height = ev->height;
|
||||
if(ev->value_mask & CWBorderWidth)
|
||||
c->border = ev->border_width;
|
||||
|
||||
gravitate_client(c, False);
|
||||
|
||||
if(c->frame) {
|
||||
if(c->sel->area->floating)
|
||||
frect=&c->sel->rect;
|
||||
else
|
||||
frect=&c->sel->revert;
|
||||
|
||||
if(c->rect.width >= rect.width && c->rect.height >= rect.height) {
|
||||
frect->y = wc.y = -height_of_bar();
|
||||
frect->x = wc.x = -def.border;
|
||||
}
|
||||
if(ev->value_mask & CWBorderWidth)
|
||||
c->border = ev->border_width;
|
||||
|
||||
gravitate_client(c, False);
|
||||
|
||||
if(c->frame) {
|
||||
Frame *f = c->sel;
|
||||
if(c->rect.width >= rect.width && c->rect.height >= rect.height) {
|
||||
f->rect.y = wc.y = -height_of_bar();
|
||||
f->rect.x = wc.x = -def.border;
|
||||
}
|
||||
else {
|
||||
f->rect.x = wc.x = c->rect.x - def.border;
|
||||
f->rect.y = wc.y = c->rect.y - height_of_bar();
|
||||
}
|
||||
f->rect.width = wc.width = c->rect.width + 2 * def.border;
|
||||
f->rect.height = wc.height = c->rect.height + def.border
|
||||
+ height_of_bar();
|
||||
wc.border_width = 1;
|
||||
wc.sibling = None;
|
||||
wc.stack_mode = ev->detail;
|
||||
if(f->area->view != sel)
|
||||
wc.x += 2 * rect.width;
|
||||
else {
|
||||
frect->y = wc.y = c->rect.y - height_of_bar();
|
||||
frect->x = wc.x = c->rect.x - def.border;
|
||||
}
|
||||
frect->width = wc.width = c->rect.width + 2 * def.border;
|
||||
frect->height = wc.height = c->rect.height + def.border
|
||||
+ height_of_bar();
|
||||
wc.border_width = 1;
|
||||
wc.sibling = None;
|
||||
wc.stack_mode = ev->detail;
|
||||
if(c->sel->area->view != sel)
|
||||
wc.x += 2 * rect.width;
|
||||
if(c->sel->area->floating) {
|
||||
XConfigureWindow(blz.display, c->framewin, ev->value_mask, &wc);
|
||||
configure_client(c);
|
||||
}
|
||||
@ -202,8 +205,8 @@ handle_configurerequest(XEvent *e)
|
||||
if(c && c->frame) {
|
||||
wc.x = def.border;
|
||||
wc.y = height_of_bar();
|
||||
wc.width = c->rect.width;
|
||||
wc.height = c->rect.height;
|
||||
wc.width = c->sel->rect.width - 2 * def.border;
|
||||
wc.height = c->sel->rect.height - def.border - height_of_bar();
|
||||
}
|
||||
|
||||
wc.border_width = 0;
|
||||
@ -212,6 +215,7 @@ handle_configurerequest(XEvent *e)
|
||||
ev->value_mask &= ~CWStackMode;
|
||||
ev->value_mask |= CWBorderWidth;
|
||||
XConfigureWindow(blz.display, ev->window, ev->value_mask, &wc);
|
||||
|
||||
XSync(blz.display, False);
|
||||
}
|
||||
|
||||
|
@ -17,9 +17,15 @@ create_frame(Client *c, View *v)
|
||||
f->id = id++;
|
||||
f->client = c;
|
||||
f->view = v;
|
||||
f->revert = f->rect = c->rect;
|
||||
f->rect.width += 2 * def.border;
|
||||
f->rect.height += def.border + height_of_bar();
|
||||
|
||||
if(c->frame) {
|
||||
f->revert = c->sel->revert;
|
||||
f->rect = c->sel->rect;
|
||||
}else{
|
||||
f->revert = f->rect = c->rect;
|
||||
f->revert.width = f->rect.width += 2 * def.border;
|
||||
f->revert.height = f->rect.height += def.border + height_of_bar();
|
||||
}
|
||||
f->collapsed = False;
|
||||
|
||||
f->tile.blitz = &blz;
|
||||
|
@ -213,7 +213,7 @@ write_to_buf(P9Req *r, void *buf, unsigned int *len, unsigned int max) {
|
||||
|
||||
memcpy(buf + offset, r->ifcall.data, count);
|
||||
r->ofcall.count = count;
|
||||
((char *)buf)[offset+count] = '\0'; /* shut up valgrind */
|
||||
((char *)buf)[offset+count] = '\0';
|
||||
/* and save some lines later... we alloc for it anyway */
|
||||
}
|
||||
|
||||
@ -846,7 +846,6 @@ fs_clunk(P9Req *r) {
|
||||
update_views();
|
||||
break;
|
||||
case FsFKeys:
|
||||
def.keys[def.keyssz] = '\0';
|
||||
update_keys();
|
||||
break;
|
||||
case FsFCtags:
|
||||
@ -858,7 +857,7 @@ fs_clunk(P9Req *r) {
|
||||
buf = f->bar->buf;
|
||||
i = strlen(f->bar->buf);
|
||||
parse_colors(&buf, &i, &f->bar->brush.color);
|
||||
while(buf[i - 1] == '\n')
|
||||
while(i > 0 && buf[i - 1] == '\n')
|
||||
buf[--i] = '\0';
|
||||
cext_strlcpy(f->bar->text, buf, sizeof(f->bar->text));
|
||||
draw_bar();
|
||||
|
Loading…
Reference in New Issue
Block a user