Browse Source

fix "Save as" and "Revert" keyboard shortcuts

pull/1639/head
bsp2 6 years ago
parent
commit
0566d49cf0
5 changed files with 34 additions and 1 deletions
  1. +3
    -0
      dep/lglw/lglw.h
  2. +11
    -0
      dep/lglw/lglw_linux.c
  3. +13
    -0
      dep/lglw/lglw_windows.c
  4. +6
    -0
      src/app/RackScene.cpp
  5. +1
    -1
      src/app/Toolbar.cpp

+ 3
- 0
dep/lglw/lglw.h View File

@@ -236,6 +236,9 @@ void lglw_keyboard_callback_set (lglw_t _lglw, lglw_keyboard_fxn_t _cbk);
// Get current key modifier state // Get current key modifier state
uint32_t lglw_keyboard_get_modifiers (lglw_t _lglw); uint32_t lglw_keyboard_get_modifiers (lglw_t _lglw);


// Clear current key modifier state (workaround for stuck-modifier-after-dialog issue)
void lglw_keyboard_clear_modifiers (lglw_t _lglw);

// Get current mouse button state // Get current mouse button state
uint32_t lglw_mouse_get_buttons (lglw_t _lglw); uint32_t lglw_mouse_get_buttons (lglw_t _lglw);




+ 11
- 0
dep/lglw/lglw_linux.c View File

@@ -1722,6 +1722,17 @@ uint32_t lglw_keyboard_get_modifiers(lglw_t _lglw) {
} }




// ---------------------------------------------------------------------------- lglw_keyboard_clear_modifiers
void lglw_keyboard_clear_modifiers(lglw_t _lglw) {
LGLW(_lglw);

if(NULL != lglw)
{
lglw->keyboard.kmod_state = 0;
}
}


// ---------------------------------------------------------------------------- lglw_touchkeyboard_show // ---------------------------------------------------------------------------- lglw_touchkeyboard_show
void lglw_touchkeyboard_show(lglw_t _lglw, lglw_bool_t _bEnable) { void lglw_touchkeyboard_show(lglw_t _lglw, lglw_bool_t _bEnable) {
LGLW(_lglw); LGLW(_lglw);


+ 13
- 0
dep/lglw/lglw_windows.c View File

@@ -25,6 +25,7 @@
* ---- * ----
* ---- created: 04Aug2018 * ---- created: 04Aug2018
* ---- changed: 05Aug2018, 06Aug2018, 07Aug2018, 08Aug2018, 09Aug2018, 18Aug2018, 07Mar2019 * ---- changed: 05Aug2018, 06Aug2018, 07Aug2018, 08Aug2018, 09Aug2018, 18Aug2018, 07Mar2019
* ---- 10Mar2019
* ---- * ----
* ---- * ----
* ---- * ----
@@ -782,6 +783,18 @@ uint32_t lglw_keyboard_get_modifiers(lglw_t _lglw) {
} }




// ---------------------------------------------------------------------------- lglw_keyboard_clear_modifiers
void lglw_keyboard_clear_modifiers(lglw_t _lglw) {
LGLW(_lglw);

if(NULL != lglw)
{
lglw->keyboard.kmod_state = 0;
}
}



// ---------------------------------------------------------------------------- loc_touchkeyboard_get_rect // ---------------------------------------------------------------------------- loc_touchkeyboard_get_rect
#if 0 #if 0
static lglw_bool_t loc_touchkeyboard_get_rect(RECT *rect) { static lglw_bool_t loc_touchkeyboard_get_rect(RECT *rect) {


+ 6
- 0
src/app/RackScene.cpp View File

@@ -79,21 +79,27 @@ void RackScene::onHoverKey(EventHoverKey &e) {
} }
break; break;
case 'o'/*GLFW_KEY_O*/: case 'o'/*GLFW_KEY_O*/:
case 'O'/*GLFW_KEY_O*/:
if (windowIsModPressed() && !windowIsShiftPressed()) { if (windowIsModPressed() && !windowIsShiftPressed()) {
lglw_keyboard_clear_modifiers(global_ui->window.lglw); // workaround for stuck modifier keys
global_ui->app.gRackWidget->openDialog(); global_ui->app.gRackWidget->openDialog();
e.consumed = true; e.consumed = true;
} }
if (windowIsModPressed() && windowIsShiftPressed()) { if (windowIsModPressed() && windowIsShiftPressed()) {
lglw_keyboard_clear_modifiers(global_ui->window.lglw); // workaround for stuck modifier keys
global_ui->app.gRackWidget->revert(); global_ui->app.gRackWidget->revert();
e.consumed = true; e.consumed = true;
} }
break; break;
case 's'/*GLFW_KEY_S*/: case 's'/*GLFW_KEY_S*/:
case 'S'/*GLFW_KEY_S*/:
if (windowIsModPressed() && !windowIsShiftPressed()) { if (windowIsModPressed() && !windowIsShiftPressed()) {
lglw_keyboard_clear_modifiers(global_ui->window.lglw); // workaround for stuck modifier keys
global_ui->app.gRackWidget->saveDialog(); global_ui->app.gRackWidget->saveDialog();
e.consumed = true; e.consumed = true;
} }
if (windowIsModPressed() && windowIsShiftPressed()) { if (windowIsModPressed() && windowIsShiftPressed()) {
lglw_keyboard_clear_modifiers(global_ui->window.lglw); // workaround for stuck modifier keys
global_ui->app.gRackWidget->saveAsDialog(); global_ui->app.gRackWidget->saveAsDialog();
e.consumed = true; e.consumed = true;
} }


+ 1
- 1
src/app/Toolbar.cpp View File

@@ -90,7 +90,7 @@ struct SaveAsButton : TooltipIconButton {
struct RevertButton : TooltipIconButton { struct RevertButton : TooltipIconButton {
RevertButton() { RevertButton() {
setSVG(SVG::load(assetGlobal("res/icons/noun_1084369_cc.svg"))); setSVG(SVG::load(assetGlobal("res/icons/noun_1084369_cc.svg")));
tooltipText = "Revert";
tooltipText = "Revert (" WINDOW_MOD_KEY_NAME "+Shift+O)";
} }
void onAction(EventAction &e) override { void onAction(EventAction &e) override {
global_ui->app.gRackWidget->revert(); global_ui->app.gRackWidget->revert();


Loading…
Cancel
Save