Skip to content

Commit

Permalink
merge from master
Browse files Browse the repository at this point in the history
  • Loading branch information
pit-ray committed Jul 3, 2024
2 parents 8d84a08 + 0d32b82 commit 249f334
Show file tree
Hide file tree
Showing 20 changed files with 147 additions and 52 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.6.0)
project(win-vind VERSION 5.12.0)
project(win-vind VERSION 5.13.2)
set(INTERNAL_VERSION ${PROJECT_VERSION}.1)

if(NOT CMAKE_BUILD_TYPE)
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ $ scoop install win-vind
```

### Executable Installer
- [win-vind_5.12.0_32bit_installer.zip](https://github.com/pit-ray/win-vind/releases/download/v5.12.0/win-vind_5.12.0_32bit_installer.zip)
- [win-vind_5.12.0_64bit_installer.zip](https://github.com/pit-ray/win-vind/releases/download/v5.12.0/win-vind_5.12.0_64bit_installer.zip)
- [win-vind_5.13.1_32bit_installer.zip](https://github.com/pit-ray/win-vind/releases/download/v5.13.1/win-vind_5.13.1_32bit_installer.zip)
- [win-vind_5.13.1_64bit_installer.zip](https://github.com/pit-ray/win-vind/releases/download/v5.13.1/win-vind_5.13.1_64bit_installer.zip)

### Portable Zip
- [win-vind_5.12.0_32bit_portable.zip](https://github.com/pit-ray/win-vind/releases/download/v5.12.0/win-vind_5.12.0_32bit_portable.zip)
- [win-vind_5.12.0_64bit_portable.zip](https://github.com/pit-ray/win-vind/releases/download/v5.12.0/win-vind_5.12.0_64bit_portable.zip)
- [win-vind_5.13.1_32bit_portable.zip](https://github.com/pit-ray/win-vind/releases/download/v5.13.1/win-vind_5.13.1_32bit_portable.zip)
- [win-vind_5.13.1_64bit_portable.zip](https://github.com/pit-ray/win-vind/releases/download/v5.13.1/win-vind_5.13.1_64bit_portable.zip)


## Usage
Expand Down
10 changes: 5 additions & 5 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ translations:
# label: 日本語

project:
version: 5.12.0
version: 5.13.1
download_url: downloads
download_text: Download

Expand Down Expand Up @@ -43,10 +43,10 @@ links:
icon: comments
url: https://github.com/pit-ray/win-vind/discussions

dl_ins_32: https://github.com/pit-ray/win-vind/releases/download/v5.12.0/win-vind_5.12.0_32bit_installer.zip
dl_zip_32: https://github.com/pit-ray/win-vind/releases/download/v5.12.0/win-vind_5.12.0_32bit_portable.zip
dl_ins_64: https://github.com/pit-ray/win-vind/releases/download/v5.12.0/win-vind_5.12.0_64bit_installer.zip
dl_zip_64: https://github.com/pit-ray/win-vind/releases/download/v5.12.0/win-vind_5.12.0_64bit_portable.zip
dl_ins_32: https://github.com/pit-ray/win-vind/releases/download/v5.13.1/win-vind_5.13.1_32bit_installer.zip
dl_zip_32: https://github.com/pit-ray/win-vind/releases/download/v5.13.1/win-vind_5.13.1_32bit_portable.zip
dl_ins_64: https://github.com/pit-ray/win-vind/releases/download/v5.13.1/win-vind_5.13.1_64bit_installer.zip
dl_zip_64: https://github.com/pit-ray/win-vind/releases/download/v5.13.1/win-vind_5.13.1_64bit_portable.zip

ui:
mode: 'light' # 'auto', 'dark', 'light'
Expand Down
13 changes: 11 additions & 2 deletions docs/cheat_sheet/options/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,21 @@ Font size of GUI
Specify the characters of hint used for EasyClick and GridMove. It accpets as input a set of non-duplicate characters and assigns them to the hints in order from the first to the last.



## Command Line

### **`vcmdline`**
**type**: bool, **default**: true
show virtual command line
Show virtual command line

<hr class="dash">

### **`showcmd`**
**type**: bool, **default**: true
Show the partial command in the virtual command line.
This feature causes some overhead.
If the count of repeats for a command is specified, the command is displayed following the count of repeats.
If you do not enter a repeat count for a command, then the repeat count is denoted as 1.
Unlike Vim, the repeat count is always explicitly displayed to reduce mistakes in the repeat count.

<hr class="dash">

Expand Down
39 changes: 20 additions & 19 deletions libs/fluent_tray/fluent_tray.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -937,26 +937,24 @@ namespace fluent_tray
}

POINT pos ;
if(!GetCursorPos(&pos)) {
return false ;
}

if(pos.x != previous_mouse_pos_.x || pos.y != previous_mouse_pos_.y) {
// The mouse cursor is moved, so switch to the mouse-mode.
for(int i = 0 ; i < static_cast<int>(menus_.size()) ; i ++) {
auto& menu = menus_[i] ;
auto detected_hwnd = WindowFromPoint(pos) ;
if(!detected_hwnd) {
return false ;
}
// Checks whether the mouse cursor is over the menu or not.
if(detected_hwnd == menu.window_handle()) {
// Start selection by key from the currently selected menu.
select_index_ = i ;
break ;
if(GetCursorPos(&pos)) {
if(pos.x != previous_mouse_pos_.x || pos.y != previous_mouse_pos_.y) {
// The mouse cursor is moved, so switch to the mouse-mode.
for(int i = 0 ; i < static_cast<int>(menus_.size()) ; i ++) {
auto& menu = menus_[i] ;
auto detected_hwnd = WindowFromPoint(pos) ;
if(!detected_hwnd) {
return false ;
}
// Checks whether the mouse cursor is over the menu or not.
if(detected_hwnd == menu.window_handle()) {
// Start selection by key from the currently selected menu.
select_index_ = i ;
break ;
}
}
previous_mouse_pos_ = pos ;
}
previous_mouse_pos_ = pos ;
}

if(select_index_ < 0) {
Expand Down Expand Up @@ -1422,7 +1420,10 @@ namespace fluent_tray
if(!Shell_NotifyIconW(NIM_ADD, &icon_data_)) {
return false ;
}
hide_menu_window() ;

if(!hide_menu_window()) {
return false ;
}

return true ;
}
Expand Down
12 changes: 9 additions & 3 deletions src/bind/emu/motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ namespace vind

auto solver = ihub.get_solver(Mode::EDI_NORMAL) ;
while(true) {
pimpl->bg_.update() ;
if(!pimpl->bg_.update()) {
continue ;
}

core::CmdUnit::SPtr input ;
std::uint16_t in_count ;
Expand Down Expand Up @@ -118,7 +120,9 @@ namespace vind

auto solver = ihub.get_solver(Mode::EDI_NORMAL) ;
while(true) {
pimpl->bg_.update() ;
if(!pimpl->bg_.update()) {
continue ;
}

core::CmdUnit::SPtr input ;
std::uint16_t in_count ;
Expand Down Expand Up @@ -178,7 +182,9 @@ namespace vind

auto solver = ihub.get_solver(Mode::EDI_NORMAL) ;
while(true) {
pimpl->bg_.update() ;
if(!pimpl->bg_.update()) {
continue ;
}

core::CmdUnit::SPtr input ;
std::uint16_t in_count ;
Expand Down
4 changes: 3 additions & 1 deletion src/bind/emu/replacetext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ namespace
}

while(true) {
bg_.update() ;
if(!bg_.update()) {
continue ;
}

if(igate.is_pressed(KEYCODE_ESC)) {
return ;
Expand Down
4 changes: 3 additions & 1 deletion src/bind/mode/command_mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,9 @@ namespace vind
auto result = SystemCall::SUCCEEDED ;
ac.apply(core::get_enter_event(core::Mode::COMMAND)) ;
while(true) {
pimpl->bg_.update() ;
if(!pimpl->bg_.update()) {
continue ;
}

bool break_flag = false ;
do {
Expand Down
4 changes: 3 additions & 1 deletion src/bind/mode/instant_mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ namespace vind

auto res = SystemCall::SUCCEEDED ;
while(true) {
pimpl->bg_.update() ;
if(!pimpl->bg_.update()) {
continue ;
}

std::vector<core::CmdUnit::SPtr> inputs ;
std::vector<std::uint16_t> in_counts ;
Expand Down
4 changes: 3 additions & 1 deletion src/bind/mouse/hinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ namespace vind
points, hint_texts, start_indices, mtxes) ;

while(true) {
pimpl->bg_.update() ;
if(!pimpl->bg_.update()) {
continue ;
}

// To use combined macros like <easyclick><click_left>,
// get the keys from the input queue rather than the mapped queue.
Expand Down
4 changes: 3 additions & 1 deletion src/bind/mouse/jump_keybrd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ namespace vind
auto toggle_keys = igate.pressed_list() ;

while(true) {
pimpl->bg_.update() ;
if(!pimpl->bg_.update()) {
continue ;
}

core::CmdUnit::SPtr inputs ;
std::uint16_t count ;
Expand Down
4 changes: 3 additions & 1 deletion src/bind/window/switch_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ namespace vind
auto mode = core::get_global_mode() ;

while(true) {
pimpl->bg_.update() ;
if(!pimpl->bg_.update()) {
continue ;
}

bool break_flag = false ;
do {
Expand Down
4 changes: 3 additions & 1 deletion src/bind/window/winresizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ namespace vind

core::InstantKeyAbsorber ika ;
while(true) {
pimpl->bg_.update() ;
if(!pimpl->bg_.update()) {
continue ;
}

bool break_flag = false ;
do {
Expand Down
33 changes: 28 additions & 5 deletions src/core/background.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,19 @@ namespace vind
{
struct Background::Impl {
std::vector<opt::Option::SPtr> opts_ ;
bool screen_is_locked_ ;

template <typename T>
Impl(T&& opts)
: opts_(std::forward<T>(opts))
: opts_(std::forward<T>(opts)),
screen_is_locked_(false)
{}

bool is_screen_locked() {
// GetCursorPos fails when the screen is locked.
POINT pos ;
return GetCursorPos(&pos) == 0 ;
}
} ;

Background::Background()
Expand All @@ -35,22 +43,37 @@ namespace vind

Background::~Background() noexcept = default ;

void Background::update() {
util::get_win_message() ;

bool Background::update() {
auto& igate = InputGate::get_instance() ;
Sleep(5) ;

if(pimpl->is_screen_locked()) {
if(!pimpl->screen_is_locked_) {
// Release all keys when the screen is locked.
for(auto& key : igate.pressed_list()) {
igate.release_virtually(key) ;
}
pimpl->screen_is_locked_ = true ;
}
return false ;
}
else if(pimpl->screen_is_locked_) {
pimpl->screen_is_locked_ = false ;
}

util::get_win_message() ;

for(const auto& op : pimpl->opts_) {
op->process() ;
}

auto& igate = InputGate::get_instance() ;
igate.refresh_toggle_state() ;

if(igate.is_really_pressed(KEYCODE_F8) && \
igate.is_really_pressed(KEYCODE_F9)) {
throw SafeForcedTermination() ;
}
return true ;
}
}
}
3 changes: 2 additions & 1 deletion src/core/background.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ namespace vind

// If you make some loop functions, the function is needed to call.
// It includes Sleep().
void update() ;
// If this function returns false, should skip an iteration.
bool update() ;

Background(const Background&) = delete ;
Background& operator=(const Background&) = delete ;
Expand Down
43 changes: 40 additions & 3 deletions src/core/entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ SOFTWARE.
#include <cstring>
#include <fstream>
#include <memory>
#include <sstream>

#include "autocmd.hpp"

Expand Down Expand Up @@ -317,11 +318,16 @@ namespace vind

void VindEntry::update() {
auto& ihub = InputHub::get_instance() ;
auto& settable = SetTable::get_instance() ;

// NOTE: it assume that these hwnd are fixed.
static const auto desktop_hwnd = GetDesktopWindow() ;
static const auto taskbar_hwnd = FindWindowA("Shell_TrayWnd", NULL) ;

if(!pimpl->bg_.update()) {
return ;
}

auto& ac = AutoCmd::get_instance() ;
auto hwnd = util::get_foreground_window() ;
auto procid = static_cast<DWORD>(0) ;
Expand All @@ -341,8 +347,6 @@ namespace vind
}
}

pimpl->bg_.update() ;

// TODO: It is necessary to add exclusive handling when
// write and read operations are performed at the same
// time by multiple processes. However, these are extremely
Expand Down Expand Up @@ -370,10 +374,43 @@ namespace vind

do {
CmdUnit::SPtr input ;
std::uint16_t count ;
std::uint16_t count = 0 ;
if(!ihub.pull_input(input, count)) {
if(settable.get("showcmd").get<bool>()) {
if(count > 0) {
opt::VCmdLine::reset() ;
opt::VCmdLine::print(opt::StaticMessage(std::to_string(count))) ;
}
}
continue ;
}

if(settable.get("showcmd").get<bool>()) {
auto solver = ihub.get_solver() ;
for(const auto& matcher : solver->get_trigger_matchers()) {
if(!matcher->is_matching()) {
continue ;
}
auto hist_size = matcher->history_size() ;
// If the any matcher isn't matched, the history size is zero.
if(hist_size == 0) {
opt::VCmdLine::reset() ;
break ;
}
std::stringstream ss ;
ss << count ;

auto cmd = matcher->get_command() ;
auto end_itr = cmd.begin() + hist_size ;
for(auto itr = cmd.begin() ; itr != end_itr ; itr ++) {
ss << **itr ;
}
opt::VCmdLine::reset() ;
opt::VCmdLine::print(opt::StaticMessage(ss.str())) ;
break ;
}
}

handle_system_call(input->execute(count)) ;

// correct the state to avoid cases that a virtual key
Expand Down
3 changes: 3 additions & 0 deletions src/core/inputhub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ namespace vind
*input, pimpl->count_.size() > 0) ;
if(!new_count.empty()) {
pimpl->count_ += new_count ;

// Store the count number, but return as false.
count = util::extract_num<std::uint16_t>(pimpl->count_) ;
return false ;
}
}
Expand Down
Loading

0 comments on commit 249f334

Please sign in to comment.