Skip to content

Commit

Permalink
fix hide window
Browse files Browse the repository at this point in the history
  • Loading branch information
pit-ray committed Feb 13, 2024
1 parent a54df44 commit bde70db
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions include/fluent_tray.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ namespace fluent_tray

if(GetForegroundWindow() != hwnd_ && visible_) {
if(!hide_menu_window()) {
status_ = TrayStatus::FAILED ;
fail() ;
return false ;
}
}
Expand All @@ -948,7 +948,7 @@ namespace fluent_tray
if(menu.is_mouse_over()) {
if(!mouse_is_over_[i]) {
if(!change_menu_back_color(menu, ash_color_)) {
status_ = TrayStatus::FAILED ;
fail() ;
return false ;
}
}
Expand All @@ -957,7 +957,7 @@ namespace fluent_tray
else {
if(mouse_is_over_[i]) {
if(!change_menu_back_color(menu, back_color_)) {
status_ = TrayStatus::FAILED ;
fail() ;
return false ;
}
}
Expand Down Expand Up @@ -1109,8 +1109,13 @@ namespace fluent_tray
* @return Returns true on success, false on failure.
*/
bool hide_menu_window() {
if(!ShowWindow(hwnd_, SW_HIDE)) {
return false ;
if(!visible_) {
return true ;
}
if(GetForegroundWindow() == hwnd_) {
if(!ShowWindow(hwnd_, SW_HIDE)) {
return false ;
}
}
visible_ = false ;

Expand Down

0 comments on commit bde70db

Please sign in to comment.