mirror of
https://github.com/utmapp/UTM.git
synced 2026-10-12 02:24:01 +00:00
@@ -26,11 +26,12 @@ class VMMetalView: MTKView {
|
||||
private(set) var isMouseInWindow = false
|
||||
@Setting("HandleInitialClick") private var isHandleInitialClick: Bool = false
|
||||
@Setting("IsCtrlCmdSwapped") private var isCtrlCmdSwapped = false
|
||||
@Setting("IsISOKeySwapped") private var isISOKeySwapped = false
|
||||
|
||||
/// On ISO keyboards we have to switch `kVK_ISO_Section` and `kVK_ANSI_Grave`
|
||||
/// from: https://chromium.googlesource.com/chromium/src/+/lkgr/ui/events/keycodes/keyboard_code_conversion_mac.mm
|
||||
private func convertToCurrentLayout(for keycode: Int) -> Int {
|
||||
guard KBGetLayoutType(Int16(LMGetKbdType())) == kKeyboardISO else {
|
||||
guard !isISOKeySwapped && KBGetLayoutType(Int16(LMGetKbdType())) == kKeyboardISO else {
|
||||
return keycode
|
||||
}
|
||||
switch keycode {
|
||||
|
||||
@@ -272,7 +272,8 @@ struct InputSettingsView: View {
|
||||
@AppStorage("IsCtrlCmdSwapped") var isCtrlCmdSwapped = false
|
||||
@AppStorage("InvertScroll") var isInvertScroll = false
|
||||
@AppStorage("HandleInitialClick") var isHandleInitialClick = false
|
||||
|
||||
@AppStorage("IsISOKeySwapped") var isISOKeySwapped = false
|
||||
|
||||
@State private var isKeyboardShortcutsShown = false
|
||||
|
||||
var body: some View {
|
||||
@@ -320,6 +321,9 @@ struct InputSettingsView: View {
|
||||
Toggle(isOn: $isCtrlCmdSwapped, label: {
|
||||
Text("Swap Control (⌃) and Command (⌘) keys")
|
||||
}).help("This does not apply to key binding outside the guest.")
|
||||
Toggle(isOn: $isISOKeySwapped) {
|
||||
Text("Swap the leftmost key on the number row and the key next to left shift on ISO keyboards")
|
||||
}.help("This only applies to ISO layout keyboards.")
|
||||
}
|
||||
.sheet(isPresented: $isKeyboardShortcutsShown) {
|
||||
VMKeyboardShortcutsView().padding()
|
||||
|
||||
Reference in New Issue
Block a user