]> code.delx.au - spectrwm/commitdiff
Stop farting around with dialog box potential sizes and make it a ratio.
authorMarco Peereboom <marco@conformal.com>
Sun, 18 Jan 2009 04:48:04 +0000 (04:48 +0000)
committerMarco Peereboom <marco@conformal.com>
Sun, 18 Jan 2009 04:48:04 +0000 (04:48 +0000)
This ratio can be configured in the .conf file.

scrotwm.c
scrotwm.conf

index 1a517fc5d538bd23c02e98c4aa2533f34acd638c..29f4694ccd279cf59fa98d23bd6ce66be453c41a 100644 (file)
--- 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;
index 9b9e6da523ba4f9512884ab961613cefe8838951..8b11ae02796812e1c63414e496b1764557004a0f 100644 (file)
@@ -11,3 +11,6 @@ bar_font      = -*-terminus-*-*-*-*-*-*-*-*-*-*-*-*
 
 # spawn app
 spawn_term     = xterm
+
+# dialog box size ratio .3 >= r < 1
+dialog_ratio   = 0.6