All: Retry Unmap/Re-map for hide client (tag switch)
This commit is contained in:
parent
1bb1b72ad6
commit
58460f6b58
@ -210,7 +210,7 @@ uicb_togglebarpos(uicb_t cmd)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
conf.bartop = !conf.bartop;
|
conf.bartop = !conf.bartop;
|
||||||
sgeo.y = (conf.bartop) ? barheight : 0;
|
sgeo.y = (conf.bartop) ? barheight + conf.ttbarheight : conf.ttbarheight;
|
||||||
|
|
||||||
if(conf.bartop)
|
if(conf.bartop)
|
||||||
bary = 0;
|
bary = 0;
|
||||||
@ -242,6 +242,7 @@ updatetitlebar(Client *c)
|
|||||||
draw_text(c->tbar->dr, 3, ((fonth - xftfont->descent) + ((conf.ttbarheight - fonth) / 2)),
|
draw_text(c->tbar->dr, 3, ((fonth - xftfont->descent) + ((conf.ttbarheight - fonth) / 2)),
|
||||||
((c == sel) ? conf.colors.ttbar_text_focus : conf.colors.ttbar_text_normal),
|
((c == sel) ? conf.colors.ttbar_text_focus : conf.colors.ttbar_text_normal),
|
||||||
conf.colors.bar, 0, c->title);
|
conf.colors.bar, 0, c->title);
|
||||||
|
|
||||||
bar_refresh(c->tbar);
|
bar_refresh(c->tbar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
53
src/client.c
53
src/client.c
@ -131,9 +131,9 @@ client_focus(Client *c)
|
|||||||
if(sel && sel != c)
|
if(sel && sel != c)
|
||||||
{
|
{
|
||||||
grabbuttons(sel, False);
|
grabbuttons(sel, False);
|
||||||
draw_border(sel->win, conf.colors.bordernormal);
|
XSetWindowBorder(dpy, sel->win, conf.colors.bordernormal);
|
||||||
if(conf.ttbarheight)
|
if(conf.ttbarheight)
|
||||||
draw_border(sel->tbar->win, conf.colors.bordernormal);
|
XSetWindowBorder(dpy, sel->tbar->win, conf.colors.bordernormal);
|
||||||
|
|
||||||
}
|
}
|
||||||
if(c)
|
if(c)
|
||||||
@ -144,9 +144,9 @@ client_focus(Client *c)
|
|||||||
|
|
||||||
if(c)
|
if(c)
|
||||||
{
|
{
|
||||||
draw_border(c->win, conf.colors.borderfocus);
|
XSetWindowBorder(dpy, c->win, conf.colors.borderfocus);
|
||||||
if(conf.ttbarheight)
|
if(conf.ttbarheight)
|
||||||
draw_border(c->tbar->win, conf.colors.borderfocus);
|
XSetWindowBorder(dpy, c->tbar->win, conf.colors.borderfocus);
|
||||||
if(conf.raisefocus)
|
if(conf.raisefocus)
|
||||||
raiseclient(c);
|
raiseclient(c);
|
||||||
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
|
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
|
||||||
@ -188,15 +188,15 @@ client_gettbar(Window w)
|
|||||||
void
|
void
|
||||||
client_hide(Client *c)
|
client_hide(Client *c)
|
||||||
{
|
{
|
||||||
if(!c)
|
//XMoveWindow(dpy, c->win, c->geo.x, c->geo.y + sgeo.height*2);
|
||||||
return;
|
//if(conf.ttbarheight)
|
||||||
|
// bar_moveresize(c->tbar, c->geo.x,
|
||||||
|
// c->geo.y + sgeo.height*2,
|
||||||
|
//c->geo.width, c->geo.height);
|
||||||
|
|
||||||
XMoveWindow(dpy, c->win, c->geo.x, c->geo.y + sgeo.height*2);
|
XUnmapWindow(dpy, c->win);
|
||||||
if(conf.ttbarheight)
|
if(conf.ttbarheight)
|
||||||
bar_moveresize(c->tbar,
|
XUnmapWindow(dpy, c->tbar->win);
|
||||||
c->geo.x,
|
|
||||||
c->geo.y + sgeo.height*2,
|
|
||||||
c->geo.width, c->geo.height);
|
|
||||||
|
|
||||||
setwinstate(c->win, IconicState);
|
setwinstate(c->win, IconicState);
|
||||||
c->hide = True;
|
c->hide = True;
|
||||||
@ -266,6 +266,7 @@ client_manage(Window w, XWindowAttributes *wa)
|
|||||||
c->geo.width = wa->width;
|
c->geo.width = wa->width;
|
||||||
c->geo.height = wa->height - conf.ttbarheight;
|
c->geo.height = wa->height - conf.ttbarheight;
|
||||||
c->tag = seltag;
|
c->tag = seltag;
|
||||||
|
c->border = conf.borderheight;
|
||||||
|
|
||||||
/* Create titlebar */
|
/* Create titlebar */
|
||||||
if(conf.ttbarheight)
|
if(conf.ttbarheight)
|
||||||
@ -273,8 +274,9 @@ client_manage(Window w, XWindowAttributes *wa)
|
|||||||
c->geo.width, conf.ttbarheight, conf.borderheight,
|
c->geo.width, conf.ttbarheight, conf.borderheight,
|
||||||
conf.colors.bar, True);
|
conf.colors.bar, True);
|
||||||
|
|
||||||
|
winc.border_width = c->border;
|
||||||
XConfigureWindow(dpy, w, CWBorderWidth, &winc);
|
XConfigureWindow(dpy, w, CWBorderWidth, &winc);
|
||||||
draw_border(w, conf.colors.bordernormal);
|
XSetWindowBorder(dpy, w, conf.colors.bordernormal);
|
||||||
grabbuttons(c, False);
|
grabbuttons(c, False);
|
||||||
XSelectInput(dpy, w, EnterWindowMask | FocusChangeMask
|
XSelectInput(dpy, w, EnterWindowMask | FocusChangeMask
|
||||||
| PropertyChangeMask | StructureNotifyMask);
|
| PropertyChangeMask | StructureNotifyMask);
|
||||||
@ -311,8 +313,8 @@ client_moveresize(Client *c, XRectangle geo, bool r)
|
|||||||
/* minimum possible */
|
/* minimum possible */
|
||||||
if (geo.width < 1)
|
if (geo.width < 1)
|
||||||
geo.width = 1;
|
geo.width = 1;
|
||||||
if (geo.height < conf.ttbarheight + 1)
|
if (geo.height < 1)
|
||||||
geo.height = conf.ttbarheight + 1;
|
geo.height = 1;
|
||||||
|
|
||||||
/* base */
|
/* base */
|
||||||
geo.width -= c->basew;
|
geo.width -= c->basew;
|
||||||
@ -359,14 +361,11 @@ client_moveresize(Client *c, XRectangle geo, bool r)
|
|||||||
{
|
{
|
||||||
c->geo = geo;
|
c->geo = geo;
|
||||||
|
|
||||||
XMoveResizeWindow(dpy,
|
XMoveResizeWindow(dpy, c->win, geo.x, geo.y,
|
||||||
c->win,
|
geo.width, geo.height);
|
||||||
geo.x,
|
|
||||||
geo.y + conf.ttbarheight,
|
|
||||||
geo.width, geo.height - conf.ttbarheight);
|
|
||||||
|
|
||||||
if(conf.ttbarheight)
|
if(conf.ttbarheight)
|
||||||
bar_moveresize(c->tbar, geo.x, geo.y, geo.width, conf.ttbarheight);
|
bar_moveresize(c->tbar, geo.x, geo.y - conf.ttbarheight, geo.width, conf.ttbarheight);
|
||||||
|
|
||||||
updatetitlebar(c);
|
updatetitlebar(c);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
@ -465,12 +464,16 @@ raiseclient(Client *c)
|
|||||||
void
|
void
|
||||||
client_unhide(Client *c)
|
client_unhide(Client *c)
|
||||||
{
|
{
|
||||||
if(!c)
|
//XMoveWindow(dpy, c->win, c->geo.x, c->geo.y);
|
||||||
return;
|
//if(conf.ttbarheight)
|
||||||
XMoveWindow(dpy, c->win, c->geo.x, c->geo.y + conf.ttbarheight);
|
// bar_moveresize(c->tbar, c->geo.x,
|
||||||
|
// c->geo.y - conf.ttbarheight,
|
||||||
|
// c->geo.width, conf.ttbarheight);
|
||||||
|
|
||||||
|
XMapWindow(dpy, c->win);
|
||||||
if(conf.ttbarheight)
|
if(conf.ttbarheight)
|
||||||
bar_moveresize(c->tbar, c->geo.x,
|
XMapWindow(dpy, c->tbar->win);
|
||||||
c->geo.y, c->geo.width, conf.ttbarheight);
|
|
||||||
setwinstate(c->win, NormalState);
|
setwinstate(c->win, NormalState);
|
||||||
c->hide = False;
|
c->hide = False;
|
||||||
|
|
||||||
|
|||||||
12
src/draw.c
12
src/draw.c
@ -107,18 +107,6 @@ draw_rectangle(Drawable dr, int x, int y, uint w, uint h, uint color)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
draw_border(Window win, int color)
|
|
||||||
{
|
|
||||||
if(!win)
|
|
||||||
return;
|
|
||||||
|
|
||||||
XSetWindowBorder(dpy, win, color);
|
|
||||||
XSetWindowBorderWidth(dpy, win, conf.borderheight);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ushort
|
ushort
|
||||||
textw(const char *text)
|
textw(const char *text)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -241,11 +241,8 @@ configurerequest(XEvent ev)
|
|||||||
ev.xconfigurerequest.value_mask, &wc);
|
ev.xconfigurerequest.value_mask, &wc);
|
||||||
if((c = getclient(ev.xconfigurerequest.window)))
|
if((c = getclient(ev.xconfigurerequest.window)))
|
||||||
if(wc.y < mw && wc.x < mh)
|
if(wc.y < mw && wc.x < mh)
|
||||||
{
|
|
||||||
geo.y -= conf.ttbarheight;
|
|
||||||
geo.height += conf.ttbarheight;
|
|
||||||
client_moveresize(c, geo, True);
|
client_moveresize(c, geo, True);
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -494,7 +491,8 @@ unmapnotify(XEvent ev)
|
|||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
if((c = getclient(ev.xunmap.window)))
|
if((c = getclient(ev.xunmap.window)))
|
||||||
if(!c->hide)
|
if(!c->hide && ev.xunmap.send_event
|
||||||
|
&& getwinstate(c->win) == NormalState)
|
||||||
client_unmanage(c);
|
client_unmanage(c);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -131,7 +131,7 @@ maxlayout(void)
|
|||||||
|
|
||||||
geo.x = sgeo.x; geo.y = sgeo.y;
|
geo.x = sgeo.x; geo.y = sgeo.y;
|
||||||
geo.width = sgeo.width - (conf.borderheight * 2);
|
geo.width = sgeo.width - (conf.borderheight * 2);
|
||||||
geo.height = sgeo.height - (conf.borderheight * 2);
|
geo.height = sgeo.height - (conf.borderheight * 2) - conf.ttbarheight;
|
||||||
|
|
||||||
client_moveresize(c, geo, False);
|
client_moveresize(c, geo, False);
|
||||||
}
|
}
|
||||||
@ -255,10 +255,12 @@ tile(void)
|
|||||||
cgeo.height = tileheight - border;
|
cgeo.height = tileheight - border;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cgeo.height -= conf.ttbarheight;
|
||||||
|
|
||||||
client_moveresize(c, cgeo, tags[seltag].resizehint);
|
client_moveresize(c, cgeo, tags[seltag].resizehint);
|
||||||
|
|
||||||
if(n > nmaster && tileheight != sgeo.height)
|
if(n > nmaster && tileheight != sgeo.height)
|
||||||
cgeo.y = c->geo.y + c->geo.height + border;
|
cgeo.y = c->geo.y + c->geo.height + border + conf.ttbarheight;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -296,7 +298,7 @@ uicb_togglemax(uicb_t cmd)
|
|||||||
|
|
||||||
geo.x = sgeo.x; geo.y = sgeo.y;
|
geo.x = sgeo.x; geo.y = sgeo.y;
|
||||||
geo.width = sgeo.width - (conf.borderheight * 2);
|
geo.width = sgeo.width - (conf.borderheight * 2);
|
||||||
geo.height = sgeo.height - (conf.borderheight * 2);
|
geo.height = sgeo.height - (conf.borderheight * 2) - conf.ttbarheight;
|
||||||
|
|
||||||
client_moveresize(sel, geo, False);
|
client_moveresize(sel, geo, False);
|
||||||
raiseclient(sel);
|
raiseclient(sel);
|
||||||
|
|||||||
@ -44,6 +44,7 @@ typedef const char* uicb_t;
|
|||||||
typedef unsigned int uint;
|
typedef unsigned int uint;
|
||||||
typedef unsigned long ulong;
|
typedef unsigned long ulong;
|
||||||
typedef unsigned short ushort;
|
typedef unsigned short ushort;
|
||||||
|
typedef unsigned char uchar;
|
||||||
|
|
||||||
/* Enum */
|
/* Enum */
|
||||||
enum { CurNormal, CurResize, CurMove, CurLast };
|
enum { CurNormal, CurResize, CurMove, CurLast };
|
||||||
@ -82,6 +83,8 @@ struct Client
|
|||||||
Window win;
|
Window win;
|
||||||
/* Titlebar */
|
/* Titlebar */
|
||||||
BarWindow *tbar;
|
BarWindow *tbar;
|
||||||
|
/* Border */
|
||||||
|
int border;
|
||||||
/* Client Layout Information */
|
/* Client Layout Information */
|
||||||
Bool max, tile, free;
|
Bool max, tile, free;
|
||||||
Bool hint, hide, lmax;
|
Bool hint, hide, lmax;
|
||||||
|
|||||||
@ -91,6 +91,7 @@ uicb_tagtransfert(uicb_t cmd)
|
|||||||
|
|
||||||
sel->tag = n;
|
sel->tag = n;
|
||||||
selbytag[n] = sel;
|
selbytag[n] = sel;
|
||||||
|
selbytag[seltag] = NULL;
|
||||||
|
|
||||||
arrange();
|
arrange();
|
||||||
|
|
||||||
|
|||||||
24
src/util.c
24
src/util.c
@ -64,6 +64,30 @@ setwinstate(Window win, long state)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long
|
||||||
|
getwinstate(Window win)
|
||||||
|
{
|
||||||
|
int f;
|
||||||
|
long ret = -1;
|
||||||
|
ulong n, e;
|
||||||
|
uchar *p = NULL;
|
||||||
|
Atom at;
|
||||||
|
|
||||||
|
if(XGetWindowProperty(dpy, win, XInternAtom(dpy, "WM_STATE", False),
|
||||||
|
0L, 2L, False, XInternAtom(dpy, "WM_STATE", False),
|
||||||
|
&at, &f, &n, &e, (unsigned char **)&p) != Success)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(n != 0)
|
||||||
|
ret = *p;
|
||||||
|
|
||||||
|
free(p);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
uicb_spawn(uicb_t cmd)
|
uicb_spawn(uicb_t cmd)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -177,9 +177,9 @@ init(void)
|
|||||||
|
|
||||||
/* INIT WORKABLE SPACE */
|
/* INIT WORKABLE SPACE */
|
||||||
sgeo.x = 0;
|
sgeo.x = 0;
|
||||||
sgeo.y = (conf.bartop) ? barheight : 0;
|
sgeo.y = (conf.bartop) ? barheight + conf.ttbarheight : conf.ttbarheight;
|
||||||
sgeo.width = DisplayWidth(dpy, screen);
|
sgeo.width = DisplayWidth(dpy, screen);
|
||||||
sgeo.height = DisplayHeight(dpy, screen) - barheight;
|
sgeo.height = DisplayHeight(dpy, screen) - (barheight + conf.ttbarheight);
|
||||||
|
|
||||||
|
|
||||||
/* INIT STUFF */
|
/* INIT STUFF */
|
||||||
|
|||||||
@ -79,7 +79,6 @@ void draw_text(Drawable d, int x, int y, char* fg, uint bg, int pad, char *str);
|
|||||||
void draw_taglist(Drawable dr);
|
void draw_taglist(Drawable dr);
|
||||||
void draw_layout(void);
|
void draw_layout(void);
|
||||||
void draw_rectangle(Drawable dr, int x, int y, uint w, uint h, uint color);
|
void draw_rectangle(Drawable dr, int x, int y, uint w, uint h, uint color);
|
||||||
void draw_border(Window win, int color);
|
|
||||||
ushort textw(const char *text);
|
ushort textw(const char *text);
|
||||||
|
|
||||||
/* client.c */
|
/* client.c */
|
||||||
@ -128,6 +127,7 @@ void getevent(void);
|
|||||||
void *emalloc(uint element, uint size);
|
void *emalloc(uint element, uint size);
|
||||||
ulong getcolor(char *color);
|
ulong getcolor(char *color);
|
||||||
void setwinstate(Window win, long state);
|
void setwinstate(Window win, long state);
|
||||||
|
long getwinstate(Window win);
|
||||||
void uicb_spawn(uicb_t);
|
void uicb_spawn(uicb_t);
|
||||||
|
|
||||||
/* tag.c */
|
/* tag.c */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user