From d683a9a02544e9008ff91e7ee771a6b5da822a0a Mon Sep 17 00:00:00 2001 From: pit-ray Date: Sat, 14 Oct 2023 21:34:01 +0900 Subject: [PATCH] support hint-select in the switch_window (support #138, #206) --- src/bind/window/switch_win.cpp | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/src/bind/window/switch_win.cpp b/src/bind/window/switch_win.cpp index 358966e1..2750330d 100644 --- a/src/bind/window/switch_win.cpp +++ b/src/bind/window/switch_win.cpp @@ -29,21 +29,6 @@ namespace vind opt::VCmdLine().name() )) {} - - bool call_op(const core::CmdUnit::SPtr& input) { - auto& igate = core::InputGate::get_instance() ; - - if(input->is_containing(KEYCODE_H)) { - igate.pushup(KEYCODE_LEFT) ; - return true ; - } - - if(input->is_containing(KEYCODE_L)) { - igate.pushup(KEYCODE_RIGHT) ; - return true ; - } - return false ; - } } ; //SwitchWindow @@ -69,6 +54,9 @@ namespace vind igate.release_virtually(KEYCODE_LALT) ; igate.pushup(KEYCODE_TAB) ; + // Wait until the switching control is shown. + Sleep(200) ; + while(true) { pimpl->bg_.update() ; @@ -76,7 +64,7 @@ namespace vind do { core::CmdUnit::SPtr input ; std::uint16_t count ; - if(!ihub.get_typed_input( + if(!ihub.pull_input( input, count, core::get_global_mode(), false)) { continue ; } @@ -87,11 +75,17 @@ namespace vind break ; } - if(pimpl->call_op(input)) { + if(input->is_containing(KEYCODE_H)) { + igate.pushup(KEYCODE_LEFT) ; + continue ; + } + if(input->is_containing(KEYCODE_L)) { + igate.pushup(KEYCODE_RIGHT) ; continue ; } - Sleep(100) ; + input->execute(count) ; + break_flag = true ; // executed some commands. } while(!ihub.is_empty_queue()) ; if(break_flag) {