At Sun, 22 Mar 2009 19:18:40 +0100
Maarten Maathuis wrote:
> ---
> client.c | 8 ++++++++
> structs.h | 4 ++++
> titlebar.c | 18 ++++++++++++++++--
> 3 files changed, 28 insertions(+), 2 deletions(-)
>
> diff --git a/client.c b/client.c
> index da6262d..2d8a3a4 100644
> --- a/client.c
> +++ b/client.c
> @@ -845,6 +845,11 @@ client_setfullscreen(client_t *c, bool s)
> client_setabove(c, false);
> client_setontop(c, false);
>
> + if(c->titlebar) {
> + c->titlebar->visibilities.fullscreen =
> c->titlebar->isvisible;
> + titlebar_set_visible(c->titlebar, false);
> + }
> +
> geometry = screen_area_get(c->screen, NULL, NULL, false);
> c->geometries.fullscreen = c->geometry;
> c->border_fs = c->border;
> @@ -852,6 +857,9 @@ client_setfullscreen(client_t *c, bool s)
> }
> else
> {
> + if(c->titlebar)
> + titlebar_set_visible(c->titlebar,
> c->titlebar->visibilities.fullscreen); +
> geometry = c->geometries.fullscreen;
> client_setborder(c, c->border_fs);
> }
> diff --git a/structs.h b/structs.h
> index 3c1e5f3..cb692ef 100644
> --- a/structs.h
> +++ b/structs.h
> @@ -87,6 +87,10 @@ typedef struct
> bool ontop;
> /** Visible */
> bool isvisible;
> + struct {
> + /* visibility when not fullscreen */
> + bool fullscreen;
> + } visibilities;
> /** Position */
> position_t position;
> /** Wibox type */
> diff --git a/titlebar.c b/titlebar.c
> index d5de3e4..344d6ab 100644
> --- a/titlebar.c
> +++ b/titlebar.c
> @@ -182,7 +182,8 @@ titlebar_client_detach(client_t *c)
> if(c && c->titlebar)
> {
> /* Update client geometry to exclude the titlebar. */
> - c->geometry = titlebar_geometry_remove(c->titlebar, 0, c->geometry);
> + if (c->titlebar->isvisible)
> + c->geometry = titlebar_geometry_remove(c->titlebar, 0,
> c->geometry); simplewindow_wipe(&c->titlebar->sw);
> c->titlebar->type = WIBOX_TYPE_NORMAL;
> c->titlebar->screen = SCREEN_UNDEF;
> @@ -233,7 +234,8 @@ titlebar_client_attach(client_t *c, wibox_t *t)
> }
>
> /* Update client geometry to include the titlebar. */
> - c->geometry = titlebar_geometry_add(c->titlebar, 0, c->geometry);
> + if (c->titlebar->isvisible)
> + c->geometry = titlebar_geometry_add(c->titlebar, 0, c->geometry);
>
> /* Client geometry without titlebar, but including borders, since
> that is always consistent. */ titlebar_geometry_compute(c,
> titlebar_geometry_remove(c->titlebar, 0, c->geometry), &wingeom); @@ -267,6
> +269,8 @@ titlebar_set_visible(wibox_t *t, bool visible) {
> if (visible != t->isvisible)
> {
> + client_t *c;
> +
> /* The price of (un)mapping something small like a titlebar is
> pretty cheap.
> * It would complicate matters if this rare case was treated like
> clients.
> * Clients are moved out of the viewport when banned.
> @@ -276,6 +280,16 @@ titlebar_set_visible(wibox_t *t, bool visible)
> else
> xcb_unmap_window(globalconf.connection, t->sw.window);
>
> + /* Update geometry of all clients to which this titlebar is
> attached. */
> + for(c = globalconf.clients; c; c = c->next) {
> + if(c->titlebar == t) {
> + if(visible)
> + c->geometry = titlebar_geometry_add(c->titlebar, 0,
> c->geometry);
> + else
> + c->geometry = titlebar_geometry_remove(c->titlebar, 0,
> c->geometry);
> + }
> + }
> +
> globalconf.screens[t->screen].need_arrange = true;
> client_stack();
> }
You rock :)
--
GCS/IT/M d- s+:- a--- C++ UL+++ US UB++ P+++ L+++ E--- W+ N+ o--
K- w--- O M-- V PS+ PE- Y+ PGP+++ t+ 5 X+ R tv+ b++ DI+++ D+++ G+
e- h! r y+
Gregor Best
signature.asc
Description: PGP signature
