Skip to content

Commit

Permalink
Fix the problem of incorrect screen resolution after resize.
Browse files Browse the repository at this point in the history
  • Loading branch information
qiuguohua committed Jul 20, 2023
1 parent 9ce02b5 commit d64365d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion native/cocos/engine/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,12 @@ bool Engine::redirectWindowEvent(const WindowEvent &ev) {
isHandled = true;
} else if (ev.type == WindowEvent::Type::SIZE_CHANGED ||
ev.type == WindowEvent::Type::RESIZED) {
events::Resize::broadcast(ev.width, ev.height, ev.windowId);
auto *w = CC_GET_SYSTEM_WINDOW(ev.windowId);
CC_ASSERT(w);
w->setViewSize(ev.width, ev.height);
// Because the ts layer calls the getviewsize interface in response to resize.
// So we need to set the view size when sending the message.
events::Resize::broadcast(ev.width, ev.height, ev.windowId);
isHandled = true;
} else if (ev.type == WindowEvent::Type::HIDDEN ||
ev.type == WindowEvent::Type::MINIMIZED) {
Expand Down

0 comments on commit d64365d

Please sign in to comment.