|
|
|
@ -1091,6 +1091,7 @@ bool Core::Init()
|
|
|
|
|
screen_window = new Windows::top_level_window();
|
|
|
|
|
screen_window->addChild(new Windows::dfhack_dummy(5,10));
|
|
|
|
|
started = true;
|
|
|
|
|
modstate = 0;
|
|
|
|
|
|
|
|
|
|
cerr << "Starting the TCP listener.\n";
|
|
|
|
|
server = new ServerMain();
|
|
|
|
@ -1579,7 +1580,7 @@ int UnicodeAwareSym(const SDL::KeyboardEvent& ke)
|
|
|
|
|
//MEMO: return false if event is consumed
|
|
|
|
|
int Core::DFH_SDL_Event(SDL::Event* ev)
|
|
|
|
|
{
|
|
|
|
|
static bool alt = 0;
|
|
|
|
|
//static bool alt = 0;
|
|
|
|
|
|
|
|
|
|
// do NOT process events before we are ready.
|
|
|
|
|
if(!started) return true;
|
|
|
|
@ -1589,31 +1590,27 @@ int Core::DFH_SDL_Event(SDL::Event* ev)
|
|
|
|
|
{
|
|
|
|
|
auto ke = (SDL::KeyboardEvent *)ev;
|
|
|
|
|
|
|
|
|
|
if (ke->ksym.sym == SDL::K_LALT || ke->ksym.sym == SDL::K_RALT)
|
|
|
|
|
{
|
|
|
|
|
alt = (ev->type == SDL::ET_KEYDOWN);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if(ke->state == SDL::BTN_PRESSED && !hotkey_states[ke->ksym.sym])
|
|
|
|
|
if (ke->ksym.sym == SDL::K_LSHIFT || ke->ksym.sym == SDL::K_RSHIFT)
|
|
|
|
|
modstate = (ev->type == SDL::ET_KEYDOWN) ? modstate | MOD_SHIFT : modstate & ~MOD_SHIFT;
|
|
|
|
|
else if (ke->ksym.sym == SDL::K_LCTRL || ke->ksym.sym == SDL::K_RCTRL)
|
|
|
|
|
modstate = (ev->type == SDL::ET_KEYDOWN) ? modstate | MOD_CTRL : modstate & ~MOD_CTRL;
|
|
|
|
|
else if (ke->ksym.sym == SDL::K_LALT || ke->ksym.sym == SDL::K_RALT)
|
|
|
|
|
modstate = (ev->type == SDL::ET_KEYDOWN) ? modstate | MOD_ALT : modstate & ~MOD_ALT;
|
|
|
|
|
else if(ke->state == SDL::BTN_PRESSED && !hotkey_states[ke->ksym.sym])
|
|
|
|
|
{
|
|
|
|
|
hotkey_states[ke->ksym.sym] = true;
|
|
|
|
|
|
|
|
|
|
int mod = 0;
|
|
|
|
|
if (ke->ksym.mod & SDL::KMOD_SHIFT) mod |= 1;
|
|
|
|
|
if (ke->ksym.mod & SDL::KMOD_CTRL) mod |= 2;
|
|
|
|
|
if (alt) mod |= 4;
|
|
|
|
|
|
|
|
|
|
// Use unicode so Windows gives the correct value for the
|
|
|
|
|
// user's Input Language
|
|
|
|
|
if((ke->ksym.unicode & 0xff80) == 0)
|
|
|
|
|
{
|
|
|
|
|
int key = UnicodeAwareSym(*ke);
|
|
|
|
|
SelectHotkey(key, mod);
|
|
|
|
|
SelectHotkey(key, modstate);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Pretend non-ascii characters don't happen:
|
|
|
|
|
SelectHotkey(ke->ksym.sym, mod);
|
|
|
|
|
SelectHotkey(ke->ksym.sym, modstate);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if(ke->state == SDL::BTN_RELEASED)
|
|
|
|
|