Stop farting around with dialog box potential sizes and make it a ratio.

This ratio can be configured in the .conf file.
This commit is contained in:
Marco Peereboom 2009-01-18 04:48:04 +00:00
parent cae2f7f137
commit 683a0c71ea
2 changed files with 17 additions and 3 deletions

View file

@ -116,6 +116,8 @@ unsigned long color_unfocus = 0x888888;
Display *display;
Window root;
/* dialog windows */
double dialog_ratio = .6;
/* status bar */
int bar_enabled = 1;
int bar_height = 0;
@ -273,6 +275,16 @@ conf_load(char *filename)
goto bad;
break;
case 'd':
if (!strncmp(var, "dialog_ratio",
strlen("dialog_ratio"))) {
dialog_ratio = atof(val);
if (dialog_ratio > 1.0 || dialog_ratio <= .3)
dialog_ratio = .6;
} else
goto bad;
break;
case 's':
if (!strncmp(var, "spawn_term", strlen("spawn_term")))
asprintf(&spawn_term[0], "%s", val); /* XXX args? */
@ -659,9 +671,8 @@ stack_floater(struct ws_win *win)
mask = CWX | CWY | CWBorderWidth | CWWidth | CWHeight;
wc.border_width = 1;
if (win->transient) {
/* XXX dialog window, make it bigger but not too big */
win->g.w *= 2;
win->g.h *= 2;
win->g.w = (double)WIDTH * dialog_ratio;
win->g.h = (double)HEIGHT * dialog_ratio;
}
wc.width = win->g.w;
wc.height = win->g.h;

View file

@ -11,3 +11,6 @@ bar_font = -*-terminus-*-*-*-*-*-*-*-*-*-*-*-*
# spawn app
spawn_term = xterm
# dialog box size ratio .3 >= r < 1
dialog_ratio = 0.6