From ed0710fb9efbab2c5f6009fef76a452db11f25c5 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Thu, 27 Jun 2013 01:54:55 +0000 Subject: cleanup --- spectrogram.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'spectrogram.c') diff --git a/spectrogram.c b/spectrogram.c index aefaa6b..ca65521 100644 --- a/spectrogram.c +++ b/spectrogram.c @@ -304,7 +304,7 @@ main(int argc, char **argv) Display *dsp; Window win; Atom delwin; - Atom shints; + Atom nhints; XSizeHints *hints; int scr; @@ -352,26 +352,28 @@ main(int argc, char **argv) win = XCreateSimpleWindow(dsp, RootWindow(dsp, scr), 0, 0, width, height, 0, white, black); - XClearWindow(dsp, win); XStoreName(dsp, win, __progname); XSelectInput(dsp, win, KeyPressMask); + /* catch delete window */ delwin = XInternAtom(dsp, "WM_DELETE_WINDOW", 0); XSetWMProtocols(dsp, win, &delwin, 1); - shints = XInternAtom(dsp, "WM_NORMAL_HINTS", 0); + /* set minimal size */ + nhints = XInternAtom(dsp, "WM_NORMAL_HINTS", 0); hints = XAllocSizeHints(); hints->flags = PMinSize; hints->min_width = width; hints->min_height = height; - XSetWMSizeHints(dsp, win, hints, shints); + XSetWMSizeHints(dsp, win, hints, nhints); XFree(hints); left = init_panel(dsp, win, 0, 0, delta / 2, height, 1); right = init_panel(dsp, win, delta / 2 + GAP, 0, delta / 2, height, 0); fft = init_fft(delta); + XClearWindow(dsp, win); XMapWindow(dsp, win); while (!die) { @@ -410,6 +412,8 @@ main(int argc, char **argv) del_fft(fft); del_panel(dsp, left); del_panel(dsp, right); + XDestroySubwindows(dsp, win); + XDestroyWindow(dsp, win); XCloseDisplay(dsp); return 0; -- cgit v1.2.3