layout: Fix max layout

This commit is contained in:
Martin Duquesnoy 2008-11-08 23:29:34 +01:00
parent ba425f172f
commit c4f86043ce
6 changed files with 31 additions and 32 deletions

View File

@ -33,7 +33,7 @@
#include "wmfs.h" #include "wmfs.h"
BarWindow* 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; XSetWindowAttributes at;
BarWindow *bw; 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 | at.event_mask = SubstructureRedirectMask | SubstructureNotifyMask |
ButtonPressMask | ExposureMask | StructureNotifyMask; 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), CopyFromParent, DefaultVisual(dpy, screen),
CWOverrideRedirect | CWBackPixmap | CWEventMask, &at); 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.x = x;
bw->geo.y = y; bw->geo.y = y;

View File

@ -128,9 +128,10 @@ configurerequest(XEvent ev)
XRectangle geo; XRectangle geo;
if((c = client_get(ev.xconfigurerequest.window))) 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.x = wc.x = ev.xconfigurerequest.x;
geo.y = wc.y = ev.xconfigurerequest.y; geo.y = wc.y = ev.xconfigurerequest.y;
geo.width = wc.width = ev.xconfigurerequest.width; geo.width = wc.width = ev.xconfigurerequest.width;
@ -338,7 +339,7 @@ getevent(void)
case MapRequest: maprequest(event); break; case MapRequest: maprequest(event); break;
case MappingNotify: mapnotify(event); break; case MappingNotify: mapnotify(event); break;
case PropertyNotify: propertynotify(event); break; case PropertyNotify: propertynotify(event); break;
case UnmapNotify: unmapnotify(event); break; //case UnmapNotify: unmapnotify(event); break;
} }
return; return;

View File

@ -40,18 +40,17 @@ frame_create(Client *c)
at.background_pixel = conf.client.bordernormal; at.background_pixel = conf.client.bordernormal;
at.background_pixmap = ParentRelative; at.background_pixmap = ParentRelative;
at.override_redirect = True; at.override_redirect = True;
at.event_mask = SubstructureRedirectMask | SubstructureNotifyMask | at.event_mask = SubstructureRedirectMask|SubstructureNotifyMask|ExposureMask|
ExposureMask | VisibilityChangeMask | EnterWindowMask | VisibilityChangeMask|EnterWindowMask|FocusChangeMask|KeyMask|ButtonMask|MouseMask;
FocusChangeMask | KeyMask | ButtonMask | MouseMask;
/* Set size */ /* Set size */
c->frame_geo.x = c->geo.x - conf.client.borderheight; c->frame_geo.x = c->geo.x - BORDH;
c->frame_geo.y = c->geo.y - conf.titlebar.height; c->frame_geo.y = c->geo.y - TBARH;
c->frame_geo.width = FRAMEW(c->geo.width); c->frame_geo.width = FRAMEW(c->geo.width);
c->frame_geo.height = FRAMEH(c->geo.height); c->frame_geo.height = FRAMEH(c->geo.height);
c->colors.frame = conf.client.bordernormal; c->colors.frame = conf.client.bordernormal;
c->colors.resizecorner = conf.client.resizecorner_normal; c->colors.resizecorner = conf.client.resizecorner_normal;
c->colors.titlebar = conf.titlebar.fg_normal; c->colors.titlebar = conf.titlebar.fg_normal;
/* Create frame window */ /* Create frame window */
c->frame = XCreateWindow(dpy, root, c->frame = XCreateWindow(dpy, root,
@ -84,9 +83,7 @@ frame_create(Client *c)
XSetWindowBackground(dpy, c->frame, c->colors.frame); XSetWindowBackground(dpy, c->frame, c->colors.frame);
/* Reparent window with the frame */ /* Reparent window with the frame */
XReparentWindow(dpy, c->win, c->frame, XReparentWindow(dpy, c->win, c->frame, BORDH, BORDH + TBARH);
conf.client.borderheight,
conf.titlebar.height + conf.client.borderheight);
return; return;
} }
@ -94,8 +91,8 @@ frame_create(Client *c)
void void
frame_moveresize(Client *c, XRectangle geo) frame_moveresize(Client *c, XRectangle geo)
{ {
c->frame_geo.x = geo.x - conf.client.borderheight; c->frame_geo.x = geo.x - BORDH;
c->frame_geo.y = geo.y - conf.titlebar.height; c->frame_geo.y = geo.y - TBARH;
c->frame_geo.width = FRAMEW(geo.width); c->frame_geo.width = FRAMEW(geo.width);
c->frame_geo.height = FRAMEH(geo.height); c->frame_geo.height = FRAMEH(geo.height);

View File

@ -39,13 +39,13 @@ infobar_init(InfoBar *ib)
ib->geo.y = (conf.bartop) ? 0 : MAXH - ib->geo.height; ib->geo.y = (conf.bartop) ? 0 : MAXH - ib->geo.height;
/* Create infobar barwindow */ /* 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 */ /* 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, 1, ib->geo.height - 1, 0,
conf.colors.layout_bg, False); 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, 1, ib->geo.height,
0, conf.colors.layout_bg, False); 0, conf.colors.layout_bg, False);
@ -111,7 +111,6 @@ infobar_draw_layout(void)
/* Set symbol & position */ /* Set symbol & position */
px = width = taglen[conf.ntag]; px = width = taglen[conf.ntag];
py = conf.bartop ? infobar.geo.y : infobar.geo.y + 1;
if(tags[seltag].layout.func == freelayout if(tags[seltag].layout.func == freelayout
|| tags[seltag].layout.func == maxlayout) || tags[seltag].layout.func == maxlayout)
strcpy(symbol, tags[seltag].layout.symbol); strcpy(symbol, tags[seltag].layout.symbol);
@ -121,8 +120,8 @@ infobar_draw_layout(void)
/* Draw layout name/symbol */ /* Draw layout name/symbol */
bar_refresh_color(infobar.layout_switch); bar_refresh_color(infobar.layout_switch);
bar_move(infobar.layout_switch, px, py); bar_move(infobar.layout_switch, px, 0);
bar_resize(infobar.layout_switch, textw(symbol) + PAD, infobar.geo.height - 1); bar_resize(infobar.layout_switch, textw(symbol) + PAD, infobar.geo.height);
draw_text(infobar.layout_switch->dr, PAD/2, font->height, draw_text(infobar.layout_switch->dr, PAD/2, font->height,
conf.colors.layout_fg, conf.colors.layout_fg,
conf.colors.layout_bg, conf.colors.layout_bg,
@ -136,7 +135,7 @@ infobar_draw_layout(void)
bar_map(infobar.layout_type_switch); bar_map(infobar.layout_type_switch);
bar_refresh_color(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_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, draw_text(infobar.layout_type_switch->dr, PAD/2, font->height,
conf.colors.layout_fg, conf.colors.layout_fg,
conf.colors.layout_bg, conf.colors.layout_bg,

View File

@ -151,12 +151,14 @@ maxlayout(void)
{ {
c->tile = False; c->tile = False;
c->lmax = True; c->lmax = True;
c->ogeo.x = c->geo.x; c->ogeo.y = c->geo.y; c->ogeo.x = c->geo.x;
c->ogeo.width = c->geo.width; c->ogeo.height = c->geo.height; 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.x = sgeo.x; geo.y = sgeo.y;
geo.width = sgeo.width - (c->border * 2); geo.width = sgeo.width - BORDH * 2;
geo.height = sgeo.height - (c->border * 2); geo.height = sgeo.height - BORDH * 2;
client_moveresize(c, geo, False); client_moveresize(c, geo, False);
} }

View File

@ -73,7 +73,7 @@
#define PAD 8 #define PAD 8
/* bar.c */ /* 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_delete(BarWindow *bw);
void bar_map(BarWindow *bw); void bar_map(BarWindow *bw);
void bar_unmap(BarWindow *bw); void bar_unmap(BarWindow *bw);