From d1887254185319610e2e565cf72e36024186ded8 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Thu, 4 Sep 2014 16:27:20 +0000 Subject: limit max round --- spectrogram.c | 12 ++++++++---- 1 file 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); -- cgit v1.2.3