Skip to content

Commit

Permalink
fix(addon): Call javascript callback on QueryEndSession instead of En…
Browse files Browse the repository at this point in the history
…dSession
  • Loading branch information
gergof committed Sep 6, 2022
1 parent c32a062 commit 92d435b
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions module/WinShutdownHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,21 +117,16 @@ namespace PaymoWinShutdownHandler {

LRESULT CALLBACK WindowProcCb(HWND hWindow, UINT event, WPARAM wParam, LPARAM lParam) {
if (event == WM_QUERYENDSESSION) {
tsfn.BlockingCall([](Napi::Env env, Napi::Function jsCallback) {
jsCallback.Call({});
});

if (shouldBlockShutdown) {
return FALSE;
}

return TRUE;
}
else if (event == WM_ENDSESSION) {
if (wParam == TRUE) {
tsfn.BlockingCall([](Napi::Env env, Napi::Function jsCallback) {
jsCallback.Call({});
});

return 0;
}
}

return CallWindowProc(prevWndProc, hWindow, event, wParam, lParam);
}
Expand Down

0 comments on commit 92d435b

Please sign in to comment.