show bonus-square-held

Again, so I can see what's going on. Use timeout so doesn't force
lifting the mouse, closer to what happens on Android with Toasts.
This commit is contained in:
Eric House 2020-04-17 07:06:31 -07:00
parent 388fc4f871
commit ab07c1c466
5 changed files with 15 additions and 14 deletions

View file

@ -1366,8 +1366,7 @@ timerFiredForPen( BoardCtxt* board )
if ( listWords ) { if ( listWords ) {
util_cellSquareHeld( board->util, stream ); util_cellSquareHeld( board->util, stream );
if ( dragDropInProgress( board ) ) { if ( dragDropInProgress( board ) ) {
XP_Bool dragged; dragDropEnd( board, board->penDownX, board->penDownY, NULL );
dragDropEnd( board, board->penDownX, board->penDownY, &dragged );
} }
} }
stream_destroy( stream ); stream_destroy( stream );
@ -3035,7 +3034,6 @@ handlePenUpInternal( BoardCtxt* board, XP_U16 xx, XP_U16 yy, XP_Bool isPen,
XP_Bool altDown ) XP_Bool altDown )
{ {
XP_Bool draw = XP_FALSE; XP_Bool draw = XP_FALSE;
XP_Bool dragged = XP_FALSE;
BoardObjectType prevObj = board->penDownObject; BoardObjectType prevObj = board->penDownObject;
/* prevent timer from firing after pen lifted. Set now rather than later /* prevent timer from firing after pen lifted. Set now rather than later
@ -3043,6 +3041,7 @@ handlePenUpInternal( BoardCtxt* board, XP_U16 xx, XP_U16 yy, XP_Bool isPen,
exiting this function (which might give timer time to fire. */ exiting this function (which might give timer time to fire. */
board->penDownObject = OBJ_NONE; board->penDownObject = OBJ_NONE;
XP_Bool dragged = XP_FALSE;
if ( dragDropInProgress(board) ) { if ( dragDropInProgress(board) ) {
draw = dragDropEnd( board, xx, yy, &dragged ); draw = dragDropEnd( board, xx, yy, &dragged );
} }

View file

@ -237,7 +237,7 @@ dragDropContinue( BoardCtxt* board, XP_U16 xx, XP_U16 yy )
} }
XP_Bool XP_Bool
dragDropEnd( BoardCtxt* board, XP_U16 xx, XP_U16 yy, XP_Bool* dragged ) dragDropEnd( BoardCtxt* board, XP_U16 xx, XP_U16 yy, XP_Bool* draggedP )
{ {
DragState* ds = &board->dragState; DragState* ds = &board->dragState;
BoardObjectType newObj; BoardObjectType newObj;
@ -245,7 +245,9 @@ dragDropEnd( BoardCtxt* board, XP_U16 xx, XP_U16 yy, XP_Bool* dragged )
XP_ASSERT( dragDropInProgress(board) ); XP_ASSERT( dragDropInProgress(board) );
(void)dragDropContinueImpl( board, xx, yy, &newObj ); (void)dragDropContinueImpl( board, xx, yy, &newObj );
*dragged = ds->didMove; if ( !!draggedP ) {
*draggedP = ds->didMove;
}
/* If we've dropped on something, put the tile there! Since we /* If we've dropped on something, put the tile there! Since we
don't remove it from its earlier location until it's dropped, don't remove it from its earlier location until it's dropped,

View file

@ -48,18 +48,17 @@ gtkask( GtkWidget* parent, const gchar *message, GtkButtonsType buttons,
gint gint
gtkask_timeout( GtkWidget* parent, const gchar* message, gtkask_timeout( GtkWidget* parent, const gchar* message,
GtkButtonsType buttons, const AskPair* buttxts, GtkButtonsType buttons, const AskPair* buttxts,
XP_U16 timeout ) uint32_t timeoutMS )
{ {
XP_LOGFF( "(msg: \"%s\")", message );
guint src = 0; guint src = 0;
GtkWidget* dlg = gtk_message_dialog_new( (GtkWindow*)parent, GtkWidget* dlg = gtk_message_dialog_new( (GtkWindow*)parent,
GTK_MESSAGE_QUESTION, GTK_MESSAGE_QUESTION,
GTK_DIALOG_MODAL, GTK_DIALOG_MODAL,
buttons, "%s", message ); buttons, "%s", message );
if ( timeout > 0 ) { if ( timeoutMS > 0 ) {
XP_LOGF( "%s(%s)", __func__, message ); /* log since times out... */ XP_LOGF( "%s(\"%s\")", __func__, message ); /* log since times out... */
src = g_timeout_add( timeout, timer_func, dlg ); src = g_timeout_add( timeoutMS, timer_func, dlg );
} }
while ( !!buttxts && !!buttxts->txt ) { while ( !!buttxts && !!buttxts->txt ) {

View file

@ -38,7 +38,7 @@ gint gtkask( GtkWidget* parent, const gchar *message,
GtkButtonsType buttons, const AskPair* buttxts ); GtkButtonsType buttons, const AskPair* buttxts );
gint gtkask_timeout( GtkWidget* parent, const gchar *message, gint gtkask_timeout( GtkWidget* parent, const gchar *message,
GtkButtonsType buttons, const AskPair* buttxts, GtkButtonsType buttons, const AskPair* buttxts,
XP_U16 timeout ); uint32_t timeoutMS );
#endif #endif
#endif /* PLATFORM_GTK */ #endif /* PLATFORM_GTK */

View file

@ -1961,9 +1961,10 @@ gtk_util_getTraySearchLimits( XW_UtilCtxt* XP_UNUSED(uc),
static void static void
gtk_util_bonusSquareHeld( XW_UtilCtxt* uc, XWBonusType bonus ) gtk_util_bonusSquareHeld( XW_UtilCtxt* uc, XWBonusType bonus )
{ {
LOG_FUNC(); GtkGameGlobals* globals = (GtkGameGlobals*)uc->closure;
XP_USE( uc ); gchar* msg = g_strdup_printf( "bonusSquareHeld(bonus=%d)", bonus );
XP_USE( bonus ); gtkask_timeout( globals->window, msg, GTK_BUTTONS_OK, NULL, 1000 );
g_free( msg );
} }
static void static void