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
|
#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*
|
static XWStreamCtxt*
|
||||||
curses_util_makeStreamFromAddr(XW_UtilCtxt* uc, XP_PlayerAddr channelNo )
|
curses_util_makeStreamFromAddr(XW_UtilCtxt* uc, XP_PlayerAddr channelNo )
|
||||||
{
|
{
|
||||||
CursesAppGlobals* globals = (CursesAppGlobals*)uc->closure;
|
CursesAppGlobals* globals = (CursesAppGlobals*)uc->closure;
|
||||||
LaunchParams* params = globals->cGlobals.params;
|
LaunchParams* params = globals->cGlobals.params;
|
||||||
|
|
||||||
XWStreamCtxt* stream = mem_stream_make( MPPARM(uc->mpool)
|
XWStreamCtxt* stream = mem_stream_make( MPPARM(uc->mpool) params->vtMgr,
|
||||||
params->vtMgr,
|
&globals->cGlobals, channelNo,
|
||||||
uc->closure, channelNo,
|
sendOnClose );
|
||||||
cursesSendOnClose );
|
|
||||||
return stream;
|
return stream;
|
||||||
} /* curses_util_makeStreamFromAddr */
|
} /* curses_util_makeStreamFromAddr */
|
||||||
#endif
|
#endif
|
||||||
|
@ -1548,17 +1538,6 @@ setupCursesUtilCallbacks( CursesAppGlobals* globals, XW_UtilCtxt* util )
|
||||||
util->closure = globals;
|
util->closure = globals;
|
||||||
} /* setupCursesUtilCallbacks */
|
} /* 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
|
static CursesMenuHandler
|
||||||
getHandlerForKey( const MenuList* list, char ch )
|
getHandlerForKey( const MenuList* list, char ch )
|
||||||
{
|
{
|
||||||
|
@ -1875,7 +1854,7 @@ cursesmain( XP_Bool isServer, LaunchParams* params )
|
||||||
server_initClientConnection( g_globals.cGlobals.game.server,
|
server_initClientConnection( g_globals.cGlobals.game.server,
|
||||||
mem_stream_make( MEMPOOL
|
mem_stream_make( MEMPOOL
|
||||||
params->vtMgr,
|
params->vtMgr,
|
||||||
&g_globals,
|
&g_globals.cGlobals,
|
||||||
(XP_PlayerAddr)0,
|
(XP_PlayerAddr)0,
|
||||||
sendOnClose ) );
|
sendOnClose ) );
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -65,9 +65,6 @@
|
||||||
#include "filestream.h"
|
#include "filestream.h"
|
||||||
|
|
||||||
/* static guint gtkSetupClientSocket( GtkAppGlobals* globals, int sock ); */
|
/* 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 setCtrlsForTray( GtkAppGlobals* globals );
|
||||||
static void new_game( GtkWidget* widget, GtkAppGlobals* globals );
|
static void new_game( GtkWidget* widget, GtkAppGlobals* globals );
|
||||||
static void new_game_impl( GtkAppGlobals* globals, XP_Bool fireConnDlg );
|
static void new_game_impl( GtkAppGlobals* globals, XP_Bool fireConnDlg );
|
||||||
|
@ -508,8 +505,8 @@ createOrLoadObjects( GtkAppGlobals* globals )
|
||||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||||
} else if ( !isServer ) {
|
} else if ( !isServer ) {
|
||||||
XWStreamCtxt* stream =
|
XWStreamCtxt* stream =
|
||||||
mem_stream_make( MEMPOOL params->vtMgr, globals, CHANNEL_NONE,
|
mem_stream_make( MEMPOOL params->vtMgr, &globals->cGlobals, CHANNEL_NONE,
|
||||||
sendOnCloseGTK );
|
sendOnClose );
|
||||||
server_initClientConnection( globals->cGlobals.game.server,
|
server_initClientConnection( globals->cGlobals.game.server,
|
||||||
stream );
|
stream );
|
||||||
#endif
|
#endif
|
||||||
|
@ -814,11 +811,9 @@ new_game_impl( GtkAppGlobals* globals, XP_Bool fireConnDlg )
|
||||||
|
|
||||||
if ( isClient ) {
|
if ( isClient ) {
|
||||||
XWStreamCtxt* stream =
|
XWStreamCtxt* stream =
|
||||||
mem_stream_make( MEMPOOL
|
mem_stream_make( MEMPOOL globals->cGlobals.params->vtMgr,
|
||||||
globals->cGlobals.params->vtMgr,
|
&globals->cGlobals, CHANNEL_NONE,
|
||||||
globals,
|
sendOnClose );
|
||||||
CHANNEL_NONE,
|
|
||||||
sendOnCloseGTK );
|
|
||||||
server_initClientConnection( globals->cGlobals.game.server,
|
server_initClientConnection( globals->cGlobals.game.server,
|
||||||
stream );
|
stream );
|
||||||
}
|
}
|
||||||
|
@ -1747,8 +1742,8 @@ gtk_util_makeStreamFromAddr(XW_UtilCtxt* uc, XP_PlayerAddr channelNo )
|
||||||
|
|
||||||
XWStreamCtxt* stream = mem_stream_make( MEMPOOL
|
XWStreamCtxt* stream = mem_stream_make( MEMPOOL
|
||||||
globals->cGlobals.params->vtMgr,
|
globals->cGlobals.params->vtMgr,
|
||||||
uc->closure, channelNo,
|
&globals->cGlobals, channelNo,
|
||||||
sendOnCloseGTK );
|
sendOnClose );
|
||||||
return stream;
|
return stream;
|
||||||
} /* gtk_util_makeStreamFromAddr */
|
} /* gtk_util_makeStreamFromAddr */
|
||||||
|
|
||||||
|
@ -2270,15 +2265,6 @@ gtk_socket_acceptor( int listener, Acceptor func, CommonGlobals* globals,
|
||||||
}
|
}
|
||||||
} /* gtk_socket_acceptor */
|
} /* 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
|
static void
|
||||||
drop_msg_toggle( GtkWidget* toggle, GtkAppGlobals* globals )
|
drop_msg_toggle( GtkWidget* toggle, GtkAppGlobals* globals )
|
||||||
{
|
{
|
||||||
|
|
|
@ -196,6 +196,14 @@ catOnClose( XWStreamCtxt* stream, void* XP_UNUSED(closure) )
|
||||||
free( buffer );
|
free( buffer );
|
||||||
} /* catOnClose */
|
} /* 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
|
void
|
||||||
catGameHistory( CommonGlobals* cGlobals )
|
catGameHistory( CommonGlobals* cGlobals )
|
||||||
{
|
{
|
||||||
|
|
|
@ -60,6 +60,8 @@ XP_UCHAR* strFromStream( XWStreamCtxt* stream );
|
||||||
|
|
||||||
void catGameHistory( CommonGlobals* cGlobals );
|
void catGameHistory( CommonGlobals* cGlobals );
|
||||||
void catOnClose( XWStreamCtxt* stream, void* closure );
|
void catOnClose( XWStreamCtxt* stream, void* closure );
|
||||||
|
void sendOnClose( XWStreamCtxt* stream, void* closure );
|
||||||
|
|
||||||
void catFinalScores( const CommonGlobals* cGlobals, XP_S16 quitter );
|
void catFinalScores( const CommonGlobals* cGlobals, XP_S16 quitter );
|
||||||
XP_Bool file_exists( const char* fileName );
|
XP_Bool file_exists( const char* fileName );
|
||||||
XWStreamCtxt* streamFromFile( CommonGlobals* cGlobals, char* name,
|
XWStreamCtxt* streamFromFile( CommonGlobals* cGlobals, char* name,
|
||||||
|
|
Loading…
Add table
Reference in a new issue