aboutsummaryrefslogtreecommitdiff
path: root/src/osx/gui/Window.mm
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-10-16 23:00:33 +0800
committercrupest <crupest@outlook.com>2021-10-16 23:00:33 +0800
commit44f24f8ece48fd4acc2e8d5f5a052cbc1981768c (patch)
tree82598657107e3972bca357eb40484e676d9ec365 /src/osx/gui/Window.mm
parente9f586071a83b2551dbc7c98ccfaa8e6b3189f01 (diff)
downloadcru-44f24f8ece48fd4acc2e8d5f5a052cbc1981768c.tar.gz
cru-44f24f8ece48fd4acc2e8d5f5a052cbc1981768c.tar.bz2
cru-44f24f8ece48fd4acc2e8d5f5a052cbc1981768c.zip
...
Diffstat (limited to 'src/osx/gui/Window.mm')
-rw-r--r--src/osx/gui/Window.mm10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/osx/gui/Window.mm b/src/osx/gui/Window.mm
index dfe94d43..ce28e8a2 100644
--- a/src/osx/gui/Window.mm
+++ b/src/osx/gui/Window.mm
@@ -117,8 +117,8 @@ void OsxWindowPrivate::OnWindowWillClose() {
graphics_context_ = nil;
}
-void OsxWindowPrivate::OnWindowDidExpose() { [window_ update]; }
-void OsxWindowPrivate::OnWindowDidUpdate() { osx_window_->paint_event_.Raise(nullptr); }
+void OsxWindowPrivate::OnWindowDidExpose() { osx_window_->RequestRepaint(); }
+void OsxWindowPrivate::OnWindowDidUpdate() {}
void OsxWindowPrivate::OnWindowDidResize() {
osx_window_->resize_event_.Raise(osx_window_->GetClientSize());
@@ -126,6 +126,8 @@ void OsxWindowPrivate::OnWindowDidResize() {
styleMask:CalcWindowStyleMask(frame_)];
content_rect_ = cru::platform::graphics::osx::quartz::Convert(rect);
+
+ osx_window_->RequestRepaint();
}
void OsxWindowPrivate::OnMouseEnterLeave(MouseEnterLeaveType type) {
@@ -248,7 +250,9 @@ void OsxWindow::SetWindowRect(const Rect& rect) {
}
}
-void OsxWindow::RequestRepaint() { [p_->window_ update]; }
+void OsxWindow::RequestRepaint() {
+ GetUiApplication()->SetImmediate([this] { paint_event_.Raise(nullptr); });
+}
std::unique_ptr<graphics::IPainter> OsxWindow::BeginPaint() {
CGContextRef cg_context = [p_->graphics_context_ CGContext];