Skip to content

Commit

Permalink
support hint-select in the switch_window (support #138, #206)
Browse files Browse the repository at this point in the history
  • Loading branch information
pit-ray committed Oct 14, 2023
1 parent 4a12819 commit d683a9a
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions src/bind/window/switch_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -69,14 +54,17 @@ 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() ;

bool break_flag = false ;
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 ;
}
Expand All @@ -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) {
Expand Down

0 comments on commit d683a9a

Please sign in to comment.