1
0
Fork 0

Add: Use Alt as a remove modifier key

pull/10006/head
dP 2022-09-06 22:01:40 +03:00
parent aea866a42f
commit f0a594abcf
7 changed files with 13 additions and 8 deletions

View File

@ -73,7 +73,7 @@ extern Palette _cur_palette; ///< Current palette
void HandleToolbarHotkey(int hotkey); void HandleToolbarHotkey(int hotkey);
void HandleKeypress(uint keycode, char32_t key); void HandleKeypress(uint keycode, char32_t key);
void HandleTextInput(const char *str, bool marked = false, const char *caret = nullptr, const char *insert_location = nullptr, const char *replacement_end = nullptr); void HandleTextInput(const char *str, bool marked = false, const char *caret = nullptr, const char *insert_location = nullptr, const char *replacement_end = nullptr);
void HandleModifierKeys(bool shift_pressed, bool ctrl_pressed); void HandleModifierKeys(bool shift_pressed, bool ctrl_pressed, bool alt_pressed);
void HandleMouseEvents(); void HandleMouseEvents();
void UpdateWindows(); void UpdateWindows();
void ChangeGameSpeed(bool enable_fast_forward); void ChangeGameSpeed(bool enable_fast_forward);

View File

@ -463,6 +463,7 @@ void VideoDriver_Allegro::InputLoop()
{ {
bool ctrl_pressed = !!(key_shifts & KB_CTRL_FLAG); bool ctrl_pressed = !!(key_shifts & KB_CTRL_FLAG);
bool shift_pressed = !!(key_shifts & KB_SHIFT_FLAG); bool shift_pressed = !!(key_shifts & KB_SHIFT_FLAG);
bool alt_pressed = !!(key_shifts & KB_ALT_FLAG);
/* Speedup when pressing tab, except when using ALT+TAB /* Speedup when pressing tab, except when using ALT+TAB
* to switch to another application. */ * to switch to another application. */
@ -475,7 +476,7 @@ void VideoDriver_Allegro::InputLoop()
(key[KEY_RIGHT] ? 4 : 0) | (key[KEY_RIGHT] ? 4 : 0) |
(key[KEY_DOWN] ? 8 : 0); (key[KEY_DOWN] ? 8 : 0);
HandleModifierKeys(shift_pressed, ctrl_pressed); HandleModifierKeys(shift_pressed, ctrl_pressed, alt_pressed);
} }
void VideoDriver_Allegro::MainLoop() void VideoDriver_Allegro::MainLoop()

View File

@ -474,10 +474,11 @@ void VideoDriver_Cocoa::InputLoop()
bool ctrl_pressed = (cur_mods & ( _settings_client.gui.right_mouse_btn_emulation != RMBE_CONTROL ? NSEventModifierFlagControl : NSEventModifierFlagCommand)) != 0; bool ctrl_pressed = (cur_mods & ( _settings_client.gui.right_mouse_btn_emulation != RMBE_CONTROL ? NSEventModifierFlagControl : NSEventModifierFlagCommand)) != 0;
bool shift_pressed = (cur_mods & NSEventModifierFlagShift) != 0; bool shift_pressed = (cur_mods & NSEventModifierFlagShift) != 0;
bool alt_pressed = (cur_mods & NSEventModifierFlagOption) != 0;
this->fast_forward_key_pressed = _tab_is_down; this->fast_forward_key_pressed = _tab_is_down;
HandleModifierKeys(shift_pressed, ctrl_pressed); HandleModifierKeys(shift_pressed, ctrl_pressed, alt_pressed);
} }
/** Main game loop. */ /** Main game loop. */

View File

@ -577,6 +577,7 @@ void VideoDriver_SDL_Base::InputLoop()
bool ctrl_pressed = !!(mod & KMOD_CTRL); bool ctrl_pressed = !!(mod & KMOD_CTRL);
bool shift_pressed = !!(mod & KMOD_SHIFT); bool shift_pressed = !!(mod & KMOD_SHIFT);
bool alt_pressed = !!(mod & KMOD_ALT);
/* Speedup when pressing tab, except when using ALT+TAB /* Speedup when pressing tab, except when using ALT+TAB
* to switch to another application. */ * to switch to another application. */
@ -589,7 +590,7 @@ void VideoDriver_SDL_Base::InputLoop()
(keys[SDL_SCANCODE_RIGHT] ? 4 : 0) | (keys[SDL_SCANCODE_RIGHT] ? 4 : 0) |
(keys[SDL_SCANCODE_DOWN] ? 8 : 0); (keys[SDL_SCANCODE_DOWN] ? 8 : 0);
HandleModifierKeys(shift_pressed, ctrl_pressed); HandleModifierKeys(shift_pressed, ctrl_pressed, alt_pressed);
} }
void VideoDriver_SDL_Base::LoopOnce() void VideoDriver_SDL_Base::LoopOnce()

View File

@ -633,6 +633,7 @@ void VideoDriver_SDL::InputLoop()
bool ctrl_pressed = !!(mod & KMOD_CTRL); bool ctrl_pressed = !!(mod & KMOD_CTRL);
bool shift_pressed = !!(mod & KMOD_SHIFT); bool shift_pressed = !!(mod & KMOD_SHIFT);
bool alt_pressed = !!(mod & KMOD_ALT);
/* Speedup when pressing tab, except when using ALT+TAB /* Speedup when pressing tab, except when using ALT+TAB
* to switch to another application. */ * to switch to another application. */
@ -645,7 +646,7 @@ void VideoDriver_SDL::InputLoop()
(keys[SDLK_RIGHT] ? 4 : 0) | (keys[SDLK_RIGHT] ? 4 : 0) |
(keys[SDLK_DOWN] ? 8 : 0); (keys[SDLK_DOWN] ? 8 : 0);
HandleModifierKeys(shift_pressed, ctrl_pressed); HandleModifierKeys(shift_pressed, ctrl_pressed, alt_pressed);
} }
void VideoDriver_SDL::MainLoop() void VideoDriver_SDL::MainLoop()

View File

@ -850,6 +850,7 @@ void VideoDriver_Win32Base::InputLoop()
{ {
bool ctrl_pressed = this->has_focus && GetAsyncKeyState(VK_CONTROL) < 0; bool ctrl_pressed = this->has_focus && GetAsyncKeyState(VK_CONTROL) < 0;
bool shift_pressed = this->has_focus && GetAsyncKeyState(VK_SHIFT) < 0; bool shift_pressed = this->has_focus && GetAsyncKeyState(VK_SHIFT) < 0;
bool alt_pressed = this->has_focus && GetAsyncKeyState(VK_MENU) < 0;
/* Speedup when pressing tab, except when using ALT+TAB /* Speedup when pressing tab, except when using ALT+TAB
* to switch to another application. */ * to switch to another application. */
@ -866,7 +867,7 @@ void VideoDriver_Win32Base::InputLoop()
_dirkeys = 0; _dirkeys = 0;
} }
HandleModifierKeys(shift_pressed, ctrl_pressed); HandleModifierKeys(shift_pressed, ctrl_pressed, alt_pressed);
} }
bool VideoDriver_Win32Base::PollEvent() bool VideoDriver_Win32Base::PollEvent()

View File

@ -2623,9 +2623,9 @@ void HandleModifierKeys(bool shift_pressed, bool ctrl_pressed, bool alt_pressed)
_shift_pressed = shift_pressed; _shift_pressed = shift_pressed;
/* Hardwire modifiers leaving remove inaccessible for now. */ /* Hardwire modifier keys. */
_fn_pressed = ctrl_pressed; _fn_pressed = ctrl_pressed;
_remove_pressed = false; _remove_pressed = alt_pressed;
_estimate_pressed = shift_pressed; _estimate_pressed = shift_pressed;
if (old_fn_pressed != _fn_pressed) { if (old_fn_pressed != _fn_pressed) {