Skip to content

Commit

Permalink
Fixed crash problem when the computer is locked
Browse files Browse the repository at this point in the history
  • Loading branch information
pit-ray committed Jun 13, 2024
1 parent 69bbc2e commit 347d1fb
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions include/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

0 comments on commit 347d1fb

Please sign in to comment.