mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-05 20:45:49 +01:00
cleanup
This commit is contained in:
parent
57ea768aaf
commit
093fc4d1fa
4 changed files with 21 additions and 46 deletions
|
@ -1490,25 +1490,15 @@ curses_util_remSelected( XW_UtilCtxt* uc )
|
|||
}
|
||||
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
static void
|
||||
cursesSendOnClose( XWStreamCtxt* stream, void* closure )
|
||||
{
|
||||
CursesAppGlobals* globals = (CursesAppGlobals*)closure;
|
||||
|
||||
XP_LOGF( "cursesSendOnClose called" );
|
||||
(void)comms_send( globals->cGlobals.game.comms, stream );
|
||||
} /* cursesSendOnClose */
|
||||
|
||||
static XWStreamCtxt*
|
||||
curses_util_makeStreamFromAddr(XW_UtilCtxt* uc, XP_PlayerAddr channelNo )
|
||||
{
|
||||
CursesAppGlobals* globals = (CursesAppGlobals*)uc->closure;
|
||||
LaunchParams* params = globals->cGlobals.params;
|
||||
|
||||
XWStreamCtxt* stream = mem_stream_make( MPPARM(uc->mpool)
|
||||
params->vtMgr,
|
||||
uc->closure, channelNo,
|
||||
cursesSendOnClose );
|
||||
XWStreamCtxt* stream = mem_stream_make( MPPARM(uc->mpool) params->vtMgr,
|
||||
&globals->cGlobals, channelNo,
|
||||
sendOnClose );
|
||||
return stream;
|
||||
} /* curses_util_makeStreamFromAddr */
|
||||
#endif
|
||||
|
@ -1548,17 +1538,6 @@ setupCursesUtilCallbacks( CursesAppGlobals* globals, XW_UtilCtxt* util )
|
|||
util->closure = globals;
|
||||
} /* setupCursesUtilCallbacks */
|
||||
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
static void
|
||||
sendOnClose( XWStreamCtxt* stream, void* closure )
|
||||
{
|
||||
CursesAppGlobals* globals = closure;
|
||||
XP_LOGF( "curses sendOnClose called" );
|
||||
XP_ASSERT( !!globals->cGlobals.game.comms );
|
||||
comms_send( globals->cGlobals.game.comms, stream );
|
||||
} /* sendOnClose */
|
||||
#endif
|
||||
|
||||
static CursesMenuHandler
|
||||
getHandlerForKey( const MenuList* list, char ch )
|
||||
{
|
||||
|
@ -1875,7 +1854,7 @@ cursesmain( XP_Bool isServer, LaunchParams* params )
|
|||
server_initClientConnection( g_globals.cGlobals.game.server,
|
||||
mem_stream_make( MEMPOOL
|
||||
params->vtMgr,
|
||||
&g_globals,
|
||||
&g_globals.cGlobals,
|
||||
(XP_PlayerAddr)0,
|
||||
sendOnClose ) );
|
||||
} else {
|
||||
|
|
|
@ -65,9 +65,6 @@
|
|||
#include "filestream.h"
|
||||
|
||||
/* static guint gtkSetupClientSocket( GtkAppGlobals* globals, int sock ); */
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
static void sendOnCloseGTK( XWStreamCtxt* stream, void* closure );
|
||||
#endif
|
||||
static void setCtrlsForTray( GtkAppGlobals* globals );
|
||||
static void new_game( GtkWidget* widget, GtkAppGlobals* globals );
|
||||
static void new_game_impl( GtkAppGlobals* globals, XP_Bool fireConnDlg );
|
||||
|
@ -508,8 +505,8 @@ createOrLoadObjects( GtkAppGlobals* globals )
|
|||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
} else if ( !isServer ) {
|
||||
XWStreamCtxt* stream =
|
||||
mem_stream_make( MEMPOOL params->vtMgr, globals, CHANNEL_NONE,
|
||||
sendOnCloseGTK );
|
||||
mem_stream_make( MEMPOOL params->vtMgr, &globals->cGlobals, CHANNEL_NONE,
|
||||
sendOnClose );
|
||||
server_initClientConnection( globals->cGlobals.game.server,
|
||||
stream );
|
||||
#endif
|
||||
|
@ -814,11 +811,9 @@ new_game_impl( GtkAppGlobals* globals, XP_Bool fireConnDlg )
|
|||
|
||||
if ( isClient ) {
|
||||
XWStreamCtxt* stream =
|
||||
mem_stream_make( MEMPOOL
|
||||
globals->cGlobals.params->vtMgr,
|
||||
globals,
|
||||
CHANNEL_NONE,
|
||||
sendOnCloseGTK );
|
||||
mem_stream_make( MEMPOOL globals->cGlobals.params->vtMgr,
|
||||
&globals->cGlobals, CHANNEL_NONE,
|
||||
sendOnClose );
|
||||
server_initClientConnection( globals->cGlobals.game.server,
|
||||
stream );
|
||||
}
|
||||
|
@ -1747,8 +1742,8 @@ gtk_util_makeStreamFromAddr(XW_UtilCtxt* uc, XP_PlayerAddr channelNo )
|
|||
|
||||
XWStreamCtxt* stream = mem_stream_make( MEMPOOL
|
||||
globals->cGlobals.params->vtMgr,
|
||||
uc->closure, channelNo,
|
||||
sendOnCloseGTK );
|
||||
&globals->cGlobals, channelNo,
|
||||
sendOnClose );
|
||||
return stream;
|
||||
} /* gtk_util_makeStreamFromAddr */
|
||||
|
||||
|
@ -2270,15 +2265,6 @@ gtk_socket_acceptor( int listener, Acceptor func, CommonGlobals* globals,
|
|||
}
|
||||
} /* gtk_socket_acceptor */
|
||||
|
||||
static void
|
||||
sendOnCloseGTK( XWStreamCtxt* stream, void* closure )
|
||||
{
|
||||
GtkAppGlobals* globals = closure;
|
||||
|
||||
XP_LOGF( "sendOnClose called" );
|
||||
(void)comms_send( globals->cGlobals.game.comms, stream );
|
||||
} /* sendOnClose */
|
||||
|
||||
static void
|
||||
drop_msg_toggle( GtkWidget* toggle, GtkAppGlobals* globals )
|
||||
{
|
||||
|
|
|
@ -196,6 +196,14 @@ catOnClose( XWStreamCtxt* stream, void* XP_UNUSED(closure) )
|
|||
free( buffer );
|
||||
} /* catOnClose */
|
||||
|
||||
void
|
||||
sendOnClose( XWStreamCtxt* stream, void* closure )
|
||||
{
|
||||
CommonGlobals* cGlobals = (CommonGlobals*)closure;
|
||||
XP_LOGF( "%s called with msg of len %d", __func__, stream_getSize(stream) );
|
||||
(void)comms_send( cGlobals->game.comms, stream );
|
||||
}
|
||||
|
||||
void
|
||||
catGameHistory( CommonGlobals* cGlobals )
|
||||
{
|
||||
|
|
|
@ -60,6 +60,8 @@ XP_UCHAR* strFromStream( XWStreamCtxt* stream );
|
|||
|
||||
void catGameHistory( CommonGlobals* cGlobals );
|
||||
void catOnClose( XWStreamCtxt* stream, void* closure );
|
||||
void sendOnClose( XWStreamCtxt* stream, void* closure );
|
||||
|
||||
void catFinalScores( const CommonGlobals* cGlobals, XP_S16 quitter );
|
||||
XP_Bool file_exists( const char* fileName );
|
||||
XWStreamCtxt* streamFromFile( CommonGlobals* cGlobals, char* name,
|
||||
|
|
Loading…
Add table
Reference in a new issue