1
0
mirror of https://gitlab.os-k.eu/os-k-team/kvisc.git synced 2023-08-25 14:05:46 +02:00
This commit is contained in:
julianb0 2019-07-07 15:43:37 +02:00
parent 8f6b74d3f3
commit 4dd2115592
No known key found for this signature in database
GPG Key ID: 9C7ACF0C053FB8A1

View File

@ -37,30 +37,6 @@ keycode_t console_scankeybuf(ctx_t *ctx)
return 0; return 0;
} }
void console_handle_input(ctx_t *ctx, SDL_Keycode key)
{
keycode_t code = 0;
SDL_Keymod mod = SDL_GetModState();
if (key <= 'z' && key >= 'a')
{
if (mod & (KMOD_CTRL|KMOD_ALT))
{
if (key == 'c')
_except(ctx, E_BRK, "Ctrl+C received");
return;
}
if (mod & KMOD_SHIFT)
key -= ('a' - 'A');
console_addkey(ctx, key);
return;
}
#define QKEY(key, c, cshift, cmode, calt, cgui) \ #define QKEY(key, c, cshift, cmode, calt, cgui) \
_QKEY(SDLK_##key, c, cshift, cmode, calt, cgui) _QKEY(SDLK_##key, c, cshift, cmode, calt, cgui)
@ -75,6 +51,20 @@ _QKEY(SDLK_##key, c, cshift, cmode, calt, cgui)
else if ((mod & KMOD_GUI)) code = cgui; \ else if ((mod & KMOD_GUI)) code = cgui; \
break; break;
void console_handle_input(ctx_t *ctx, SDL_Keycode key)
{
keycode_t code = 0;
SDL_Keymod mod = SDL_GetModState();
if (mod & KMOD_CTRL)
{
if (key == SDLK_c)
_except(ctx, E_BRK, "Ctrl+C received");
return;
}
switch (key) switch (key)
{ {
case SDLK_SPACE: code = ' '; break; case SDLK_SPACE: code = ' '; break;
@ -87,6 +77,35 @@ _QKEY(SDLK_##key, c, cshift, cmode, calt, cgui)
case SDLK_TAB: code = '\t'; break; case SDLK_TAB: code = '\t'; break;
// COMMON
QKEY(a, 'a', 'A', 0, 0, 0);
QKEY(b, 'b', 'B', 0, 0, 0);
QKEY(c, 'c', 'C', 0, 0, 0);
QKEY(d, 'd', 'D', 0, 0, 0);
QKEY(e, 'e', 'E', 0, 0, 0);
QKEY(f, 'f', 'F', 0, 0, 0);
QKEY(g, 'g', 'G', 0, 0, 0);
QKEY(h, 'h', 'H', 0, 0, 0);
QKEY(i, 'i', 'I', 0, 0, 0);
QKEY(j, 'j', 'J', 0, 0, 0);
QKEY(k, 'k', 'K', 0, 0, 0);
QKEY(l, 'l', 'L', 0, 0, 0);
QKEY(m, 'm', 'M', 0, 0, 0);
QKEY(n, 'n', 'N', 0, 0, 0);
QKEY(o, 'o', 'O', 0, 0, 0);
QKEY(p, 'p', 'P', 0, 0, 0);
QKEY(q, 'q', 'Q', 0, 0, 0);
QKEY(r, 'r', 'R', 0, 0, 0);
QKEY(s, 's', 'S', 0, 0, 0);
QKEY(t, 't', 'T', 0, 0, 0);
QKEY(u, 'u', 'U', 0, 0, 0);
QKEY(v, 'v', 'V', 0, 0, 0);
QKEY(w, 'w', 'W', 0, 0, 0);
QKEY(x, 'x', 'X', 0, 0, 0);
QKEY(y, 'y', 'Y', 0, 0, 0);
QKEY(z, 'z', 'Z', 0, 0, 0);
// AZERTY // AZERTY
QKEY(EXCLAIM, '!', 0, 0, 0, 0); QKEY(EXCLAIM, '!', 0, 0, 0, 0);
@ -151,13 +170,13 @@ _QKEY(SDLK_##key, c, cshift, cmode, calt, cgui)
QKEY(AT, '@', 0, 0, 0, 0); QKEY(AT, '@', 0, 0, 0, 0);
// Found experimentally // Found experimentally
_QKEY(231, 0, '0', '@', 0, 0); _QKEY(231, 0, '0', '@', 0, 0);
_QKEY(232, 0, '7', '`', 0, 0); _QKEY(232, 0, '7', '`', 0, 0);
_QKEY(233, 0, '2', '~', 0, 0); _QKEY(233, 0, '2', '~', 0, 0);
_QKEY(249, 0, '%', 0, 0, 0); _QKEY(249, 0, '%', 0, 0, 0);
default: default:
trace("??%d!!\n", key);
return; return;
} }