Skip to content

Commit fa21e39

Browse files
committed
macOS: fix mouse capture release
1 parent 2caa1c0 commit fa21e39

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

Platform/macOS/Display/VMDisplayMetalWindowController.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,4 +255,7 @@ extension VMDisplayMetalWindowController: VMMetalViewInputDelegate {
255255
sendExtendedKey(.release, keyCode: keyCode)
256256
}
257257

258+
func requestReleaseCapture() {
259+
releaseMouse()
260+
}
258261
}

Platform/macOS/Display/VMMetalView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ class VMMetalView: MTKView {
204204
logger.debug("modifers: \(modifiers)")
205205
if modifiers.isSuperset(of: [.option, .control]) {
206206
logger.debug("release cursor")
207-
releaseMouse()
207+
inputDelegate?.requestReleaseCapture()
208208
}
209209
sendModifiers(lastModifiers.subtracting(modifiers), press: false)
210210
sendModifiers(modifiers.subtracting(lastModifiers), press: true)

Platform/macOS/Display/VMMetalViewInputDelegate.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ protocol VMMetalViewInputDelegate: class {
2222
func mouseScroll(dy: CGFloat, button: CSInputButton)
2323
func keyDown(keyCode: Int)
2424
func keyUp(keyCode: Int)
25+
func requestReleaseCapture()
2526
}

0 commit comments

Comments
 (0)