Skip to content

Commit

Permalink
added setNeedsDisplayHack
Browse files Browse the repository at this point in the history
  • Loading branch information
birhburh authored and not-fl3 committed Jul 14, 2024
1 parent 65ff816 commit 611f727
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/native/macos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,12 @@ unsafe fn view_base_decl(decl: &mut ClassDecl) {
}
}

extern "C" fn set_needs_display_hack(this: &Object, _: Sel) {
unsafe {
msg_send_![this, setNeedsDisplay: YES];
}
}

decl.add_method(
sel!(canBecomeKey),
yes as extern "C" fn(&Object, Sel) -> BOOL,
Expand Down Expand Up @@ -783,6 +789,10 @@ unsafe fn view_base_decl(decl: &mut ClassDecl) {
sel!(processMessage:),
process_message as extern "C" fn(&Object, Sel, ObjcId),
);
decl.add_method(
sel!(setNeedsDisplayHack),
set_needs_display_hack as extern "C" fn(&Object, Sel),
);
}

pub fn define_opengl_view_class() -> *const Class {
Expand Down Expand Up @@ -1272,7 +1282,7 @@ where

if !conf.platform.blocking_event_loop || update_requested {
unsafe {
msg_send_![view, performSelectorOnMainThread:sel!(setNeedsDisplay:) withObject:nil waitUntilDone:NO];
msg_send_![view, performSelectorOnMainThread:sel!(setNeedsDisplayHack) withObject:nil waitUntilDone:NO];
}
}
thread::yield_now();
Expand Down

0 comments on commit 611f727

Please sign in to comment.