diff --git a/client.c b/client.c index d60cdae9b..dc188876c 100644 --- a/client.c +++ b/client.c @@ -462,10 +462,10 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen, /* Initial values */ c->win = w; - c->geometry.x = c->f_geometry.x = c->m_geometry.x = wgeom->x; - c->geometry.y = c->f_geometry.y = c->m_geometry.y = wgeom->y; - c->geometry.width = c->f_geometry.width = c->m_geometry.width = wgeom->width; - c->geometry.height = c->f_geometry.height = c->m_geometry.height = wgeom->height; + c->geometry.x = c->geometries.floating.x = c->geometries.fullscreen.x = wgeom->x; + c->geometry.y = c->geometries.floating.y = c->geometries.fullscreen.y = wgeom->y; + c->geometry.width = c->geometries.floating.width = c->geometries.fullscreen.width = wgeom->width; + c->geometry.height = c->geometries.floating.height = c->geometries.fullscreen.height = wgeom->height; client_setborder(c, wgeom->border_width); if((icon = ewmh_window_icon_get_reply(ewmh_icon_cookie))) c->icon = image_ref(&icon); @@ -668,7 +668,7 @@ client_resize(client_t *c, area_t geometry, bool hints) || layout_get_current(new_screen) == layout_floating || layout_get_current(c->screen) == layout_floating) if(!c->isfullscreen) - c->f_geometry = geometry; + c->geometries.floating = geometry; titlebar_update_geometry_floating(c); @@ -708,7 +708,7 @@ client_setfloating(client_t *c, bool floating) { if((c->isfloating = floating)) if(!c->isfullscreen) - client_resize(c, c->f_geometry, false); + client_resize(c, c->geometries.floating, false); client_need_arrange(c); client_stack(); xcb_change_property(globalconf.connection, @@ -770,13 +770,13 @@ client_setfullscreen(client_t *c, bool s) if((c->isfullscreen = s)) { geometry = screen_area_get(c->screen, NULL, NULL, false); - c->m_geometry = c->geometry; + c->geometries.fullscreen = c->geometry; c->oldborder = c->border; client_setborder(c, 0); } else { - geometry = c->m_geometry; + geometry = c->geometries.fullscreen; client_setborder(c, c->oldborder); } client_resize(c, geometry, false); diff --git a/layouts/floating.c b/layouts/floating.c index 77565c187..f702c6577 100644 --- a/layouts/floating.c +++ b/layouts/floating.c @@ -32,6 +32,6 @@ layout_floating(int screen) for(c = globalconf.clients; c; c = c->next) if(client_isvisible(c, screen) && !c->isfullscreen) - client_resize(c, c->f_geometry, false); + client_resize(c, c->geometries.floating, false); } // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/screen.c b/screen.c index ead968b55..73626e273 100644 --- a/screen.c +++ b/screen.c @@ -331,7 +331,7 @@ screen_client_moveto(client_t *c, int new_screen, bool dotag, bool doresize) if(doresize && old_screen != c->screen) { area_t new_geometry, new_f_geometry; - new_f_geometry = c->f_geometry; + new_f_geometry = c->geometries.floating; to = screen_area_get(c->screen, NULL, NULL, false); @@ -339,8 +339,8 @@ screen_client_moveto(client_t *c, int new_screen, bool dotag, bool doresize) NULL, NULL, false); /* compute new coords in new screen */ - new_f_geometry.x = (c->f_geometry.x - from.x) + to.x; - new_f_geometry.y = (c->f_geometry.y - from.y) + to.y; + new_f_geometry.x = (c->geometries.floating.x - from.x) + to.x; + new_f_geometry.y = (c->geometries.floating.y - from.y) + to.y; /* check that new coords are still in the screen */ if(new_f_geometry.width > to.width) @@ -371,18 +371,18 @@ screen_client_moveto(client_t *c, int new_screen, bool dotag, bool doresize) new_geometry.y = to.y + to.height - new_geometry.height - 2 * c->border; /* compute new coords for max in new screen */ - c->m_geometry.x = (c->m_geometry.x - from.x) + to.x; - c->m_geometry.y = (c->m_geometry.y - from.y) + to.y; + c->geometries.fullscreen.x = (c->geometries.fullscreen.x - from.x) + to.x; + c->geometries.fullscreen.y = (c->geometries.fullscreen.y - from.y) + to.y; /* check that new coords are still in the screen */ - if(c->m_geometry.width > to.width) - c->m_geometry.width = to.width; - if(c->m_geometry.height > to.height) - c->m_geometry.height = to.height; - if(c->m_geometry.x + c->m_geometry.width >= to.x + to.width) - c->m_geometry.x = to.x + to.width - c->m_geometry.width - 2 * c->border; - if(c->m_geometry.y + c->m_geometry.height >= to.y + to.height) - c->m_geometry.y = to.y + to.height - c->m_geometry.height - 2 * c->border; + if(c->geometries.fullscreen.width > to.width) + c->geometries.fullscreen.width = to.width; + if(c->geometries.fullscreen.height > to.height) + c->geometries.fullscreen.height = to.height; + if(c->geometries.fullscreen.x + c->geometries.fullscreen.width >= to.x + to.width) + c->geometries.fullscreen.x = to.x + to.width - c->geometries.fullscreen.width - 2 * c->border; + if(c->geometries.fullscreen.y + c->geometries.fullscreen.height >= to.y + to.height) + c->geometries.fullscreen.y = to.y + to.height - c->geometries.fullscreen.height - 2 * c->border; client_resize(c, new_geometry, false); } @@ -392,7 +392,7 @@ screen_client_moveto(client_t *c, int new_screen, bool dotag, bool doresize) /* otherwise just register them */ else { - c->f_geometry = new_f_geometry; + c->geometries.floating = new_f_geometry; if(wasvisible) globalconf.screens[old_screen].need_arrange = true; client_need_arrange(c); diff --git a/structs.h b/structs.h index c8549deb7..b15e76abd 100644 --- a/structs.h +++ b/structs.h @@ -148,10 +148,13 @@ struct client_t char *name, *icon_name; /** Window geometry */ area_t geometry; - /** Floating window geometry */ - area_t f_geometry; - /** Max window geometry */ - area_t m_geometry; + struct + { + /** Client floating geometry. */ + area_t floating; + /** Client geometry when (un)fullscreen */ + area_t fullscreen; + } geometries; /* Size hints */ int basew, baseh, incw, inch, maxw, maxh, minw, minh; int minax, maxax, minay, maxay;