@@ -2,7 +2,7 @@ use crate::platform::macos::cursor::Cursor;
22use crate :: platform:: macos:: view:: BaseviewView ;
33use crate :: platform:: { PlatformHandle , WindowSharedState } ;
44use crate :: wrappers:: appkit:: { View , ViewRef } ;
5- use crate :: { MouseCursor , WindowSize } ;
5+ use crate :: * ;
66use dispatch2:: MainThreadBound ;
77use dpi:: Size ;
88use objc2:: rc:: Weak ;
@@ -50,27 +50,32 @@ impl WindowContext {
5050 view. isEqual ( Some ( & * first_responder) )
5151 }
5252
53- pub fn focus ( & self ) {
54- let Some ( view) = self . view . load ( ) else { return } ;
53+ pub fn focus ( & self ) -> Result < ( ) > {
54+ let Some ( view) = self . view . load ( ) else { return Ok ( ( ) ) } ;
5555 if let Some ( window) = view. window ( ) {
5656 window. makeFirstResponder ( Some ( & view) ) ;
5757 }
58+
59+ Ok ( ( ) )
5860 }
5961
60- pub fn resize ( & self , size : Size ) {
61- let Some ( view) = self . view . load ( ) else { return } ;
62- let Some ( view) = view. inner_ref ( ) else { return } ;
62+ pub fn resize ( & self , size : Size ) -> Result < ( ) > {
63+ let Some ( view) = self . view . load ( ) else { return Ok ( ( ) ) } ;
64+ let Some ( view) = view. inner_ref ( ) else { return Ok ( ( ) ) } ;
6365 if view. inner . state . closed . get ( ) {
64- return ;
66+ return Ok ( ( ) ) ;
6567 }
6668
6769 BaseviewView :: resize ( view, size) ;
70+
71+ Ok ( ( ) )
6872 }
6973
70- pub fn set_mouse_cursor ( & self , cursor : MouseCursor ) {
71- let Some ( view) = self . view . load ( ) else { return } ;
74+ pub fn set_mouse_cursor ( & self , cursor : MouseCursor ) -> Result < ( ) > {
75+ let Some ( view) = self . view . load ( ) else { return Ok ( ( ) ) } ;
7276 let native_cursor = Cursor :: from ( cursor) ;
7377 view. addCursorRect_cursor ( view. bounds ( ) , & native_cursor. load ( ) ) ;
78+ Ok ( ( ) )
7479 }
7580
7681 pub fn size ( & self ) -> WindowSize {
0 commit comments