macos: fix an incorrect type signature on NSView drawRect (#1104)

This commit is contained in:
mtak- 2019-08-13 21:01:22 -07:00 committed by Osspial
parent 1366dc326a
commit 1aab328e2a
2 changed files with 3 additions and 2 deletions

View file

@ -23,6 +23,7 @@
hijacking `set_decorations` for this purpose. hijacking `set_decorations` for this purpose.
- On macOS and iOS, corrected the auto trait impls of `EventLoopProxy`. - On macOS and iOS, corrected the auto trait impls of `EventLoopProxy`.
- On iOS, add touch pressure information for touch events. - On iOS, add touch pressure information for touch events.
- On macOS, fix the signature of `-[NSView drawRect:]`.
# 0.20.0 Alpha 2 (2019-07-09) # 0.20.0 Alpha 2 (2019-07-09)

View file

@ -104,7 +104,7 @@ lazy_static! {
); );
decl.add_method( decl.add_method(
sel!(drawRect:), sel!(drawRect:),
draw_rect as extern "C" fn(&Object, Sel, id), draw_rect as extern "C" fn(&Object, Sel, NSRect),
); );
decl.add_method( decl.add_method(
sel!(acceptsFirstResponder), sel!(acceptsFirstResponder),
@ -280,7 +280,7 @@ extern "C" fn view_did_move_to_window(this: &Object, _sel: Sel) {
trace!("Completed `viewDidMoveToWindow`"); trace!("Completed `viewDidMoveToWindow`");
} }
extern "C" fn draw_rect(this: &Object, _sel: Sel, rect: id) { extern "C" fn draw_rect(this: &Object, _sel: Sel, rect: NSRect) {
unsafe { unsafe {
let state_ptr: *mut c_void = *this.get_ivar("winitState"); let state_ptr: *mut c_void = *this.get_ivar("winitState");
let state = &mut *(state_ptr as *mut ViewState); let state = &mut *(state_ptr as *mut ViewState);