Skip to content

Commit

Permalink
Fix problem with external monitor hints misalignment when laptop scre…
Browse files Browse the repository at this point in the history
…en is closed. (#245)

* change version

* fix the position of hints when laptop screen is closed.

* if the numbenr of monitor changes, reload settings
  • Loading branch information
pit-ray authored Jul 3, 2024
1 parent 0d32b82 commit 5edf0c7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.6.0)
project(win-vind VERSION 5.13.1)
set(INTERNAL_VERSION ${PROJECT_VERSION}.0)
project(win-vind VERSION 5.13.2)
set(INTERNAL_VERSION ${PROJECT_VERSION}.1)

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
Expand Down
13 changes: 12 additions & 1 deletion src/core/entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ SOFTWARE.
#include "opt/vcmdline.hpp"
#include "util/debug.hpp"
#include "util/interval_timer.hpp"
#include "util/screen_metrics.hpp"
#include "util/type_traits.hpp"
#include "util/winwrap.hpp"

Expand All @@ -108,6 +109,8 @@ namespace vind

DWORD previous_procid_ ;

std::size_t num_of_monitor_ ;

template <typename ExitFuncType, typename String>
Impl(ExitFuncType&& exitfunc, String&& memname, std::size_t memsize)
: exit_(std::forward<ExitFuncType>(exitfunc)),
Expand All @@ -117,7 +120,8 @@ namespace vind
subprocess_(false),
memread_timer_(1000'000), //1 s
bg_(opt::all_global_options()),
previous_procid_(0)
previous_procid_(0),
num_of_monitor_(util::get_all_monitor_metrics().size())
{}

~Impl() noexcept {
Expand Down Expand Up @@ -372,6 +376,13 @@ namespace vind
}
}

// If the number of monitors changes, reload the settings.
auto current_num_of_monitor = util::get_all_monitor_metrics().size() ;
if(current_num_of_monitor != pimpl->num_of_monitor_) {
reconstruct() ;
pimpl->num_of_monitor_ = current_num_of_monitor ;
}

do {
CmdUnit::SPtr input ;
std::uint16_t count = 0 ;
Expand Down
2 changes: 1 addition & 1 deletion src/core/version.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifndef _VERSION_HPP
#define _VERSION_HPP

#define WIN_VIND_VERSION "5.13.1.0"
#define WIN_VIND_VERSION "5.13.2.1"

#endif

0 comments on commit 5edf0c7

Please sign in to comment.