aboutsummaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorgotmor <gotmor@f2baff5b-bf2c-0410-a398-912abdc3d8b2>2007-06-05 18:45:50 +0000
committergotmor <gotmor@f2baff5b-bf2c-0410-a398-912abdc3d8b2>2007-06-05 18:45:50 +0000
commitd3e8494013ab3aa145857689bdca6faa56085205 (patch)
tree058d7a348b61b9720093e5eba6a75eb3c6eed9f8 /main.c
parent70da25bb9ab1cc3a3a7a6dcd304e9151d91c50ea (diff)
downloaddzen-d3e8494013ab3aa145857689bdca6faa56085205.tar.gz
dzen-d3e8494013ab3aa145857689bdca6faa56085205.zip
slightly better method to calculate the entry width for the horizontal menu,
this leaves no gaps git-svn-id: http://dzen.googlecode.com/svn/trunk@68 f2baff5b-bf2c-0410-a398-912abdc3d8b2
Diffstat (limited to 'main.c')
-rw-r--r--main.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/main.c b/main.c
index 0fa2b80..01f5b4d 100644
--- a/main.c
+++ b/main.c
@@ -270,9 +270,11 @@ x_create_windows(void) {
dzen.title_win.drawable = XCreatePixmap(dzen.dpy, root, dzen.title_win.width,
dzen.line_height, DefaultDepth(dzen.dpy, dzen.screen));
- /* TODO: Smarter approach to window creation so we can reduce the
- size of this function
+ /* TODO: For next release
+ Smarter approach to window creation so we can reduce the
+ size of this function.
*/
+
/* vertical menu mode */
if(dzen.slave_win.ishmenu && dzen.slave_win.max_lines) {
dzen.slave_win.first_line_vis = 0;
@@ -280,28 +282,28 @@ x_create_windows(void) {
dzen.slave_win.issticky = False;
dzen.slave_win.y = dzen.title_win.y;
- int entrywidth = dzen.slave_win.width / dzen.slave_win.max_lines;
-
dzen.slave_win.win = XCreateWindow(dzen.dpy, root,
dzen.slave_win.x, dzen.slave_win.y, dzen.slave_win.width, dzen.line_height, 0,
DefaultDepth(dzen.dpy, dzen.screen), CopyFromParent,
DefaultVisual(dzen.dpy, dzen.screen),
CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
+
+ int ew = dzen.slave_win.width / dzen.slave_win.max_lines;
+ int r = dzen.slave_win.width - ew * dzen.slave_win.max_lines;
- dzen.slave_win.drawable = XCreatePixmap(dzen.dpy, root, entrywidth,
+ dzen.slave_win.drawable = XCreatePixmap(dzen.dpy, root, ew+r,
dzen.line_height, DefaultDepth(dzen.dpy, dzen.screen));
/* windows holding the lines */
dzen.slave_win.line = emalloc(sizeof(Window) * dzen.slave_win.max_lines);
- for(i=0; i < dzen.slave_win.max_lines; i++) {
+ for(i=0; i < dzen.slave_win.max_lines; i++)
dzen.slave_win.line[i] = XCreateWindow(dzen.dpy, dzen.slave_win.win,
- i*entrywidth, 0, entrywidth, dzen.line_height, 0,
+ i*ew, 0, (i == dzen.slave_win.max_lines-1) ? ew+r : ew, dzen.line_height, 0,
DefaultDepth(dzen.dpy, dzen.screen), CopyFromParent,
DefaultVisual(dzen.dpy, dzen.screen),
CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
- }
- dzen.slave_win.width = entrywidth;
+ dzen.slave_win.width = ew+r;
}
/* slave window */