mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-30 08:34:16 +01:00
don't constrain screen size
This commit is contained in:
parent
ac969793ea
commit
3702a9f326
1 changed files with 11 additions and 22 deletions
|
@ -80,14 +80,6 @@
|
||||||
# define CURSES_CELL_WIDTH 2
|
# define CURSES_CELL_WIDTH 2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CURSES_MAX_HEIGHT
|
|
||||||
# define CURSES_MAX_HEIGHT 40
|
|
||||||
#endif
|
|
||||||
#ifndef CURSES_MAX_WIDTH
|
|
||||||
//# define CURSES_MAX_WIDTH 50
|
|
||||||
# define CURSES_MAX_WIDTH 70
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define INFINITE_TIMEOUT -1
|
#define INFINITE_TIMEOUT -1
|
||||||
#define BOARD_SCORE_PADDING 3
|
#define BOARD_SCORE_PADDING 3
|
||||||
|
|
||||||
|
@ -518,7 +510,7 @@ curses_util_requestTime( XW_UtilCtxt* uc )
|
||||||
} /* curses_util_requestTime */
|
} /* curses_util_requestTime */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
initCurses( CursesAppGlobals* globals )
|
initCurses( CursesAppGlobals* globals, int* widthP, int* heightP )
|
||||||
{
|
{
|
||||||
WINDOW* mainWin;
|
WINDOW* mainWin;
|
||||||
WINDOW* menuWin;
|
WINDOW* menuWin;
|
||||||
|
@ -534,14 +526,8 @@ initCurses( CursesAppGlobals* globals )
|
||||||
intrflush(stdscr, FALSE);
|
intrflush(stdscr, FALSE);
|
||||||
keypad(stdscr, TRUE); /* effects wgetch only? */
|
keypad(stdscr, TRUE); /* effects wgetch only? */
|
||||||
|
|
||||||
getmaxyx(mainWin, height, width );
|
getmaxyx( mainWin, height, width );
|
||||||
XP_LOGF( "getmaxyx->w:%d; h:%d", width, height );
|
XP_LOGF( "%s: getmaxyx()->w:%d; h:%d", __func__, width, height );
|
||||||
if ( height > CURSES_MAX_HEIGHT ) {
|
|
||||||
height = CURSES_MAX_HEIGHT;
|
|
||||||
}
|
|
||||||
if ( width > CURSES_MAX_WIDTH ) {
|
|
||||||
width = CURSES_MAX_WIDTH;
|
|
||||||
}
|
|
||||||
|
|
||||||
globals->statusLine = height - MENU_WINDOW_HEIGHT - 1;
|
globals->statusLine = height - MENU_WINDOW_HEIGHT - 1;
|
||||||
menuWin = newwin( MENU_WINDOW_HEIGHT, width,
|
menuWin = newwin( MENU_WINDOW_HEIGHT, width,
|
||||||
|
@ -552,6 +538,9 @@ initCurses( CursesAppGlobals* globals )
|
||||||
globals->menuWin = menuWin;
|
globals->menuWin = menuWin;
|
||||||
globals->boardWin = boardWin;
|
globals->boardWin = boardWin;
|
||||||
globals->mainWin = mainWin;
|
globals->mainWin = mainWin;
|
||||||
|
|
||||||
|
*widthP = width;
|
||||||
|
*heightP = height;
|
||||||
} /* initCurses */
|
} /* initCurses */
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -959,7 +948,7 @@ drawMenuFromList( WINDOW* win, const MenuList** menuLists,
|
||||||
static void
|
static void
|
||||||
SIGWINCH_handler( int signal )
|
SIGWINCH_handler( int signal )
|
||||||
{
|
{
|
||||||
int x, y;
|
int height, width;
|
||||||
|
|
||||||
assert( signal == SIGWINCH );
|
assert( signal == SIGWINCH );
|
||||||
|
|
||||||
|
@ -967,8 +956,9 @@ SIGWINCH_handler( int signal )
|
||||||
|
|
||||||
/* (*globals.drawMenu)( &globals ); */
|
/* (*globals.drawMenu)( &globals ); */
|
||||||
|
|
||||||
getmaxyx( stdscr, y, x );
|
getmaxyx( stdscr, height, width );
|
||||||
wresize( g_globals.mainWin, y-MENU_WINDOW_HEIGHT, x );
|
XP_LOGF( "%s:, getmaxyx()->w:%d; h:%d", __func__, width, height );
|
||||||
|
wresize( g_globals.mainWin, height-MENU_WINDOW_HEIGHT, width );
|
||||||
|
|
||||||
board_draw( g_globals.cGlobals.game.board );
|
board_draw( g_globals.cGlobals.game.board );
|
||||||
} /* SIGWINCH_handler */
|
} /* SIGWINCH_handler */
|
||||||
|
@ -2043,8 +2033,7 @@ cursesmain( XP_Bool isServer, LaunchParams* params )
|
||||||
}
|
}
|
||||||
|
|
||||||
XP_Bool opened = XP_FALSE;
|
XP_Bool opened = XP_FALSE;
|
||||||
initCurses( &g_globals );
|
initCurses( &g_globals, &width, &height );
|
||||||
getmaxyx( g_globals.boardWin, height, width );
|
|
||||||
|
|
||||||
g_globals.draw = (struct CursesDrawCtx*)
|
g_globals.draw = (struct CursesDrawCtx*)
|
||||||
cursesDrawCtxtMake( g_globals.boardWin );
|
cursesDrawCtxtMake( g_globals.boardWin );
|
||||||
|
|
Loading…
Add table
Reference in a new issue