Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
a0f7f6ca
Unverified
Commit
a0f7f6ca
authored
Apr 08, 2020
by
Francisco Magdaleno
Committed by
GitHub
Apr 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[windows] Adds support for keyboard mapping. (#54227)
parent
45bf8380
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
941 additions
and
43 deletions
+941
-43
raw_keyboard.dart
dev/manual_tests/lib/raw_keyboard.dart
+5
-0
gen_keycodes.dart
dev/tools/gen_keycodes/bin/gen_keycodes.dart
+2
-2
key_data.json
dev/tools/gen_keycodes/data/key_data.json
+25
-32
key_name_to_windows_name.json
dev/tools/gen_keycodes/data/key_name_to_windows_name.json
+4
-4
keyboard_key.tmpl
dev/tools/gen_keycodes/data/keyboard_key.tmpl
+1
-1
keyboard_maps.tmpl
dev/tools/gen_keycodes/data/keyboard_maps.tmpl
+17
-0
dart_code_gen.dart
dev/tools/gen_keycodes/lib/dart_code_gen.dart
+40
-0
services.dart
packages/flutter/lib/services.dart
+1
-0
keyboard_maps.dart
packages/flutter/lib/src/services/keyboard_maps.dart
+303
-0
raw_keyboard.dart
packages/flutter/lib/src/services/raw_keyboard.dart
+9
-0
raw_keyboard_windows.dart
packages/flutter/lib/src/services/raw_keyboard_windows.dart
+291
-0
raw_keyboard_test.dart
packages/flutter/test/services/raw_keyboard_test.dart
+174
-4
event_simulation.dart
packages/flutter_test/lib/src/event_simulation.dart
+69
-0
No files found.
dev/manual_tests/lib/raw_keyboard.dart
View file @
a0f7f6ca
...
@@ -109,6 +109,11 @@ class _HardwareKeyDemoState extends State<RawKeyboardDemo> {
...
@@ -109,6 +109,11 @@ class _HardwareKeyDemoState extends State<RawKeyboardDemo> {
dataText
.
add
(
Text
(
'scanCode:
${data.scanCode}
'
));
dataText
.
add
(
Text
(
'scanCode:
${data.scanCode}
'
));
dataText
.
add
(
Text
(
'unicodeScalarValues:
${data.unicodeScalarValues}
'
));
dataText
.
add
(
Text
(
'unicodeScalarValues:
${data.unicodeScalarValues}
'
));
dataText
.
add
(
Text
(
'modifiers:
${data.modifiers}
(
${_asHex(data.modifiers)}
)'
));
dataText
.
add
(
Text
(
'modifiers:
${data.modifiers}
(
${_asHex(data.modifiers)}
)'
));
}
else
if
(
data
is
RawKeyEventDataWindows
)
{
dataText
.
add
(
Text
(
'keyCode:
${data.keyCode}
(
${_asHex(data.keyCode)}
)'
));
dataText
.
add
(
Text
(
'scanCode:
${data.scanCode}
'
));
dataText
.
add
(
Text
(
'characterCodePoint:
${data.characterCodePoint}
'
));
dataText
.
add
(
Text
(
'modifiers:
${data.modifiers}
(
${_asHex(data.modifiers)}
)'
));
}
}
dataText
.
add
(
Text
(
'logical:
${_event.logicalKey}
'
));
dataText
.
add
(
Text
(
'logical:
${_event.logicalKey}
'
));
dataText
.
add
(
Text
(
'physical:
${_event.physicalKey}
'
));
dataText
.
add
(
Text
(
'physical:
${_event.physicalKey}
'
));
...
...
dev/tools/gen_keycodes/bin/gen_keycodes.dart
View file @
a0f7f6ca
...
@@ -18,8 +18,8 @@ import 'package:gen_keycodes/utils.dart';
...
@@ -18,8 +18,8 @@ import 'package:gen_keycodes/utils.dart';
/// Get contents of the file that contains the key code mapping in Chromium
/// Get contents of the file that contains the key code mapping in Chromium
/// source.
/// source.
Future
<
String
>
getChromiumConversions
()
async
{
Future
<
String
>
getChromiumConversions
()
async
{
final
Uri
keyCode
MapUri
=
Uri
.
parse
(
'https://cs.chromium.org/codesearch/f/chromium/src/ui/events/keycodes/dom/dom_code_data.inc
'
);
final
Uri
keyCode
sUri
=
Uri
.
parse
(
'https://chromium.googlesource.com/codesearch/chromium/src/+/refs/heads/master/ui/events/keycodes/dom/dom_code_data.inc?format=TEXT
'
);
return
await
http
.
read
(
keyCodeMapUri
);
return
utf8
.
decode
(
base64
.
decode
(
await
http
.
read
(
keyCodesUri
))
);
}
}
/// Get contents of the file that contains the key codes in Android source.
/// Get contents of the file that contains the key codes in Android source.
...
...
dev/tools/gen_keycodes/data/key_data.json
View file @
a0f7f6ca
...
@@ -191,29 +191,6 @@
...
@@ -191,29 +191,6 @@
"windows"
:
null
"windows"
:
null
}
}
},
},
"privacyScreenToggle"
:
{
"names"
:
{
"domkey"
:
"PrivacyScreenToggle"
,
"android"
:
null
,
"english"
:
"Privacy Screen Toggle"
,
"chromium"
:
"privacyScreenToggle"
,
"glfw"
:
null
,
"windows"
:
null
},
"scanCodes"
:
{
"android"
:
null
,
"usb"
:
23
,
"linux"
:
633
,
"xkb"
:
641
,
"windows"
:
null
,
"macos"
:
null
},
"keyCodes"
:
{
"android"
:
null
,
"glfw"
:
null
,
"windows"
:
null
}
},
"sleep"
:
{
"sleep"
:
{
"names"
:
{
"names"
:
{
"domkey"
:
"Sleep"
,
"domkey"
:
"Sleep"
,
...
@@ -3080,7 +3057,9 @@
...
@@ -3080,7 +3057,9 @@
"glfw"
:
[
"glfw"
:
[
"RIGHT"
"RIGHT"
],
],
"windows"
:
null
"windows"
:
[
"RIGHT"
]
},
},
"scanCodes"
:
{
"scanCodes"
:
{
"android"
:
[
"android"
:
[
...
@@ -3099,7 +3078,9 @@
...
@@ -3099,7 +3078,9 @@
"glfw"
:
[
"glfw"
:
[
262
262
],
],
"windows"
:
null
"windows"
:
[
39
]
}
}
},
},
"arrowLeft"
:
{
"arrowLeft"
:
{
...
@@ -3113,7 +3094,9 @@
...
@@ -3113,7 +3094,9 @@
"glfw"
:
[
"glfw"
:
[
"LEFT"
"LEFT"
],
],
"windows"
:
null
"windows"
:
[
"LEFT"
]
},
},
"scanCodes"
:
{
"scanCodes"
:
{
"android"
:
[
"android"
:
[
...
@@ -3132,7 +3115,9 @@
...
@@ -3132,7 +3115,9 @@
"glfw"
:
[
"glfw"
:
[
263
263
],
],
"windows"
:
null
"windows"
:
[
37
]
}
}
},
},
"arrowDown"
:
{
"arrowDown"
:
{
...
@@ -3146,7 +3131,9 @@
...
@@ -3146,7 +3131,9 @@
"glfw"
:
[
"glfw"
:
[
"DOWN"
"DOWN"
],
],
"windows"
:
null
"windows"
:
[
"DOWN"
]
},
},
"scanCodes"
:
{
"scanCodes"
:
{
"android"
:
[
"android"
:
[
...
@@ -3165,7 +3152,9 @@
...
@@ -3165,7 +3152,9 @@
"glfw"
:
[
"glfw"
:
[
264
264
],
],
"windows"
:
null
"windows"
:
[
40
]
}
}
},
},
"arrowUp"
:
{
"arrowUp"
:
{
...
@@ -3179,7 +3168,9 @@
...
@@ -3179,7 +3168,9 @@
"glfw"
:
[
"glfw"
:
[
"UP"
"UP"
],
],
"windows"
:
null
"windows"
:
[
"UP"
]
},
},
"scanCodes"
:
{
"scanCodes"
:
{
"android"
:
[
"android"
:
[
...
@@ -3198,7 +3189,9 @@
...
@@ -3198,7 +3189,9 @@
"glfw"
:
[
"glfw"
:
[
265
265
],
],
"windows"
:
null
"windows"
:
[
38
]
}
}
},
},
"numLock"
:
{
"numLock"
:
{
...
@@ -8276,4 +8269,4 @@
...
@@ -8276,4 +8269,4 @@
"windows"
:
null
"windows"
:
null
}
}
}
}
}
}
\ No newline at end of file
dev/tools/gen_keycodes/data/key_name_to_windows_name.json
View file @
a0f7f6ca
...
@@ -31,10 +31,10 @@
...
@@ -31,10 +31,10 @@
"next"
:
[
"NEXT"
],
"next"
:
[
"NEXT"
],
"end"
:
[
"END"
],
"end"
:
[
"END"
],
"home"
:
[
"HOME"
],
"home"
:
[
"HOME"
],
"
leftArrow
"
:
[
"LEFT"
],
"
arrowLeft
"
:
[
"LEFT"
],
"
upArrow
"
:
[
"UP"
],
"
arrowUp
"
:
[
"UP"
],
"
rightArrow
"
:
[
"RIGHT"
],
"
arrowRight
"
:
[
"RIGHT"
],
"
downArrow
"
:
[
"DOWN"
],
"
arrowDown
"
:
[
"DOWN"
],
"select"
:
[
"SELECT"
],
"select"
:
[
"SELECT"
],
"print"
:
[
"PRINT"
],
"print"
:
[
"PRINT"
],
"execute"
:
[
"EXECUTE"
],
"execute"
:
[
"EXECUTE"
],
...
...
dev/tools/gen_keycodes/data/keyboard_key.tmpl
View file @
a0f7f6ca
...
@@ -19,7 +19,7 @@ import 'package:flutter/foundation.dart';
...
@@ -19,7 +19,7 @@ import 'package:flutter/foundation.dart';
/// that are returned from [RawKeyEvent.physicalKey].
/// that are returned from [RawKeyEvent.physicalKey].
/// * [LogicalKeyboardKey], a class with static values that describe the keys
/// * [LogicalKeyboardKey], a class with static values that describe the keys
/// that are returned from [RawKeyEvent.logicalKey].
/// that are returned from [RawKeyEvent.logicalKey].
abstract class KeyboardKey
extends
Diagnosticable {
abstract class KeyboardKey
with
Diagnosticable {
/// A const constructor so that subclasses may be const.
/// A const constructor so that subclasses may be const.
const KeyboardKey();
const KeyboardKey();
}
}
...
...
dev/tools/gen_keycodes/data/keyboard_maps.tmpl
View file @
a0f7f6ca
...
@@ -92,3 +92,20 @@ const Map<String, PhysicalKeyboardKey> kWebToPhysicalKey = <String, PhysicalKeyb
...
@@ -92,3 +92,20 @@ const Map<String, PhysicalKeyboardKey> kWebToPhysicalKey = <String, PhysicalKeyb
const Map<String, LogicalKeyboardKey> kWebNumPadMap = <String, LogicalKeyboardKey>{
const Map<String, LogicalKeyboardKey> kWebNumPadMap = <String, LogicalKeyboardKey>{
@@@WEB_NUMPAD_MAP@@@
@@@WEB_NUMPAD_MAP@@@
};
};
/// Maps Windows KeyboardEvent codes to the matching [LogicalKeyboardKey].
const Map<int, LogicalKeyboardKey> kWindowsToLogicalKey = <int, LogicalKeyboardKey>{
@@@WINDOWS_LOGICAL_KEY_MAP@@@
};
/// Maps Windows KeyboardEvent codes to the matching [PhysicalKeyboardKey].
const Map<int, PhysicalKeyboardKey> kWindowsToPhysicalKey = <int, PhysicalKeyboardKey>{
@@@WINDOWS_PHYSICAL_KEY_MAP@@@
};
/// A map of Windows KeyboardEvent codes which have printable representations, but appear
/// on the number pad. Used to provide different key objects for keys like
/// KEY_EQUALS and NUMPAD_EQUALS.
const Map<int, LogicalKeyboardKey> kWindowsNumPadMap = <int, LogicalKeyboardKey>{
@@@WINDOWS_NUMPAD_MAP@@@
};
dev/tools/gen_keycodes/lib/dart_code_gen.dart
View file @
a0f7f6ca
...
@@ -225,6 +225,43 @@ $otherComments static const LogicalKeyboardKey $constantName = LogicalKeyboardK
...
@@ -225,6 +225,43 @@ $otherComments static const LogicalKeyboardKey $constantName = LogicalKeyboardK
return
androidScanCodeMap
.
toString
().
trimRight
();
return
androidScanCodeMap
.
toString
().
trimRight
();
}
}
/// This generates the map of Windows scan codes to physical keys.
String
get
windowsScanCodeMap
{
final
StringBuffer
windowsScanCodeMap
=
StringBuffer
();
for
(
final
Key
entry
in
keyData
.
data
)
{
if
(
entry
.
windowsScanCode
!=
null
)
{
windowsScanCodeMap
.
writeln
(
'
${toHex(entry.windowsScanCode)}
: PhysicalKeyboardKey.
${entry.constantName}
,'
);
}
}
return
windowsScanCodeMap
.
toString
().
trimRight
();
}
/// This generates the map of Windows number pad key codes to logical keys.
String
get
windowsNumpadMap
{
final
StringBuffer
windowsNumPadMap
=
StringBuffer
();
for
(
final
Key
entry
in
numpadKeyData
)
{
if
(
entry
.
windowsKeyCodes
!=
null
){
for
(
final
int
code
in
entry
.
windowsKeyCodes
)
{
windowsNumPadMap
.
writeln
(
'
$code
: LogicalKeyboardKey.
${entry.constantName}
,'
);
}
}
}
return
windowsNumPadMap
.
toString
().
trimRight
();
}
/// This generates the map of Windows key codes to logical keys.
String
get
windowsKeyCodeMap
{
final
StringBuffer
windowsKeyCodeMap
=
StringBuffer
();
for
(
final
Key
entry
in
keyData
.
data
)
{
if
(
entry
.
windowsKeyCodes
!=
null
)
{
for
(
final
int
code
in
entry
.
windowsKeyCodes
)
{
windowsKeyCodeMap
.
writeln
(
'
$code
: LogicalKeyboardKey.
${entry.constantName}
,'
);
}
}
}
return
windowsKeyCodeMap
.
toString
().
trimRight
();
}
/// This generates the map of macOS key codes to physical keys.
/// This generates the map of macOS key codes to physical keys.
String
get
macOsScanCodeMap
{
String
get
macOsScanCodeMap
{
final
StringBuffer
macOsScanCodeMap
=
StringBuffer
();
final
StringBuffer
macOsScanCodeMap
=
StringBuffer
();
...
@@ -381,6 +418,9 @@ $otherComments static const LogicalKeyboardKey $constantName = LogicalKeyboardK
...
@@ -381,6 +418,9 @@ $otherComments static const LogicalKeyboardKey $constantName = LogicalKeyboardK
'WEB_LOGICAL_KEY_MAP'
:
webLogicalKeyMap
,
'WEB_LOGICAL_KEY_MAP'
:
webLogicalKeyMap
,
'WEB_PHYSICAL_KEY_MAP'
:
webPhysicalKeyMap
,
'WEB_PHYSICAL_KEY_MAP'
:
webPhysicalKeyMap
,
'WEB_NUMPAD_MAP'
:
webNumpadMap
,
'WEB_NUMPAD_MAP'
:
webNumpadMap
,
'WINDOWS_LOGICAL_KEY_MAP'
:
windowsKeyCodeMap
,
'WINDOWS_PHYSICAL_KEY_MAP'
:
windowsScanCodeMap
,
'WINDOWS_NUMPAD_MAP'
:
windowsNumpadMap
,
};
};
final
String
template
=
File
(
path
.
join
(
flutterRoot
.
path
,
'dev'
,
'tools'
,
'gen_keycodes'
,
'data'
,
'keyboard_maps.tmpl'
)).
readAsStringSync
();
final
String
template
=
File
(
path
.
join
(
flutterRoot
.
path
,
'dev'
,
'tools'
,
'gen_keycodes'
,
'data'
,
'keyboard_maps.tmpl'
)).
readAsStringSync
();
...
...
packages/flutter/lib/services.dart
View file @
a0f7f6ca
...
@@ -29,6 +29,7 @@ export 'src/services/raw_keyboard_fuchsia.dart';
...
@@ -29,6 +29,7 @@ export 'src/services/raw_keyboard_fuchsia.dart';
export
'src/services/raw_keyboard_linux.dart'
;
export
'src/services/raw_keyboard_linux.dart'
;
export
'src/services/raw_keyboard_macos.dart'
;
export
'src/services/raw_keyboard_macos.dart'
;
export
'src/services/raw_keyboard_web.dart'
;
export
'src/services/raw_keyboard_web.dart'
;
export
'src/services/raw_keyboard_windows.dart'
;
export
'src/services/system_channels.dart'
;
export
'src/services/system_channels.dart'
;
export
'src/services/system_chrome.dart'
;
export
'src/services/system_chrome.dart'
;
export
'src/services/system_navigator.dart'
;
export
'src/services/system_navigator.dart'
;
...
...
packages/flutter/lib/src/services/keyboard_maps.dart
View file @
a0f7f6ca
This diff is collapsed.
Click to expand it.
packages/flutter/lib/src/services/raw_keyboard.dart
View file @
a0f7f6ca
...
@@ -14,6 +14,7 @@ import 'raw_keyboard_fuchsia.dart';
...
@@ -14,6 +14,7 @@ import 'raw_keyboard_fuchsia.dart';
import
'raw_keyboard_linux.dart'
;
import
'raw_keyboard_linux.dart'
;
import
'raw_keyboard_macos.dart'
;
import
'raw_keyboard_macos.dart'
;
import
'raw_keyboard_web.dart'
;
import
'raw_keyboard_web.dart'
;
import
'raw_keyboard_windows.dart'
;
import
'system_channels.dart'
;
import
'system_channels.dart'
;
/// An enum describing the side of the keyboard that a key is on, to allow
/// An enum describing the side of the keyboard that a key is on, to allow
...
@@ -296,6 +297,14 @@ abstract class RawKeyEvent with Diagnosticable {
...
@@ -296,6 +297,14 @@ abstract class RawKeyEvent with Diagnosticable {
metaState:
message
[
'metaState'
]
as
int
,
metaState:
message
[
'metaState'
]
as
int
,
);
);
break
;
break
;
case
'windows'
:
data
=
RawKeyEventDataWindows
(
keyCode:
message
[
'keyCode'
]
as
int
,
scanCode:
message
[
'scanCode'
]
as
int
,
characterCodePoint:
message
[
'characterCodePoint'
]
as
int
,
modifiers:
message
[
'modifiers'
]
as
int
,
);
break
;
default
:
default
:
// Raw key events are not yet implemented on iOS or other platforms,
// Raw key events are not yet implemented on iOS or other platforms,
// but this exception isn't hit, because the engine never sends these
// but this exception isn't hit, because the engine never sends these
...
...
packages/flutter/lib/src/services/raw_keyboard_windows.dart
0 → 100644
View file @
a0f7f6ca
This diff is collapsed.
Click to expand it.
packages/flutter/test/services/raw_keyboard_test.dart
View file @
a0f7f6ca
This diff is collapsed.
Click to expand it.
packages/flutter_test/lib/src/event_simulation.dart
View file @
a0f7f6ca
...
@@ -40,6 +40,7 @@ class KeyEventSimulator {
...
@@ -40,6 +40,7 @@ class KeyEventSimulator {
case
'macos'
:
case
'macos'
:
case
'linux'
:
case
'linux'
:
case
'web'
:
case
'web'
:
case
'windows'
:
return
true
;
return
true
;
}
}
return
false
;
return
false
;
...
@@ -62,6 +63,9 @@ class KeyEventSimulator {
...
@@ -62,6 +63,9 @@ class KeyEventSimulator {
case
'linux'
:
case
'linux'
:
map
=
kLinuxToPhysicalKey
;
map
=
kLinuxToPhysicalKey
;
break
;
break
;
case
'windows'
:
map
=
kWindowsToPhysicalKey
;
break
;
case
'web'
:
case
'web'
:
// web doesn't have int type code
// web doesn't have int type code
return
null
;
return
null
;
...
@@ -95,6 +99,9 @@ class KeyEventSimulator {
...
@@ -95,6 +99,9 @@ class KeyEventSimulator {
case
'linux'
:
case
'linux'
:
map
=
kGlfwToLogicalKey
;
map
=
kGlfwToLogicalKey
;
break
;
break
;
case
'windows'
:
map
=
kWindowsToLogicalKey
;
break
;
}
}
for
(
final
int
code
in
map
.
keys
)
{
for
(
final
int
code
in
map
.
keys
)
{
if
(
key
.
keyId
==
map
[
code
].
keyId
)
{
if
(
key
.
keyId
==
map
[
code
].
keyId
)
{
...
@@ -132,6 +139,9 @@ class KeyEventSimulator {
...
@@ -132,6 +139,9 @@ class KeyEventSimulator {
case
'web'
:
case
'web'
:
map
=
kWebToPhysicalKey
;
map
=
kWebToPhysicalKey
;
break
;
break
;
case
'windows'
:
map
=
kWindowsToPhysicalKey
;
break
;
}
}
for
(
final
PhysicalKeyboardKey
physicalKey
in
map
.
values
)
{
for
(
final
PhysicalKeyboardKey
physicalKey
in
map
.
values
)
{
if
(
key
.
debugName
==
physicalKey
.
debugName
)
{
if
(
key
.
debugName
==
physicalKey
.
debugName
)
{
...
@@ -195,6 +205,12 @@ class KeyEventSimulator {
...
@@ -195,6 +205,12 @@ class KeyEventSimulator {
result
[
'code'
]
=
_getWebKeyCode
(
key
);
result
[
'code'
]
=
_getWebKeyCode
(
key
);
result
[
'key'
]
=
''
;
result
[
'key'
]
=
''
;
result
[
'metaState'
]
=
_getWebModifierFlags
(
key
,
isDown
);
result
[
'metaState'
]
=
_getWebModifierFlags
(
key
,
isDown
);
break
;
case
'windows'
:
result
[
'keyCode'
]
=
keyCode
;
result
[
'scanCode'
]
=
scanCode
;
result
[
'characterCodePoint'
]
=
key
.
keyLabel
?.
codeUnitAt
(
0
)
??
0
;
result
[
'modifiers'
]
=
_getWindowsModifierFlags
(
key
,
isDown
);
}
}
return
result
;
return
result
;
}
}
...
@@ -272,6 +288,59 @@ class KeyEventSimulator {
...
@@ -272,6 +288,59 @@ class KeyEventSimulator {
return
result
;
return
result
;
}
}
static
int
_getWindowsModifierFlags
(
LogicalKeyboardKey
newKey
,
bool
isDown
)
{
int
result
=
0
;
final
Set
<
LogicalKeyboardKey
>
pressed
=
RawKeyboard
.
instance
.
keysPressed
;
if
(
isDown
)
{
pressed
.
add
(
newKey
);
}
else
{
pressed
.
remove
(
newKey
);
}
if
(
pressed
.
contains
(
LogicalKeyboardKey
.
shift
))
{
result
|=
RawKeyEventDataWindows
.
modifierShift
;
}
if
(
pressed
.
contains
(
LogicalKeyboardKey
.
shiftLeft
))
{
result
|=
RawKeyEventDataWindows
.
modifierLeftShift
;
}
if
(
pressed
.
contains
(
LogicalKeyboardKey
.
shiftRight
))
{
result
|=
RawKeyEventDataWindows
.
modifierRightShift
;
}
if
(
pressed
.
contains
(
LogicalKeyboardKey
.
metaLeft
))
{
result
|=
RawKeyEventDataWindows
.
modifierLeftMeta
;
}
if
(
pressed
.
contains
(
LogicalKeyboardKey
.
metaRight
))
{
result
|=
RawKeyEventDataWindows
.
modifierRightMeta
;
}
if
(
pressed
.
contains
(
LogicalKeyboardKey
.
control
))
{
result
|=
RawKeyEventDataWindows
.
modifierControl
;
}
if
(
pressed
.
contains
(
LogicalKeyboardKey
.
controlLeft
))
{
result
|=
RawKeyEventDataWindows
.
modifierLeftControl
;
}
if
(
pressed
.
contains
(
LogicalKeyboardKey
.
controlRight
))
{
result
|=
RawKeyEventDataWindows
.
modifierRightControl
;
}
if
(
pressed
.
contains
(
LogicalKeyboardKey
.
alt
))
{
result
|=
RawKeyEventDataWindows
.
modifierAlt
;
}
if
(
pressed
.
contains
(
LogicalKeyboardKey
.
altLeft
))
{
result
|=
RawKeyEventDataWindows
.
modifierLeftAlt
;
}
if
(
pressed
.
contains
(
LogicalKeyboardKey
.
altRight
))
{
result
|=
RawKeyEventDataWindows
.
modifierRightAlt
;
}
if
(
pressed
.
contains
(
LogicalKeyboardKey
.
capsLock
))
{
result
|=
RawKeyEventDataWindows
.
modifierCaps
;
}
if
(
pressed
.
contains
(
LogicalKeyboardKey
.
numLock
))
{
result
|=
RawKeyEventDataWindows
.
modifierNumLock
;
}
if
(
pressed
.
contains
(
LogicalKeyboardKey
.
scrollLock
))
{
result
|=
RawKeyEventDataWindows
.
modifierScrollLock
;
}
return
result
;
}
static
int
_getFuchsiaModifierFlags
(
LogicalKeyboardKey
newKey
,
bool
isDown
)
{
static
int
_getFuchsiaModifierFlags
(
LogicalKeyboardKey
newKey
,
bool
isDown
)
{
int
result
=
0
;
int
result
=
0
;
final
Set
<
LogicalKeyboardKey
>
pressed
=
RawKeyboard
.
instance
.
keysPressed
;
final
Set
<
LogicalKeyboardKey
>
pressed
=
RawKeyboard
.
instance
.
keysPressed
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment