diff --git a/src/bar.c b/src/bar.c index 1879dfb..e522d74 100644 --- a/src/bar.c +++ b/src/bar.c @@ -33,7 +33,7 @@ #include "wmfs.h" BarWindow* -bar_create(int x, int y, uint w, uint h, int bord, uint color, Bool entermask) +bar_create(Window parent, int x, int y, uint w, uint h, int bord, uint color, Bool entermask) { XSetWindowAttributes at; BarWindow *bw; @@ -50,10 +50,10 @@ bar_create(int x, int y, uint w, uint h, int bord, uint color, Bool entermask) at.event_mask = SubstructureRedirectMask | SubstructureNotifyMask | ButtonPressMask | ExposureMask | StructureNotifyMask; - bw->win = XCreateWindow(dpy, root, x, y, w, h, bord, DefaultDepth(dpy, screen), + bw->win = XCreateWindow(dpy, parent, x, y, w, h, bord, DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen), CWOverrideRedirect | CWBackPixmap | CWEventMask, &at); - bw->dr = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen)); + bw->dr = XCreatePixmap(dpy, parent, w, h, DefaultDepth(dpy, screen)); bw->geo.x = x; bw->geo.y = y; diff --git a/src/event.c b/src/event.c index 52b4c10..4ee988f 100644 --- a/src/event.c +++ b/src/event.c @@ -128,9 +128,10 @@ configurerequest(XEvent ev) XRectangle geo; if((c = client_get(ev.xconfigurerequest.window))) - if(c->tile || c->lmax) - return; - + { + CHECK(!c->tile); + CHECK(!c->lmax); + } geo.x = wc.x = ev.xconfigurerequest.x; geo.y = wc.y = ev.xconfigurerequest.y; geo.width = wc.width = ev.xconfigurerequest.width; @@ -338,7 +339,7 @@ getevent(void) case MapRequest: maprequest(event); break; case MappingNotify: mapnotify(event); break; case PropertyNotify: propertynotify(event); break; - case UnmapNotify: unmapnotify(event); break; + //case UnmapNotify: unmapnotify(event); break; } return; diff --git a/src/frame.c b/src/frame.c index 606c560..992eb83 100644 --- a/src/frame.c +++ b/src/frame.c @@ -40,18 +40,17 @@ frame_create(Client *c) at.background_pixel = conf.client.bordernormal; at.background_pixmap = ParentRelative; at.override_redirect = True; - at.event_mask = SubstructureRedirectMask | SubstructureNotifyMask | - ExposureMask | VisibilityChangeMask | EnterWindowMask | - FocusChangeMask | KeyMask | ButtonMask | MouseMask; + at.event_mask = SubstructureRedirectMask|SubstructureNotifyMask|ExposureMask| + VisibilityChangeMask|EnterWindowMask|FocusChangeMask|KeyMask|ButtonMask|MouseMask; /* Set size */ - c->frame_geo.x = c->geo.x - conf.client.borderheight; - c->frame_geo.y = c->geo.y - conf.titlebar.height; + c->frame_geo.x = c->geo.x - BORDH; + c->frame_geo.y = c->geo.y - TBARH; c->frame_geo.width = FRAMEW(c->geo.width); c->frame_geo.height = FRAMEH(c->geo.height); - c->colors.frame = conf.client.bordernormal; - c->colors.resizecorner = conf.client.resizecorner_normal; - c->colors.titlebar = conf.titlebar.fg_normal; + c->colors.frame = conf.client.bordernormal; + c->colors.resizecorner = conf.client.resizecorner_normal; + c->colors.titlebar = conf.titlebar.fg_normal; /* Create frame window */ c->frame = XCreateWindow(dpy, root, @@ -84,9 +83,7 @@ frame_create(Client *c) XSetWindowBackground(dpy, c->frame, c->colors.frame); /* Reparent window with the frame */ - XReparentWindow(dpy, c->win, c->frame, - conf.client.borderheight, - conf.titlebar.height + conf.client.borderheight); + XReparentWindow(dpy, c->win, c->frame, BORDH, BORDH + TBARH); return; } @@ -94,8 +91,8 @@ frame_create(Client *c) void frame_moveresize(Client *c, XRectangle geo) { - c->frame_geo.x = geo.x - conf.client.borderheight; - c->frame_geo.y = geo.y - conf.titlebar.height; + c->frame_geo.x = geo.x - BORDH; + c->frame_geo.y = geo.y - TBARH; c->frame_geo.width = FRAMEW(geo.width); c->frame_geo.height = FRAMEH(geo.height); diff --git a/src/infobar.c b/src/infobar.c index ec65352..da4c0ae 100644 --- a/src/infobar.c +++ b/src/infobar.c @@ -39,13 +39,13 @@ infobar_init(InfoBar *ib) ib->geo.y = (conf.bartop) ? 0 : MAXH - ib->geo.height; /* Create infobar barwindow */ - ib->bar = bar_create(0, ib->geo.y, MAXW, ib->geo.height, 0, conf.colors.bar, False); + ib->bar = bar_create(root, 0, ib->geo.y, MAXW, ib->geo.height, 0, conf.colors.bar, False); /* Create layout switch & layout type switch barwindow */ - ib->layout_switch = bar_create(0, (conf.bartop) ? ib->geo.y : ib->geo.y + 1, + ib->layout_switch = bar_create(ib->bar->win, 0, 0, 1, ib->geo.height - 1, 0, conf.colors.layout_bg, False); - ib->layout_type_switch = bar_create(0, ib->geo.y, + ib->layout_type_switch = bar_create(ib->bar->win, 0, 0, 1, ib->geo.height, 0, conf.colors.layout_bg, False); @@ -111,7 +111,6 @@ infobar_draw_layout(void) /* Set symbol & position */ px = width = taglen[conf.ntag]; - py = conf.bartop ? infobar.geo.y : infobar.geo.y + 1; if(tags[seltag].layout.func == freelayout || tags[seltag].layout.func == maxlayout) strcpy(symbol, tags[seltag].layout.symbol); @@ -121,8 +120,8 @@ infobar_draw_layout(void) /* Draw layout name/symbol */ bar_refresh_color(infobar.layout_switch); - bar_move(infobar.layout_switch, px, py); - bar_resize(infobar.layout_switch, textw(symbol) + PAD, infobar.geo.height - 1); + bar_move(infobar.layout_switch, px, 0); + bar_resize(infobar.layout_switch, textw(symbol) + PAD, infobar.geo.height); draw_text(infobar.layout_switch->dr, PAD/2, font->height, conf.colors.layout_fg, conf.colors.layout_bg, @@ -136,7 +135,7 @@ infobar_draw_layout(void) bar_map(infobar.layout_type_switch); bar_refresh_color(infobar.layout_type_switch); bar_move(infobar.layout_type_switch, px + infobar.layout_switch->geo.width + PAD/2, py); - bar_resize(infobar.layout_type_switch, textw(tags[seltag].layout.symbol) + PAD, infobar.geo.height - 1); + bar_resize(infobar.layout_type_switch, textw(tags[seltag].layout.symbol) + PAD, infobar.geo.height); draw_text(infobar.layout_type_switch->dr, PAD/2, font->height, conf.colors.layout_fg, conf.colors.layout_bg, diff --git a/src/layout.c b/src/layout.c index a2050d8..1c6a454 100644 --- a/src/layout.c +++ b/src/layout.c @@ -151,12 +151,14 @@ maxlayout(void) { c->tile = False; c->lmax = True; - c->ogeo.x = c->geo.x; c->ogeo.y = c->geo.y; - c->ogeo.width = c->geo.width; c->ogeo.height = c->geo.height; + c->ogeo.x = c->geo.x; + c->ogeo.y = c->geo.y; + c->ogeo.width = c->geo.width; + c->ogeo.height = c->geo.height; geo.x = sgeo.x; geo.y = sgeo.y; - geo.width = sgeo.width - (c->border * 2); - geo.height = sgeo.height - (c->border * 2); + geo.width = sgeo.width - BORDH * 2; + geo.height = sgeo.height - BORDH * 2; client_moveresize(c, geo, False); } diff --git a/src/wmfs.h b/src/wmfs.h index 6ae157a..c4e49bc 100644 --- a/src/wmfs.h +++ b/src/wmfs.h @@ -73,7 +73,7 @@ #define PAD 8 /* bar.c */ -BarWindow *bar_create(int x, int y, uint w, uint h, int bord, uint color, Bool entermask); +BarWindow *bar_create(Window parent, int x, int y, uint w, uint h, int bord, uint color, Bool entermask); void bar_delete(BarWindow *bw); void bar_map(BarWindow *bw); void bar_unmap(BarWindow *bw);