summaryrefslogtreecommitdiffstats
path: root/client.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--client.c50
1 files changed, 30 insertions, 20 deletions
diff --git a/client.c b/client.c
index c11d5d5..b1b1417 100644
--- a/client.c
+++ b/client.c
@@ -44,6 +44,24 @@ update_name(Client *c)
44} 44}
45 45
46void 46void
47update_size(Client *c)
48{
49 XSizeHints size;
50 long msize;
51 if(!XGetWMNormalHints(dpy, c->win, &size, &msize) || !size.flags)
52 size.flags = PSize;
53 c->flags = size.flags;
54 c->basew = size.base_width;
55 c->baseh = size.base_height;
56 c->incw = size.width_inc;
57 c->inch = size.height_inc;
58 c->maxw = size.max_width;
59 c->maxh = size.max_height;
60 c->minw = size.min_width;
61 c->minh = size.min_height;
62}
63
64void
47focus(Client *c) 65focus(Client *c)
48{ 66{
49 Client **l; 67 Client **l;
@@ -62,31 +80,24 @@ manage(Window w, XWindowAttributes *wa)
62{ 80{
63 Client *c, **l; 81 Client *c, **l;
64 XSetWindowAttributes twa; 82 XSetWindowAttributes twa;
65 long msize;
66 83
67 c = emallocz(sizeof(Client)); 84 c = emallocz(sizeof(Client));
68 c->win = w; 85 c->win = w;
69 c->r[RFloat].x = wa->x; 86 c->x = wa->x;
70 c->r[RFloat].y = wa->y; 87 c->y = wa->y;
71 c->r[RFloat].width = wa->width; 88 c->w = wa->width;
72 c->r[RFloat].height = wa->height; 89 c->h = wa->height;
90 update_size(c);
73 XSetWindowBorderWidth(dpy, c->win, 1); 91 XSetWindowBorderWidth(dpy, c->win, 1);
74 XSelectInput(dpy, c->win, CLIENT_MASK); 92 XSelectInput(dpy, c->win, CLIENT_MASK);
75 XGetTransientForHint(dpy, c->win, &c->trans); 93 XGetTransientForHint(dpy, c->win, &c->trans);
76 if(!XGetWMNormalHints(dpy, c->win, &c->size, &msize) || !c->size.flags)
77 c->size.flags = PSize;
78 c->fixedsize =
79 (c->size.flags & PMinSize && c->size.flags & PMaxSize
80 && c->size.min_width == c->size.max_width
81 && c->size.min_height == c->size.max_height);
82 update_name(c); 94 update_name(c);
83 twa.override_redirect = 1; 95 twa.override_redirect = 1;
84 twa.background_pixmap = ParentRelative; 96 twa.background_pixmap = ParentRelative;
85 twa.event_mask = ExposureMask; 97 twa.event_mask = ExposureMask;
86 98
87 c->title = XCreateWindow(dpy, root, c->r[RFloat].x, c->r[RFloat].y, 99 c->title = XCreateWindow(dpy, root, c->x, c->y, c->w, barrect.height,
88 c->r[RFloat].width, barrect.height, 0, 100 0, DefaultDepth(dpy, screen), CopyFromParent,
89 DefaultDepth(dpy, screen), CopyFromParent,
90 DefaultVisual(dpy, screen), 101 DefaultVisual(dpy, screen),
91 CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa); 102 CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa);
92 103
@@ -110,15 +121,14 @@ resize(Client *c)
110{ 121{
111 XConfigureEvent e; 122 XConfigureEvent e;
112 123
113 XMoveResizeWindow(dpy, c->win, c->r[RFloat].x, c->r[RFloat].y, 124 XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
114 c->r[RFloat].width, c->r[RFloat].height);
115 e.type = ConfigureNotify; 125 e.type = ConfigureNotify;
116 e.event = c->win; 126 e.event = c->win;
117 e.window = c->win; 127 e.window = c->win;
118 e.x = c->r[RFloat].x; 128 e.x = c->x;
119 e.y = c->r[RFloat].y; 129 e.y = c->y;
120 e.width = c->r[RFloat].width; 130 e.width = c->w;
121 e.height = c->r[RFloat].height; 131 e.height = c->h;
122 e.border_width = 0; 132 e.border_width = 0;
123 e.above = None; 133 e.above = None;
124 e.override_redirect = False; 134 e.override_redirect = False;