|
|
@ -1423,6 +1423,7 @@ Core::Core() :
|
|
|
|
memset(&(s_mods), 0, sizeof(s_mods));
|
|
|
|
memset(&(s_mods), 0, sizeof(s_mods));
|
|
|
|
|
|
|
|
|
|
|
|
// set up hotkey capture
|
|
|
|
// set up hotkey capture
|
|
|
|
|
|
|
|
suppress_duplicate_keyboard_events = true;
|
|
|
|
hotkey_set = NO;
|
|
|
|
hotkey_set = NO;
|
|
|
|
last_world_data_ptr = NULL;
|
|
|
|
last_world_data_ptr = NULL;
|
|
|
|
last_local_map_ptr = NULL;
|
|
|
|
last_local_map_ptr = NULL;
|
|
|
@ -1430,7 +1431,6 @@ Core::Core() :
|
|
|
|
top_viewscreen = NULL;
|
|
|
|
top_viewscreen = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
color_ostream::log_errors_to_stderr = true;
|
|
|
|
color_ostream::log_errors_to_stderr = true;
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void Core::fatal (std::string output)
|
|
|
|
void Core::fatal (std::string output)
|
|
|
@ -2356,12 +2356,14 @@ bool Core::DFH_ncurses_key(int key)
|
|
|
|
return ncurses_wgetch(key, dummy);
|
|
|
|
return ncurses_wgetch(key, dummy);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static bool getSuppressDuplicateKeyboardEvents() {
|
|
|
|
bool Core::getSuppressDuplicateKeyboardEvents() {
|
|
|
|
auto L = Lua::Core::State;
|
|
|
|
return suppress_duplicate_keyboard_events;
|
|
|
|
color_ostream_proxy out(Core::getInstance().getConsole());
|
|
|
|
}
|
|
|
|
Lua::StackUnwinder top(L);
|
|
|
|
|
|
|
|
return DFHack::Lua::PushModulePublic(out, L, "dfhack", "SUPPRESS_DUPLICATE_KEYBOARD_EVENTS") &&
|
|
|
|
void Core::setSuppressDuplicateKeyboardEvents(bool suppress) {
|
|
|
|
lua_toboolean(L, -1);
|
|
|
|
DEBUG(keybinding).print("setting suppress_duplicate_keyboard_events to %s\n",
|
|
|
|
|
|
|
|
suppress ? "true" : "false");
|
|
|
|
|
|
|
|
suppress_duplicate_keyboard_events = suppress;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// returns true if the event is handled
|
|
|
|
// returns true if the event is handled
|
|
|
@ -2396,9 +2398,10 @@ bool Core::DFH_SDL_Event(SDL_Event* ev)
|
|
|
|
DEBUG(keybinding).print("key down: sym=%d (%c)\n", sym, sym);
|
|
|
|
DEBUG(keybinding).print("key down: sym=%d (%c)\n", sym, sym);
|
|
|
|
bool handled = SelectHotkey(sym, modstate);
|
|
|
|
bool handled = SelectHotkey(sym, modstate);
|
|
|
|
if (handled) {
|
|
|
|
if (handled) {
|
|
|
|
DEBUG(keybinding).print("inhibiting SDL key down event\n");
|
|
|
|
DEBUG(keybinding).print("%sinhibiting SDL key down event\n",
|
|
|
|
|
|
|
|
suppress_duplicate_keyboard_events ? "" : "not ");
|
|
|
|
hotkey_states[sym] = true;
|
|
|
|
hotkey_states[sym] = true;
|
|
|
|
return getSuppressDuplicateKeyboardEvents();
|
|
|
|
return suppress_duplicate_keyboard_events;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (ke.state == SDL_RELEASED)
|
|
|
|
else if (ke.state == SDL_RELEASED)
|
|
|
@ -2411,8 +2414,9 @@ bool Core::DFH_SDL_Event(SDL_Event* ev)
|
|
|
|
auto &te = ev->text;
|
|
|
|
auto &te = ev->text;
|
|
|
|
DEBUG(keybinding).print("text input: '%s'\n", te.text);
|
|
|
|
DEBUG(keybinding).print("text input: '%s'\n", te.text);
|
|
|
|
if (strlen(te.text) == 1 && hotkey_states[te.text[0]]) {
|
|
|
|
if (strlen(te.text) == 1 && hotkey_states[te.text[0]]) {
|
|
|
|
DEBUG(keybinding).print("inhibiting SDL text event\n");
|
|
|
|
DEBUG(keybinding).print("%sinhibiting SDL text event\n",
|
|
|
|
return true;
|
|
|
|
suppress_duplicate_keyboard_events ? "" : "not ");
|
|
|
|
|
|
|
|
return suppress_duplicate_keyboard_events;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|