Skip to content

Commit

Permalink
fix: bind on_ready to the application not the window (#20)
Browse files Browse the repository at this point in the history
Signed-off-by: Tony Gorez <[email protected]>
  • Loading branch information
tony-go authored Oct 29, 2024
1 parent 7789fee commit 9993642
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
9 changes: 8 additions & 1 deletion src/application/win32/app_win32.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,14 @@ auto Application::run() noexcept -> int {
assert(!running_);
running_ = true;

on_start();
try {
this->on_start();
// It seems that win32 doesn't have a ready message
// which is app-wide, events are correlated to the window
this->on_ready();
} catch (...) {
this->on_error(std::current_exception());
}

const char CLASS_NAME[] = "NativeWin32ApplicationClass";

Expand Down
5 changes: 0 additions & 5 deletions src/application/win32/delegate_win32.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ LRESULT CALLBACK AppDelegate::WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
LPARAM lParam) {
switch (uMsg) {
case WM_CREATE:
// try {
ApplicationInternals::on_ready();
// } catch (...) {
// ApplicationInternals::on_error(std::current_exception());
// }
return 0;
case WM_DESTROY:
PostQuitMessage(0);
Expand Down

0 comments on commit 9993642

Please sign in to comment.