Skip to content

Commit

Permalink
[Cocoa] App crashing when closing fullscreen window
Browse files Browse the repository at this point in the history
  • Loading branch information
r0x0r committed Oct 16, 2023
1 parent d22ac84 commit 8588a88
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions webview/platforms/cocoa.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,31 +104,40 @@ def windowWillClose_(self, notification):

def windowDidResize_(self, notification):
i = BrowserView.get_instance('window', notification.object())
size = i.window.frame().size
i.pywebview_window.events.resized.set(size.width, size.height)

if i:
size = i.window.frame().size
i.pywebview_window.events.resized.set(size.width, size.height)

def windowDidMiniaturize_(self, notification):
i = BrowserView.get_instance('window', notification.object())
i.pywebview_window.events.minimized.set()

if i:
i.pywebview_window.events.minimized.set()

def windowDidDeminiaturize_(self, notification):
i = BrowserView.get_instance('window', notification.object())
i.pywebview_window.events.restored.set()

if i:
i.pywebview_window.events.restored.set()

def windowDidEnterFullScreen_(self, notification):
i = BrowserView.get_instance('window', notification.object())
i.pywebview_window.events.maximized.set()
if i:
i.pywebview_window.events.maximized.set()

def windowDidExitFullScreen_(self, notification):
i = BrowserView.get_instance('window', notification.object())
i.pywebview_window.events.restored.set()
if i:
i.pywebview_window.events.restored.set()

def windowDidMove_(self, notification):
i = BrowserView.get_instance('window', notification.object())
frame = i.window.frame()
screen = i.window.screen().frame()
flipped_y = screen.size.height - frame.size.height - frame.origin.y
i.pywebview_window.events.moved.set(frame.origin.x, flipped_y)
if i:
frame = i.window.frame()
screen = i.window.screen().frame()
flipped_y = screen.size.height - frame.size.height - frame.origin.y
i.pywebview_window.events.moved.set(frame.origin.x, flipped_y)

class JSBridge(AppKit.NSObject):
def initWithObject_(self, window):
Expand Down

0 comments on commit 8588a88

Please sign in to comment.