make ewmh dialog windows float 8262d9e6
Christoph Lohmann · 2011-11-02 12:01 1 file(s) · +27 −1
dwm.c +27 −1
58 58
enum { CurNormal, CurResize, CurMove, CurLast };        /* cursor */
59 59
enum { ColBorder, ColFG, ColBG, ColLast };              /* color */
60 60
enum { NetSupported, NetWMName, NetWMState,
61 -
       NetWMFullscreen, NetActiveWindow, NetLast };     /* EWMH atoms */
61 +
       NetWMFullscreen, NetActiveWindow, NetWMWindowType,
62 +
       NetWMWindowTypeDialog, NetLast };     /* EWMH atoms */
62 63
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
63 64
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
64 65
       ClkClientWin, ClkRootWin, ClkLast };             /* clicks */
237 238
static void updatenumlockmask(void);
238 239
static void updatesizehints(Client *c);
239 240
static void updatestatus(void);
241 +
static void updatewindowtype(Client *c);
240 242
static void updatetitle(Client *c);
241 243
static void updatewmhints(Client *c);
242 244
static void view(const Arg *arg);
1152 1154
	XConfigureWindow(dpy, w, CWBorderWidth, &wc);
1153 1155
	XSetWindowBorder(dpy, w, dc.norm[ColBorder]);
1154 1156
	configure(c); /* propagates border_width, if size doesn't change */
1157 +
	updatewindowtype(c);
1155 1158
	updatesizehints(c);
1156 1159
	updatewmhints(c);
1157 1160
	XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
1308 1311
			if(c == c->mon->sel)
1309 1312
				drawbar(c->mon);
1310 1313
		}
1314 +
		if(ev->atom == netatom[NetWMWindowType])
1315 +
			updatewindowtype(c);
1311 1316
	}
1312 1317
}
1313 1318
1562 1567
	netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
1563 1568
	netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False);
1564 1569
	netatom[NetWMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False);
1570 +
	netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
1571 +
	netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False);
1565 1572
	/* init cursors */
1566 1573
	cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr);
1567 1574
	cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing);
1964 1971
	if(!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
1965 1972
		strcpy(stext, "dwm-"VERSION);
1966 1973
	drawbar(selmon);
1974 +
}
1975 +
1976 +
void
1977 +
updatewindowtype(Client *c)
1978 +
{
1979 +
	Atom wtype, real;
1980 +
	int format;
1981 +
	unsigned long n, extra;
1982 +
	unsigned char *p = NULL;
1983 +
1984 +
	if(XGetWindowProperty(dpy, c->win, netatom[NetWMWindowType], 0L,
1985 +
	                      sizeof(Atom), False, XA_ATOM, &real, &format,
1986 +
	                      &n, &extra, (unsigned char **)&p) == Success && p) {
1987 +
		wtype = *(Atom *)p;
1988 +
		XFree(p);
1989 +
1990 +
		if(wtype == netatom[NetWMWindowTypeDialog])
1991 +
			c->isfloating = True;
1992 +
	}
1967 1993
}
1968 1994
1969 1995
void