From 683a0c71ea5f54022beae08da39914e6033bd9ee Mon Sep 17 00:00:00 2001 From: Marco Peereboom Date: Sun, 18 Jan 2009 04:48:04 +0000 Subject: [PATCH] Stop farting around with dialog box potential sizes and make it a ratio. This ratio can be configured in the .conf file. --- scrotwm.c | 17 ++++++++++++++--- scrotwm.conf | 3 +++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/scrotwm.c b/scrotwm.c index 1a517fc..29f4694 100644 --- a/scrotwm.c +++ b/scrotwm.c @@ -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; diff --git a/scrotwm.conf b/scrotwm.conf index 9b9e6da..8b11ae0 100644 --- a/scrotwm.conf +++ b/scrotwm.conf @@ -11,3 +11,6 @@ bar_font = -*-terminus-*-*-*-*-*-*-*-*-*-*-*-* # spawn app spawn_term = xterm + +# dialog box size ratio .3 >= r < 1 +dialog_ratio = 0.6 -- 1.7.10.4