From 7ef555033f11188f118e5588496659e47738b285 Mon Sep 17 00:00:00 2001 From: Eric House Date: Sat, 16 Apr 2011 22:34:47 -0700 Subject: [PATCH] move vtmgr into ulinuxutl so linux variants don't all have to implement it --- xwords4/linux/cursesmain.c | 11 ++--------- xwords4/linux/cursesmain.h | 2 +- xwords4/linux/gtkmain.c | 10 ++-------- xwords4/linux/linuxutl.c | 9 ++++++++- 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/xwords4/linux/cursesmain.c b/xwords4/linux/cursesmain.c index f8c469820..77decbad4 100644 --- a/xwords4/linux/cursesmain.c +++ b/xwords4/linux/cursesmain.c @@ -1208,13 +1208,6 @@ initClientSocket( CursesAppGlobals* globals, char* serverName ) } /* initClientSocket */ #endif -static VTableMgr* -curses_util_getVTManager(XW_UtilCtxt* uc) -{ - CursesAppGlobals* globals = (CursesAppGlobals*)uc->closure; - return globals->cGlobals.params->vtMgr; -} /* linux_util_getVTManager */ - static XP_Bool curses_util_askPassword( XW_UtilCtxt* XP_UNUSED(uc), const XP_UCHAR* XP_UNUSED(name), @@ -1294,7 +1287,6 @@ setupCursesUtilCallbacks( CursesAppGlobals* globals, XW_UtilCtxt* util ) { util->vtable->m_util_userError = curses_util_userError; - util->vtable->m_util_getVTManager = curses_util_getVTManager; util->vtable->m_util_askPassword = curses_util_askPassword; util->vtable->m_util_yOffsetChange = curses_util_yOffsetChange; util->vtable->m_util_warnIllegalWord = curses_util_warnIllegalWord; @@ -1439,7 +1431,7 @@ relay_error_curses( void* XP_UNUSED(closure), XWREASON XP_UNUSED_DBG(relayErr) ) #endif } -void +int cursesmain( XP_Bool isServer, LaunchParams* params ) { int piperesult; @@ -1647,5 +1639,6 @@ cursesmain( XP_Bool isServer, LaunchParams* params ) #endif endwin(); + return 0; } /* cursesmain */ #endif /* PLATFORM_NCURSES */ diff --git a/xwords4/linux/cursesmain.h b/xwords4/linux/cursesmain.h index 62b05506d..46fc38233 100644 --- a/xwords4/linux/cursesmain.h +++ b/xwords4/linux/cursesmain.h @@ -106,6 +106,6 @@ DrawCtx* cursesDrawCtxtMake( WINDOW* boardWin ); */ -void cursesmain( XP_Bool isServer, LaunchParams* params ); +int cursesmain( XP_Bool isServer, LaunchParams* params ); #endif diff --git a/xwords4/linux/gtkmain.c b/xwords4/linux/gtkmain.c index 589a1c94c..b89222337 100644 --- a/xwords4/linux/gtkmain.c +++ b/xwords4/linux/gtkmain.c @@ -1052,9 +1052,11 @@ disenable_buttons( GtkAppGlobals* globals ) gtk_widget_set_sensitive( globals->prevhint_button, canHing ); gtk_widget_set_sensitive( globals->nexthint_button, canHing ); +#ifdef XWFEATURE_CHAT XP_Bool canChat = !!globals->cGlobals.game.comms && comms_canChat( globals->cGlobals.game.comms ); gtk_widget_set_sensitive( globals->chat_button, canChat ); +#endif } static gboolean @@ -1289,13 +1291,6 @@ gtkUserError( GtkAppGlobals* XP_UNUSED(globals), const char* format, ... ) va_end(ap); } /* gtkUserError */ -static VTableMgr* -gtk_util_getVTManager(XW_UtilCtxt* uc) -{ - GtkAppGlobals* globals = (GtkAppGlobals*)uc->closure; - return globals->cGlobals.params->vtMgr; -} /* linux_util_getVTManager */ - static XP_S16 gtk_util_userPickTile( XW_UtilCtxt* uc, const PickInfo* pi, XP_U16 playerNum, const XP_UCHAR** texts, @@ -1884,7 +1879,6 @@ setupGtkUtilCallbacks( GtkAppGlobals* globals, XW_UtilCtxt* util ) { util->vtable->m_util_userError = gtk_util_userError; util->vtable->m_util_userQuery = gtk_util_userQuery; - util->vtable->m_util_getVTManager = gtk_util_getVTManager; util->vtable->m_util_userPickTile = gtk_util_userPickTile; util->vtable->m_util_askPassword = gtk_util_askPassword; util->vtable->m_util_trayHiddenChange = gtk_util_trayHiddenChange; diff --git a/xwords4/linux/linuxutl.c b/xwords4/linux/linuxutl.c index 2cb81afff..024a5f994 100644 --- a/xwords4/linux/linuxutl.c +++ b/xwords4/linux/linuxutl.c @@ -265,6 +265,13 @@ linux_util_getUserString( XW_UtilCtxt* XP_UNUSED(uc), XP_U16 code ) } } /* linux_util_getUserString */ +static VTableMgr* +linux_util_getVTManager( XW_UtilCtxt* uc ) +{ + CommonGlobals* cGlobals = (CommonGlobals*)uc->closure; + return cGlobals->params->vtMgr; +} /* linux_util_getVTManager */ + void linux_util_vt_init( MPFORMAL XW_UtilCtxt* util ) { @@ -274,7 +281,7 @@ linux_util_vt_init( MPFORMAL XW_UtilCtxt* util ) util->vtable->m_util_getSquareBonus = linux_util_getSquareBonus; util->vtable->m_util_getCurSeconds = linux_util_getCurSeconds; util->vtable->m_util_getUserString = linux_util_getUserString; - + util->vtable->m_util_getVTManager = linux_util_getVTManager; } void