Skip to content

Commit

Permalink
fix: enumrate windows time on Windows: ~30ms -> ~5ms
Browse files Browse the repository at this point in the history
  • Loading branch information
ffiirree committed Mar 16, 2024
1 parent 7d0a90b commit 6873111
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/common/hunter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ namespace hunter
return scoped;
}

void ready(window_filter_t flags)
void ready(const window_filter_t flags)
{
__scope = flags;
__preys.clear();

std::ranges::for_each(probe::graphics::windows(flags),
std::ranges::for_each(probe::graphics::windows(flags, false),
[&](const auto& win) { __preys.emplace_back(prey_t::from(win)); });

std::ranges::for_each(probe::graphics::displays(),
Expand All @@ -111,7 +111,7 @@ namespace hunter
__preys.clear();
}

std::string to_string(prey_type_t type)
std::string to_string(const prey_type_t type)
{
switch (type) {
case prey_type_t::rectangle: return "rectangle";
Expand Down
1 change: 0 additions & 1 deletion src/common/selector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ void Selector::start(const probe::graphics::window_filter_t flags)

box_.range(probe::graphics::virtual_screen_geometry());

// FIXME: 35ms -> 1ms, speed up
hunter::ready(flags);
select(hunter::hunt(QCursor::pos()));
info_->show();
Expand Down

0 comments on commit 6873111

Please sign in to comment.