aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spectrogram.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/spectrogram.c b/spectrogram.c
index ab8df8d..4dc10d6 100644
--- a/spectrogram.c
+++ b/spectrogram.c
@@ -450,25 +450,29 @@ main(int argc, char **argv)
if (dflag)
daemon(0, 0);
+
+ sio = init_sio();
+ maxwidth = max_samples_sio(sio);
+ maxheight = wa.height;
dsp = XOpenDisplay(NULL);
if (!dsp)
errx(1, "Cannot connect to X11 server");
+ if (round > maxwidth)
+ round = maxwidth;
+
XGetWindowAttributes(dsp, DefaultRootWindow(dsp), &wa);
width = round + HGAP;
if (fflag || width > wa.width) {
round = wa.width - HGAP;
width = wa.width;
}
+
height = factor * width;
if (height > wa.height)
height = wa.height;
- sio = init_sio();
- maxwidth = max_samples_sio(sio);
- maxheight = wa.height;
-
scr = DefaultScreen(dsp);
white = WhitePixel(dsp, scr);
black = BlackPixel(dsp, scr);