|
|
|
@ -58,6 +58,13 @@ |
|
|
|
|
#define TAGMASK ((1 << LENGTH(tags)) - 1) |
|
|
|
|
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad) |
|
|
|
|
|
|
|
|
|
#define MWM_HINTS_FLAGS_FIELD 0 |
|
|
|
|
#define MWM_HINTS_DECORATIONS_FIELD 2 |
|
|
|
|
#define MWM_HINTS_DECORATIONS (1 << 1) |
|
|
|
|
#define MWM_DECOR_ALL (1 << 0) |
|
|
|
|
#define MWM_DECOR_BORDER (1 << 1) |
|
|
|
|
#define MWM_DECOR_TITLE (1 << 3) |
|
|
|
|
|
|
|
|
|
/* enums */ |
|
|
|
|
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ |
|
|
|
|
enum { SchemeNorm, SchemeSel, SchemeStatus, SchemeTagsSel, SchemeTagsNorm, SchemeInfoSel, SchemeInfoNorm, SchemeMenu }; /* color schemes */ |
|
|
|
@ -227,6 +234,7 @@ static void updatebarpos(Monitor *m); |
|
|
|
|
static void updatebars(void); |
|
|
|
|
static void updateclientlist(void); |
|
|
|
|
static int updategeom(void); |
|
|
|
|
static void updatemotifhints(Client *c); |
|
|
|
|
static void updatenumlockmask(void); |
|
|
|
|
static void updatesizehints(Client *c); |
|
|
|
|
static void updatestatus(void); |
|
|
|
@ -266,7 +274,7 @@ static void (*handler[LASTEvent]) (XEvent *) = { |
|
|
|
|
[PropertyNotify] = propertynotify, |
|
|
|
|
[UnmapNotify] = unmapnotify |
|
|
|
|
}; |
|
|
|
|
static Atom wmatom[WMLast], netatom[NetLast]; |
|
|
|
|
static Atom wmatom[WMLast], netatom[NetLast], motifatom; |
|
|
|
|
static int running = 1; |
|
|
|
|
static Cur *cursor[CurLast]; |
|
|
|
|
static Clr **scheme; |
|
|
|
@ -1127,6 +1135,7 @@ manage(Window w, XWindowAttributes *wa) |
|
|
|
|
updatewindowtype(c); |
|
|
|
|
updatesizehints(c); |
|
|
|
|
updatewmhints(c); |
|
|
|
|
updatemotifhints(c); |
|
|
|
|
XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask); |
|
|
|
|
grabbuttons(c, 0); |
|
|
|
|
if (!c->isfloating) |
|
|
|
@ -1313,6 +1322,8 @@ propertynotify(XEvent *e) |
|
|
|
|
} |
|
|
|
|
if (ev->atom == netatom[NetWMWindowType]) |
|
|
|
|
updatewindowtype(c); |
|
|
|
|
if (ev->atom == motifatom) |
|
|
|
|
updatemotifhints(c); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1641,6 +1652,7 @@ setup(void) |
|
|
|
|
netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False); |
|
|
|
|
netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False); |
|
|
|
|
netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False); |
|
|
|
|
motifatom = XInternAtom(dpy, "_MOTIF_WM_HINTS", False); |
|
|
|
|
/* init cursors */ |
|
|
|
|
cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr); |
|
|
|
|
cursor[CurResize] = drw_cur_create(drw, XC_sizing); |
|
|
|
@ -2005,6 +2017,39 @@ updategeom(void) |
|
|
|
|
return dirty; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void |
|
|
|
|
updatemotifhints(Client *c) |
|
|
|
|
{ |
|
|
|
|
Atom real; |
|
|
|
|
int format; |
|
|
|
|
unsigned char *p = NULL; |
|
|
|
|
unsigned long n, extra; |
|
|
|
|
unsigned long *motif; |
|
|
|
|
int width, height; |
|
|
|
|
|
|
|
|
|
if (!decorhints) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
if (XGetWindowProperty(dpy, c->win, motifatom, 0L, 5L, False, motifatom, |
|
|
|
|
&real, &format, &n, &extra, &p) == Success && p != NULL) { |
|
|
|
|
motif = (unsigned long*)p; |
|
|
|
|
if (motif[MWM_HINTS_FLAGS_FIELD] & MWM_HINTS_DECORATIONS) { |
|
|
|
|
width = WIDTH(c); |
|
|
|
|
height = HEIGHT(c); |
|
|
|
|
|
|
|
|
|
if (motif[MWM_HINTS_DECORATIONS_FIELD] & MWM_DECOR_ALL || |
|
|
|
|
motif[MWM_HINTS_DECORATIONS_FIELD] & MWM_DECOR_BORDER || |
|
|
|
|
motif[MWM_HINTS_DECORATIONS_FIELD] & MWM_DECOR_TITLE) |
|
|
|
|
c->bw = c->oldbw = borderpx; |
|
|
|
|
else |
|
|
|
|
c->bw = c->oldbw = 0; |
|
|
|
|
|
|
|
|
|
resize(c, c->x, c->y, width - (2*c->bw), height - (2*c->bw), 0); |
|
|
|
|
} |
|
|
|
|
XFree(p); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void |
|
|
|
|
updatenumlockmask(void) |
|
|
|
|
{ |
|
|
|
|