Skip to content

Commit 347d1fb

Browse files
committed
Fixed crash problem when the computer is locked
1 parent 69bbc2e commit 347d1fb

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

include/fluent_tray.hpp

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -937,26 +937,24 @@ namespace fluent_tray
937937
}
938938

939939
POINT pos ;
940-
if(!GetCursorPos(&pos)) {
941-
return false ;
942-
}
943-
944-
if(pos.x != previous_mouse_pos_.x || pos.y != previous_mouse_pos_.y) {
945-
// The mouse cursor is moved, so switch to the mouse-mode.
946-
for(int i = 0 ; i < static_cast<int>(menus_.size()) ; i ++) {
947-
auto& menu = menus_[i] ;
948-
auto detected_hwnd = WindowFromPoint(pos) ;
949-
if(!detected_hwnd) {
950-
return false ;
951-
}
952-
// Checks whether the mouse cursor is over the menu or not.
953-
if(detected_hwnd == menu.window_handle()) {
954-
// Start selection by key from the currently selected menu.
955-
select_index_ = i ;
956-
break ;
940+
if(GetCursorPos(&pos)) {
941+
if(pos.x != previous_mouse_pos_.x || pos.y != previous_mouse_pos_.y) {
942+
// The mouse cursor is moved, so switch to the mouse-mode.
943+
for(int i = 0 ; i < static_cast<int>(menus_.size()) ; i ++) {
944+
auto& menu = menus_[i] ;
945+
auto detected_hwnd = WindowFromPoint(pos) ;
946+
if(!detected_hwnd) {
947+
return false ;
948+
}
949+
// Checks whether the mouse cursor is over the menu or not.
950+
if(detected_hwnd == menu.window_handle()) {
951+
// Start selection by key from the currently selected menu.
952+
select_index_ = i ;
953+
break ;
954+
}
957955
}
956+
previous_mouse_pos_ = pos ;
958957
}
959-
previous_mouse_pos_ = pos ;
960958
}
961959

962960
if(select_index_ < 0) {

0 commit comments

Comments
 (0)