static void xclientmsg(XEvent* e)
{
(void)e;
+ /* TODO: handle client messages per ICCCM */
}
static void xpropnotify(XEvent* e)
{
(void)e;
+ /* TODO: update window titles */
+ XPropertyEvent* ev = &(e->xproperty);
+ Client* c = client_get(ev->window);
+ if (c)
+ {
+ client_readprops(c);
+ client_draw(c);
+ }
}
static void xenternotify(XEvent* e)
int x, y, w, h;
} Client;
+enum {
+ STACKED,
+ EXPAND,
+ MONOCOLE
+} TileMode;
+
typedef struct Workspace {
struct Workspace* next;
+ float mfact;
Client* floating;
+ struct {
+ int mode;
+ Client* clients;
+ } cols[2];
} Workspace;
typedef struct Monitor {
void client_close(Client* c);
void client_focus(Client* c);
void client_show(Client* c, int show);
+void client_readprops(Client* c);
/* error.c */
extern int (*error_default)(Display* disp, XErrorEvent* ev);
-int error_ignore(Display* disp, XErrorEvent* ev);
int error_init(Display* disp, XErrorEvent* ev);
int error_panic(Display* disp, XErrorEvent* ev);
c->h = attr->height;
mons_addclient(c);
+ /* TODO: place window on current monitor centered by default */
+
/* get window name */
- Atom actual_type;
- int format;
- unsigned long n, extra;
- XGetWindowProperty(
- X.disp, c->win, XA_WM_NAME, 0L, 100L, False, AnyPropertyType, &actual_type, &format, &n, &extra, (unsigned char **)&c->name);
+ client_readprops(c);
/* get normal hints ? */
/* get registered protocols */
);
XSetWindowAttributes wa;
wa.event_mask = EnterWindowMask | PropertyChangeMask | FocusChangeMask;
- wa.win_gravity = StaticGravity;
wa.do_not_propagate_mask = ButtonPressMask | ButtonReleaseMask;
- XChangeWindowAttributes(X.disp, c->win, CWEventMask | CWWinGravity | CWDontPropagate, &wa);
+ XChangeWindowAttributes(X.disp, c->win, CWEventMask | CWDontPropagate, &wa);
XReparentWindow(X.disp, c->win, c->frame, BORDER_WIDTH, BORDER_WIDTH + TITLE_HEIGHT);
/* Map the window and draw the frame */
XUnmapWindow(X.disp, c->frame);
XUnmapWindow(X.disp, c->win);
}
-}
\ No newline at end of file
+}
+
+void client_readprops(Client* c)
+{
+ Atom actual_type;
+ int format;
+ unsigned long n, extra;
+ xfree(c->name);
+ c->name = NULL;
+ XGetWindowProperty(
+ X.disp, c->win, XA_WM_NAME, 0L, 100L, False, AnyPropertyType, &actual_type, &format, &n, &extra, (unsigned char **)&c->name);
+}