Skip to content

Commit

Permalink
match X11 and close down our app if the simulator window is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Jan 13, 2025
1 parent ae4dacb commit d6d65dc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion internal/driver/mobile/app/darwin_desktop.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,18 @@ func eventMouseDragged(x, y float32) { sendTouch(touch.TypeMove, x, y) }
//export eventMouseEnd
func eventMouseEnd(x, y float32) { sendTouch(touch.TypeEnd, x, y) }

var stopped = false

//export lifecycleDead
func lifecycleDead() { theApp.sendLifecycle(lifecycle.StageDead) }
func lifecycleDead() {
if stopped {
return
}
stopped = true

theApp.sendLifecycle(lifecycle.StageDead)
theApp.events.Close()
}

//export eventKey
func eventKey(runeVal int32, direction uint8, code uint16, flags uint32) {
Expand Down
2 changes: 1 addition & 1 deletion internal/driver/mobile/app/darwin_desktop.m
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ - (void)applicationWillUnhide:(NSNotification *)notification {
}

- (void)windowWillClose:(NSNotification *)notification {
lifecycleAlive();
lifecycleDead();
}

- (BOOL)acceptsFirstResponder {
Expand Down

0 comments on commit d6d65dc

Please sign in to comment.