aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2014-09-04 16:27:20 +0000
committerDimitri Sokolyuk <demon@dim13.org>2014-09-04 16:27:20 +0000
commitd1887254185319610e2e565cf72e36024186ded8 (patch)
tree12cb6cb21a102cee4355cc44f12f1fce7ca3f143
parentc8f80382fda562988b5392c365024058f9a0f1dd (diff)
limit max round
-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);