diff options
author | B. Watson <urchlay@slackware.uk> | 2024-01-10 12:54:54 -0500 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2024-01-10 12:54:54 -0500 |
commit | 088c769de46c4c1540c96c8b48bf17e3b093e0f6 (patch) | |
tree | 65f8cf49806c419b9d9fa2ce958680e7bc303977 /input.c | |
parent | 695ba0c4fae1e4e2d1629d45fcb9540276deee65 (diff) | |
download | hcalc-088c769de46c4c1540c96c8b48bf17e3b093e0f6.tar.gz |
Switch window sizes without re-executing (leaks a bit though).
Diffstat (limited to 'input.c')
-rw-r--r-- | input.c | 44 |
1 files changed, 11 insertions, 33 deletions
@@ -430,49 +430,27 @@ void key(char c) { exit(0); case 'z': - { - /* dirty hack method of changing window size: - re-execute ourselves with appropriate argument. - TODO: see if this leaks memory, fds, etc */ - extern char *self; - char *args[4]; - - args[0] = self; - - switch (winsize) { - case 0: - args[1] = "-medium"; - break; - case 1: - args[1] = "-large"; - break; - case 2: - args[1] = "-small"; - break; - } - - args[2] = NULL; - - /* note that atexit() functions do NOT get called on execv() */ - save_config(); - - XCloseDisplay(display); - - execv(self, args); - } + winsize++; + if(winsize == 3) winsize = 0; + free_pixmaps(); + XCloseDisplay(display); + setup_x(); + load_pixmaps(); + show_value(); + break; } } static char *bmap[] = { - "PPPP\033", /* mouse copy and paste, CLR */ - "DHOB\010", /* DEC, HEX, OCT, BIN, DEL */ + "PPPP\033", /* mouse copy and paste, CLR */ + "DHOB\010", /* DEC, HEX, OCT, BIN, DEL */ "[]}<>", /* STO, RCL, SUM, <<, >> */ "Sdef/", /* SHF, D E F / */ "~abc*", /* INV, */ "|789-", /* OR, */ "&456+", /* AND, */ "^123=", /* XOR, */ - "u0._=" /* CE, 0, . , +/-, = */ + "u0._=" /* CE, 0, . , +/-, = */ }; void copy(void) { |