Hello,
Thank you for your reply, it’s ok, I have found the problem.
It doesn’t come from SDL but from my Acer laptop keyboard.
The keys left, right, up, down, home, pgup, pgdown, end are the
SDLK_KP_* and not the ‘normal’ key code.
That was working on Linux because VirtualBox was mapping these keys with
the ‘normal’ key and not with the keypad key.
I use this code and that works fine with Windows and Linux with my Acer
keyboard:
…
#define ALL_KEYS(std, kp) (e.key.keysym.sym == std || (e.key.keysym.sym
== kp && !(e.key.keysym.mod & KMOD_NUM)))
if (txt->cursorPos && ALL_KEYS(SDLK_LEFT, SDLK_KP_4))
txt->cursorPos–;
else if (txt->cursorPos < strlen(txt->text) && ALL_KEYS(SDLK_RIGHT,
SDLK_KP_6))
txt->cursorPos++;
…
So, I think that the second problem (Delete (127) not send in TextInput
event on Windows) is coming from the laptop keyboard too.
Yannick Bersier
Pierre Phaneuf a ?crit :> On Wed, Nov 12, 2008 at 4:09 PM, Yannick Bersier <@Yannick_Bersier> wrote:
And the keysym aren’t the same too. So I don’t know how to get these keys on
Linux AND Windows…
For this, you’d definitely want to use keysyms rather than keycodes,
but I have no idea why they are different?!?
In Quadra, I use SDLK_BACKSPACE, SDLK_DELETE, SDLK_LEFT, SDLK_RIGHT,
SDLK_HOME, SDLK_END, tested on Linux/X11, Mac OS X (both Quartz and
X11) and Windows (XP and Vista), both with US and French Canadian
keyboard layouts (granted, they’re both QWERTY):
http://code.google.com/p/quadra/source/browse/branches/quadra-sdl/skelton/common/inter.cpp#592
Pay no attention to the quality of the code, it was written more than
ten years ago for DOS, then DirectX, then Svgalib, then X11, and SDL
only recently! It’s a bit scarred.