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 ) {
util_cellSquareHeld( board->util, stream );
if ( dragDropInProgress( board ) ) {
XP_Bool dragged;
dragDropEnd( board, board->penDownX, board->penDownY, &dragged );
dragDropEnd( board, board->penDownX, board->penDownY, NULL );
}
}
stream_destroy( stream );
@ -3035,7 +3034,6 @@ handlePenUpInternal( BoardCtxt* board, XP_U16 xx, XP_U16 yy, XP_Bool isPen,
XP_Bool altDown )
{
XP_Bool draw = XP_FALSE;
XP_Bool dragged = XP_FALSE;
BoardObjectType prevObj = board->penDownObject;
/* 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. */
board->penDownObject = OBJ_NONE;
XP_Bool dragged = XP_FALSE;
if ( dragDropInProgress(board) ) {
draw = dragDropEnd( board, xx, yy, &dragged );
}

View file

@ -237,7 +237,7 @@ dragDropContinue( BoardCtxt* board, XP_U16 xx, XP_U16 yy )
}
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;
BoardObjectType newObj;
@ -245,7 +245,9 @@ dragDropEnd( BoardCtxt* board, XP_U16 xx, XP_U16 yy, XP_Bool* dragged )
XP_ASSERT( dragDropInProgress(board) );
(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
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
gtkask_timeout( GtkWidget* parent, const gchar* message,
GtkButtonsType buttons, const AskPair* buttxts,
XP_U16 timeout )
uint32_t timeoutMS )
{
XP_LOGFF( "(msg: \"%s\")", message );
guint src = 0;
GtkWidget* dlg = gtk_message_dialog_new( (GtkWindow*)parent,
GTK_MESSAGE_QUESTION,
GTK_DIALOG_MODAL,
buttons, "%s", message );
if ( timeout > 0 ) {
XP_LOGF( "%s(%s)", __func__, message ); /* log since times out... */
src = g_timeout_add( timeout, timer_func, dlg );
if ( timeoutMS > 0 ) {
XP_LOGF( "%s(\"%s\")", __func__, message ); /* log since times out... */
src = g_timeout_add( timeoutMS, timer_func, dlg );
}
while ( !!buttxts && !!buttxts->txt ) {

View file

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

View file

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