bsnes-classic/bsnes/ui-qt/platform/platform_win.cpp
devinacker 98ea724717 don't deadlock GUI when windows system menu is open
(should fix #33, and let's mask WM_SYSCOMMAND's param correctly while
i'm at it just in case)
2015-11-09 22:01:20 -05:00

25 lines
603 B
C++

#include <nall/utf8.hpp>
bool Application::App::winEventFilter(MSG *msg, long *result) {
//supress screen saver from activating during gameplay
if(msg->message == WM_SYSCOMMAND) {
WPARAM wParam = msg->wParam & 0xFFF0;
if(wParam == SC_SCREENSAVE || wParam == SC_MONITORPOWER) {
*result = 0;
return true;
}
}
//prevent DirectSound audio buffer from looping during Windows modal events
if(msg->message == WM_ENTERMENULOOP || msg->message == WM_ENTERSIZEMOVE) {
audio.clear();
}
return false;
}
void supressScreenSaver() {
//handled by event filter above
}