[titlebar] Add proper interface to set titlebar position

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-04-24 22:58:25 +02:00
parent 3df5a50fc4
commit afdc57bc97
3 changed files with 19 additions and 11 deletions

7
ewmh.c
View File

@ -28,6 +28,7 @@
#include "screen.h" #include "screen.h"
#include "client.h" #include "client.h"
#include "widget.h" #include "widget.h"
#include "titlebar.h"
extern AwesomeConf globalconf; extern AwesomeConf globalconf;
@ -254,7 +255,7 @@ ewmh_process_state_atom(Client *c, Atom state, int set)
/* restore geometry */ /* restore geometry */
geometry = c->m_geometry; geometry = c->m_geometry;
/* restore borders and titlebar */ /* restore borders and titlebar */
c->titlebar.position = c->titlebar.dposition; titlebar_position_set(&c->titlebar, c->titlebar.dposition);
c->border = c->oldborder; c->border = c->oldborder;
c->ismax = False; c->ismax = False;
client_setfloating(c, c->wasfloating); client_setfloating(c, c->wasfloating);
@ -266,7 +267,7 @@ ewmh_process_state_atom(Client *c, Atom state, int set)
c->m_geometry = c->geometry; c->m_geometry = c->geometry;
c->wasfloating = c->isfloating; c->wasfloating = c->isfloating;
/* disable titlebar and borders */ /* disable titlebar and borders */
c->titlebar.position = Off; titlebar_position_set(&c->titlebar, Off);
c->oldborder = c->border; c->oldborder = c->border;
c->border = 0; c->border = 0;
c->ismax = True; c->ismax = True;
@ -291,7 +292,7 @@ ewmh_process_window_type_atom(Client *c, Atom state)
c->border = 0; c->border = 0;
c->skip = True; c->skip = True;
c->isfixed = True; c->isfixed = True;
c->titlebar.position = Off; titlebar_position_set(&c->titlebar, Off);
client_setfloating(c, True); client_setfloating(c, True);
} }
else if (state == net_wm_window_type_dialog) else if (state == net_wm_window_type_dialog)

View File

@ -440,6 +440,18 @@ titlebar_update_geometry(Client *c, area_t geometry)
titlebar_draw(c); titlebar_draw(c);
} }
void
titlebar_position_set(Titlebar *t, Position p)
{
if(!t->sw)
return;
if((t->position = p))
XMapWindow(globalconf.display, t->sw->window);
else
XUnmapWindow(globalconf.display, t->sw->window);
}
/** Toggle the visibility of the focused window's titlebar. /** Toggle the visibility of the focused window's titlebar.
* \param screen screen number (unused) * \param screen screen number (unused)
* \param arg unused argument * \param arg unused argument
@ -454,15 +466,9 @@ uicb_client_toggletitlebar(int screen __attribute__ ((unused)), char *arg __attr
return; return;
if(!c->titlebar.position) if(!c->titlebar.position)
{ titlebar_position_set(&c->titlebar, c->titlebar.dposition);
if((c->titlebar.position = c->titlebar.dposition))
XMapWindow(globalconf.display, c->titlebar.sw->window);
}
else else
{ titlebar_position_set(&c->titlebar, Off);
c->titlebar.position = Off;
XUnmapWindow(globalconf.display, c->titlebar.sw->window);
}
if(c->isfloating || layout_get_current(screen)->arrange == layout_floating) if(c->isfloating || layout_get_current(screen)->arrange == layout_floating)
titlebar_update_geometry_floating(c); titlebar_update_geometry_floating(c);

View File

@ -30,6 +30,7 @@ void titlebar_update_geometry_floating(Client *);
void titlebar_update_geometry(Client *, area_t); void titlebar_update_geometry(Client *, area_t);
area_t titlebar_geometry_add(Titlebar *, area_t); area_t titlebar_geometry_add(Titlebar *, area_t);
area_t titlebar_geometry_remove(Titlebar *, area_t); area_t titlebar_geometry_remove(Titlebar *, area_t);
void titlebar_position_set(Titlebar *, Position);
Uicb uicb_client_toggletitlebar; Uicb uicb_client_toggletitlebar;