# HG changeset patch # User Mike Becker # Date 1788192230 -7200 # Node ID 6960625e62e0ae33c166395587e0a6a52fe0ebd6 # Parent b61c2b90f19c042bc0b3871902551c1b8c9ed8e7 fix getmaxy() not being available in POSIX curses diff -r b61c2b90f19c -r 6960625e62e0 src/input.c --- a/src/input.c Mon Aug 31 17:56:17 2026 +0200 +++ b/src/input.c Mon Aug 31 18:03:50 2026 +0200 @@ -79,3 +79,11 @@ return 0; } + +int input_getmaxy(void) { + /* POSIX-curses-compliant wrapper for getmaxy() */ + int x, y; + getmaxyx(stdscr, y, x); + (void)x; + return y; +} diff -r b61c2b90f19c -r 6960625e62e0 src/input.h --- a/src/input.h Mon Aug 31 17:56:17 2026 +0200 +++ b/src/input.h Mon Aug 31 18:03:50 2026 +0200 @@ -50,6 +50,7 @@ */ int asyncgetnstr(char *str, size_t *pos, size_t len); +int input_getmaxy(void); #ifdef __cplusplus } diff -r b61c2b90f19c -r 6960625e62e0 src/main.c --- a/src/main.c Mon Aug 31 17:56:17 2026 +0200 +++ b/src/main.c Mon Aug 31 18:03:50 2026 +0200 @@ -404,7 +404,12 @@ } static void save_pgn(GameState *gamestate) { - int y = getcury(stdscr); + int y; + { + int x; + getyx(stdscr, y, x); + (void)x; /* we want to be POSIX curses compliant */ + } /* ask for player names */ { @@ -895,7 +900,7 @@ draw_board(&viewedstate, WHITE); timecontrol(&viewedstate); - move(getmaxy(stdscr)-5, 0); + move(input_getmaxy()-5, 0); if (gamestate->wresign) { addstr("White resigned.\n"); } else if (gamestate->bresign) { @@ -962,7 +967,7 @@ } static void game_play_singlemachine(GameState *gamestate) { - inputy = getmaxy(stdscr) - 6; + inputy = input_getmaxy() - 6; Color curcol = current_color(gamestate); bool running = is_game_running(gamestate); @@ -977,7 +982,7 @@ } static void game_play(GameState *gamestate, int opponent, bool as_client) { - inputy = getmaxy(stdscr) - 6; + inputy = input_getmaxy() - 6; Color mycolor = gamestate->info.servercolor; if (as_client) { @@ -1310,7 +1315,7 @@ gamestate_cleanup(&gamestate); - mvaddstr(getmaxy(stdscr)-1, 0, + mvaddstr(input_getmaxy()-1, 0, "Game has ended. Press any key to leave..."); clrtoeol(); refresh();