mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-28 07:58:08 +01:00
Trying to give smartphone users way to use keypad to move tiles to
board. Enabling key-to-text works, but constants to turn it off aren't in cegcc. So for b2 add a quick hack where 1 means first tile in tray, 7 means last (rightmost). Enable and test on gtk.
This commit is contained in:
parent
290f505a98
commit
5502c3ef8b
6 changed files with 77 additions and 5 deletions
|
@ -3109,8 +3109,9 @@ moveKeyTileToBoard( BoardCtxt* board, XP_Key cursorKey, XP_Bool* gotArrow )
|
|||
/* keep compiler happy: assign defaults */
|
||||
Tile tile, blankFace = EMPTY_TILE; /* make compiler happy */
|
||||
XP_U16 col, row;
|
||||
DictionaryCtxt* dict = model_getDictionary( board->model );
|
||||
XP_S16 turn = board->selPlayer;
|
||||
ModelCtxt* model = board->model;
|
||||
DictionaryCtxt* dict = model_getDictionary( model );
|
||||
const XP_S16 turn = board->selPlayer;
|
||||
XP_S16 tileIndex;
|
||||
XP_UCHAR buf[2];
|
||||
XP_Bool success;
|
||||
|
@ -3139,12 +3140,12 @@ moveKeyTileToBoard( BoardCtxt* board, XP_Key cursorKey, XP_Bool* gotArrow )
|
|||
}
|
||||
|
||||
if ( success ) {
|
||||
tileIndex = model_trayContains( board->model, turn, tile );
|
||||
tileIndex = model_trayContains( model, turn, tile );
|
||||
if ( tileIndex >= 0 ) {
|
||||
// blankFace = EMPTY_TILE; /* already set (and will be ignored) */
|
||||
} else {
|
||||
Tile blankTile = dict_getBlankTile( dict );
|
||||
tileIndex = model_trayContains( board->model, turn, blankTile );
|
||||
tileIndex = model_trayContains( model, turn, blankTile );
|
||||
if ( tileIndex >= 0 ) { /* there's a blank for it */
|
||||
blankFace = tile;
|
||||
} else {
|
||||
|
@ -3153,6 +3154,18 @@ moveKeyTileToBoard( BoardCtxt* board, XP_Key cursorKey, XP_Bool* gotArrow )
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef NUMBER_KEY_AS_INDEX
|
||||
/* Map numbers 1-7 to tiles in tray. This is a hack to workaround
|
||||
temporary lack of key input on smartphone. */
|
||||
if ( !success ) {
|
||||
tileIndex = cursorKey - '0' - 1; /* user's model is 1-based, ours is 0-based */
|
||||
if ( (tileIndex >= 0) &&
|
||||
(tileIndex < model_getNumTilesInTray( model, turn ) ) ) {
|
||||
success = XP_TRUE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( success ) {
|
||||
success = moveTileToBoard( board, col, row, tileIndex, blankFace );
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
ifeq ($(MEMDEBUG),TRUE)
|
||||
DEFINES = -DMEM_DEBUG -DDEBUG -DENABLE_LOGGING
|
||||
DEFINES = -DMEM_DEBUG -DDEBUG -DENABLE_LOGGING -DNUMBER_KEY_AS_INDEX
|
||||
CFLAGS += -g $(GPROFFLAG) -Wall -Wunused-parameter -Wcast-align -Werror
|
||||
CFLAGS += -DDEBUG_TS
|
||||
PLATFORM = obj_linux_memdbg
|
||||
|
|
|
@ -212,6 +212,11 @@ evtToXPKey( GdkEventKey* event, XP_Bool* movesCursorP )
|
|||
if ( isalpha( keyval ) ) {
|
||||
xpkey = toupper(keyval);
|
||||
break;
|
||||
#ifdef NUMBER_KEY_AS_INDEX
|
||||
} else if ( isdigit( keyval ) ) {
|
||||
xpkey = keyval;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
*movesCursorP = movesCursor;
|
||||
|
|
|
@ -97,6 +97,9 @@ CFLAGS += -DDICTS_MOVED_ALERT
|
|||
CFLAGS += -DKEYBOARD_NAV
|
||||
CFLAGS += -DPERIMETER_FOCUS
|
||||
|
||||
# Hack until figure out how to turn off IME (12-key-to-text) on CE.
|
||||
CFLAGS += -DNUMBER_KEY_AS_INDEX
|
||||
|
||||
# This is normally part of MEM_DEBUG, but sometimes we want logging in
|
||||
# a release build, e.g. to figure out why opening a saved game isn't
|
||||
# working. So normally it's commented out here.
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#ifdef _WIN32_WCE
|
||||
# include <aygshell.h>
|
||||
#endif
|
||||
/* #include <imm.h> */
|
||||
#include "strutils.h"
|
||||
|
||||
#include "memstream.h"
|
||||
|
@ -2240,6 +2241,39 @@ WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
}
|
||||
break;
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
/* case WM_SETFOCUS: */
|
||||
/* hC = ImmGetContext( hWnd ); */
|
||||
/* globals->imeWasOpen = ImmGetOpenStatus( hC ); */
|
||||
/* ImmSetOpenStatus( hC, TRUE ); */
|
||||
/* ImmEscape( NULL, hC, IME_ESC_SET_MODE, (LPVOID)IM_SPELL ); */
|
||||
/* break; */
|
||||
/* case WM_KILLFOCUS: */
|
||||
/* ImmSetOpenStatus( hC, globals->imeWasOpen ); */
|
||||
/* break; */
|
||||
|
||||
/* The code above this point works to turn 12-key->text
|
||||
translation on, but not to turn it off, so other apps wind up
|
||||
with it on after Crosswords quits. The recommended code is
|
||||
below, but includes constants on in the version of cegcc I'm
|
||||
using. Need to look into upgrading, but that requires a lot
|
||||
of changes. Post B2.... */
|
||||
|
||||
/* DWORD dwRes = SendMessage((HWND)wParam, WM_IME_REQUEST, IMR_ISIMEAWARE, 0); */
|
||||
/* hC = ImmGetContext( hWnd ); */
|
||||
/* if ( (dwRes & IMEAF_AWARE) == IMEAF_AWARE ) { */
|
||||
/* ImmEscape( NULL, hC, IME_ESC_RETAIN_MODE_ICON, (LPVOID)TRUE); */
|
||||
/* } */
|
||||
/* ImmSetOpenStatus( hC, FALSE); */
|
||||
/* } */
|
||||
/* break; */
|
||||
/* case WM_IME_REQUEST: */
|
||||
/* if ( wParam == IMR_ISIMEAWARE ) { */
|
||||
/* return IMEAF_AWARE; */
|
||||
/* } */
|
||||
/* break; */
|
||||
#endif
|
||||
|
||||
case WM_DESTROY:
|
||||
#ifdef _WIN32_WCE
|
||||
CommandBar_Destroy(globals->hwndCB); /* supposedly not needed */
|
||||
|
|
|
@ -67,4 +67,21 @@ BOOL DH(ResetEvent)(HANDLE);
|
|||
|
||||
#endif /* USE_RAW_MINGW */
|
||||
|
||||
#if 0
|
||||
/* http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1591512&SiteID=1 */
|
||||
#define IM_SPELL 0
|
||||
#define IME_ESC_SET_MODE 0x0800
|
||||
/* http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1476620&SiteID=1 */
|
||||
#define EIM_SPELL IM_SPELL
|
||||
/* http://wolfpack.twu.net/docs/gtkwin32/gdkprivate-win32.h */
|
||||
#define WM_IME_REQUEST 0x0288
|
||||
|
||||
/* http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1476620&SiteID=1 */
|
||||
#define EM_SETINPUTMODE 0x00DE
|
||||
|
||||
/* #define IMR_ISIMEAWARE 0 */
|
||||
/* #define IMEAF_AWARE 0 */
|
||||
/* #define IME_ESC_RETAIN_MODE_ICON 0 */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue