react-native-windows 0.75.0 → 0.75.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Microsoft.ReactNative/ComponentView.idl +33 -32
- package/Microsoft.ReactNative/Composition.Input.idl +2 -0
- package/Microsoft.ReactNative/CompositionComponentView.idl +43 -24
- package/Microsoft.ReactNative/Fabric/AbiEventEmitter.cpp +21 -0
- package/Microsoft.ReactNative/Fabric/AbiEventEmitter.h +23 -0
- package/Microsoft.ReactNative/Fabric/AbiShadowNode.cpp +7 -0
- package/Microsoft.ReactNative/Fabric/AbiShadowNode.h +3 -0
- package/Microsoft.ReactNative/Fabric/ComponentView.cpp +318 -59
- package/Microsoft.ReactNative/Fabric/ComponentView.h +155 -33
- package/Microsoft.ReactNative/Fabric/Composition/ActivityIndicatorComponentView.cpp +2 -2
- package/Microsoft.ReactNative/Fabric/Composition/ComponentViewRegistry.cpp +3 -0
- package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.cpp +25 -7
- package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.h +22 -4
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +43 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +6 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +147 -119
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +4 -8
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +97 -101
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +28 -52
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +133 -0
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +61 -0
- package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.cpp +1 -2
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp +1 -4
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +1 -2
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +1 -6
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.h +0 -1
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.cpp +108 -18
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +33 -5
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +57 -1
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +6 -0
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +8 -2
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +2 -0
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +195 -182
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.h +1 -3
- package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.cpp +16 -4
- package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.h +3 -3
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +12 -17
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +4 -11
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +19 -0
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +4 -0
- package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.cpp +1 -2
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +10 -7
- package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.cpp +1 -3
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.cpp +20 -1
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.h +3 -0
- package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +13 -3
- package/Microsoft.ReactNative/IReactViewComponentBuilder.idl +57 -4
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +2 -0
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +74 -67
- package/Microsoft.ReactNative/ReactNativeIsland.idl +3 -0
- package/PropertySheets/External/Microsoft.ReactNative.Composition.Package.props +1 -0
- package/PropertySheets/External/Microsoft.ReactNative.Composition.Package.targets +4 -0
- package/PropertySheets/External/Microsoft.ReactNative.Cpp.PackageReferences.props +14 -4
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/PropertySheets/WinUI.props +1 -1
- package/Scripts/Microsoft.ReactNative.VersionCheck.targets +2 -0
- package/Shared/DevSettings.h +3 -0
- package/Shared/OInstance.cpp +6 -2
- package/Shared/Shared.vcxitems +7 -0
- package/just-task.js +1 -1
- package/package.json +13 -13
- package/template/cpp-app/proj/MyApp.sln +19 -19
- package/template/cpp-lib/proj/MyLib.sln +19 -19
- package/template/cs-app/proj/MyApp.sln +21 -21
- package/template/cs-lib/proj/MyLib.sln +21 -21
- package/templates/cpp-app/NuGet_Config +13 -0
- package/templates/cpp-app/template.config.js +6 -1
- package/templates/cpp-app/windows/ExperimentalFeatures.props +1 -0
- package/templates/cpp-app/windows/MyApp.sln +29 -19
- package/templates/cpp-lib/NuGet_Config +13 -0
- package/templates/cpp-lib/example/NuGet_Config +6 -0
- package/templates/cpp-lib/template.config.js +6 -1
- package/templates/cpp-lib/windows/ExperimentalFeatures.props +1 -0
- package/templates/cpp-lib/windows/MyLib.sln +35 -25
- package/templates/old/generateWrapper.js +3 -3
- package/templates/templateUtils.js +3 -1
|
@@ -140,149 +140,170 @@ struct CompositionInputKeyboardSource : winrt::implements<
|
|
|
140
140
|
CompositionEventHandler::CompositionEventHandler(
|
|
141
141
|
const winrt::Microsoft::ReactNative::ReactContext &context,
|
|
142
142
|
const winrt::Microsoft::ReactNative::ReactNativeIsland &reactNativeIsland)
|
|
143
|
-
: m_context(context), m_wkRootView(reactNativeIsland) {
|
|
143
|
+
: m_context(context), m_wkRootView(reactNativeIsland) {}
|
|
144
|
+
|
|
145
|
+
void CompositionEventHandler::Initialize() noexcept {
|
|
144
146
|
#ifdef USE_WINUI3
|
|
145
|
-
if (auto island =
|
|
147
|
+
if (auto island = m_wkRootView.get().Island()) {
|
|
146
148
|
auto pointerSource = winrt::Microsoft::UI::Input::InputPointerSource::GetForIsland(island);
|
|
147
149
|
|
|
148
150
|
m_pointerPressedToken =
|
|
149
|
-
pointerSource.PointerPressed([
|
|
151
|
+
pointerSource.PointerPressed([wkThis = weak_from_this()](
|
|
150
152
|
winrt::Microsoft::UI::Input::InputPointerSource const &,
|
|
151
153
|
winrt::Microsoft::UI::Input::PointerEventArgs const &args) {
|
|
152
|
-
if (auto
|
|
153
|
-
if (
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
154
|
+
if (auto strongThis = wkThis.lock()) {
|
|
155
|
+
if (auto strongRootView = strongThis->m_wkRootView.get()) {
|
|
156
|
+
if (strongThis->SurfaceId() == -1)
|
|
157
|
+
return;
|
|
158
|
+
|
|
159
|
+
auto pp = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::PointerPoint>(
|
|
160
|
+
args.CurrentPoint(), strongRootView.ScaleFactor());
|
|
161
|
+
strongThis->onPointerPressed(pp, args.KeyModifiers());
|
|
162
|
+
}
|
|
159
163
|
}
|
|
160
164
|
});
|
|
161
165
|
|
|
162
166
|
m_pointerReleasedToken =
|
|
163
|
-
pointerSource.PointerReleased([
|
|
167
|
+
pointerSource.PointerReleased([wkThis = weak_from_this()](
|
|
164
168
|
winrt::Microsoft::UI::Input::InputPointerSource const &,
|
|
165
169
|
winrt::Microsoft::UI::Input::PointerEventArgs const &args) {
|
|
166
|
-
if (auto
|
|
167
|
-
if (
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
170
|
+
if (auto strongThis = wkThis.lock()) {
|
|
171
|
+
if (auto strongRootView = strongThis->m_wkRootView.get()) {
|
|
172
|
+
if (strongThis->SurfaceId() == -1)
|
|
173
|
+
return;
|
|
174
|
+
|
|
175
|
+
auto pp = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::PointerPoint>(
|
|
176
|
+
args.CurrentPoint(), strongRootView.ScaleFactor());
|
|
177
|
+
strongThis->onPointerReleased(pp, args.KeyModifiers());
|
|
178
|
+
}
|
|
173
179
|
}
|
|
174
180
|
});
|
|
175
181
|
|
|
176
|
-
m_pointerMovedToken = pointerSource.PointerMoved([
|
|
182
|
+
m_pointerMovedToken = pointerSource.PointerMoved([wkThis = weak_from_this()](
|
|
177
183
|
winrt::Microsoft::UI::Input::InputPointerSource const &,
|
|
178
184
|
winrt::Microsoft::UI::Input::PointerEventArgs const &args) {
|
|
179
|
-
if (auto
|
|
180
|
-
if (
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
185
|
+
if (auto strongThis = wkThis.lock()) {
|
|
186
|
+
if (auto strongRootView = strongThis->m_wkRootView.get()) {
|
|
187
|
+
if (strongThis->SurfaceId() == -1)
|
|
188
|
+
return;
|
|
189
|
+
|
|
190
|
+
auto pp = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::PointerPoint>(
|
|
191
|
+
args.CurrentPoint(), strongRootView.ScaleFactor());
|
|
192
|
+
strongThis->onPointerMoved(pp, args.KeyModifiers());
|
|
193
|
+
}
|
|
186
194
|
}
|
|
187
195
|
});
|
|
188
196
|
|
|
189
197
|
m_pointerCaptureLostToken =
|
|
190
|
-
pointerSource.PointerCaptureLost([
|
|
198
|
+
pointerSource.PointerCaptureLost([wkThis = weak_from_this()](
|
|
191
199
|
winrt::Microsoft::UI::Input::InputPointerSource const &,
|
|
192
200
|
winrt::Microsoft::UI::Input::PointerEventArgs const &args) {
|
|
193
|
-
if (auto
|
|
194
|
-
if (
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
201
|
+
if (auto strongThis = wkThis.lock()) {
|
|
202
|
+
if (auto strongRootView = strongThis->m_wkRootView.get()) {
|
|
203
|
+
if (strongThis->SurfaceId() == -1)
|
|
204
|
+
return;
|
|
205
|
+
|
|
206
|
+
auto pp = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::PointerPoint>(
|
|
207
|
+
args.CurrentPoint(), strongRootView.ScaleFactor());
|
|
208
|
+
strongThis->onPointerCaptureLost(pp, args.KeyModifiers());
|
|
209
|
+
}
|
|
200
210
|
}
|
|
201
211
|
});
|
|
202
212
|
|
|
203
213
|
m_pointerWheelChangedToken =
|
|
204
|
-
pointerSource.PointerWheelChanged([
|
|
214
|
+
pointerSource.PointerWheelChanged([wkThis = weak_from_this()](
|
|
205
215
|
winrt::Microsoft::UI::Input::InputPointerSource const &,
|
|
206
216
|
winrt::Microsoft::UI::Input::PointerEventArgs const &args) {
|
|
207
|
-
if (auto
|
|
208
|
-
if (
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
217
|
+
if (auto strongThis = wkThis.lock()) {
|
|
218
|
+
if (auto strongRootView = strongThis->m_wkRootView.get()) {
|
|
219
|
+
if (strongThis->SurfaceId() == -1)
|
|
220
|
+
return;
|
|
221
|
+
|
|
222
|
+
auto pp = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::PointerPoint>(
|
|
223
|
+
args.CurrentPoint(), strongRootView.ScaleFactor());
|
|
224
|
+
strongThis->onPointerWheelChanged(pp, args.KeyModifiers());
|
|
225
|
+
}
|
|
214
226
|
}
|
|
215
227
|
});
|
|
216
228
|
|
|
217
229
|
auto keyboardSource = winrt::Microsoft::UI::Input::InputKeyboardSource::GetForIsland(island);
|
|
218
230
|
|
|
219
|
-
m_keyDownToken = keyboardSource.KeyDown([
|
|
231
|
+
m_keyDownToken = keyboardSource.KeyDown([wkThis = weak_from_this()](
|
|
220
232
|
winrt::Microsoft::UI::Input::InputKeyboardSource const &source,
|
|
221
233
|
winrt::Microsoft::UI::Input::KeyEventArgs const &args) {
|
|
222
|
-
if (auto
|
|
223
|
-
if (
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
234
|
+
if (auto strongThis = wkThis.lock()) {
|
|
235
|
+
if (auto strongRootView = strongThis->m_wkRootView.get()) {
|
|
236
|
+
if (strongThis->SurfaceId() == -1)
|
|
237
|
+
return;
|
|
238
|
+
|
|
239
|
+
auto focusedComponent = strongThis->RootComponentView().GetFocusedComponent();
|
|
240
|
+
auto keyboardSource = winrt::make<CompositionInputKeyboardSource>(source);
|
|
241
|
+
auto keyArgs =
|
|
242
|
+
winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::KeyRoutedEventArgs>(
|
|
243
|
+
focusedComponent
|
|
244
|
+
? focusedComponent.Tag()
|
|
245
|
+
: static_cast<facebook::react::Tag>(
|
|
246
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ReactNativeIsland>(
|
|
247
|
+
strongRootView)
|
|
248
|
+
->RootTag()),
|
|
249
|
+
args,
|
|
250
|
+
keyboardSource);
|
|
251
|
+
strongThis->onKeyDown(keyArgs);
|
|
252
|
+
winrt::get_self<CompositionInputKeyboardSource>(keyboardSource)->Disconnect();
|
|
253
|
+
}
|
|
239
254
|
}
|
|
240
255
|
});
|
|
241
256
|
|
|
242
|
-
m_keyUpToken = keyboardSource.KeyUp([
|
|
257
|
+
m_keyUpToken = keyboardSource.KeyUp([wkThis = weak_from_this()](
|
|
243
258
|
winrt::Microsoft::UI::Input::InputKeyboardSource const &source,
|
|
244
259
|
winrt::Microsoft::UI::Input::KeyEventArgs const &args) {
|
|
245
|
-
if (auto
|
|
246
|
-
if (
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
260
|
+
if (auto strongThis = wkThis.lock()) {
|
|
261
|
+
if (auto strongRootView = strongThis->m_wkRootView.get()) {
|
|
262
|
+
if (strongThis->SurfaceId() == -1)
|
|
263
|
+
return;
|
|
264
|
+
|
|
265
|
+
auto focusedComponent = strongThis->RootComponentView().GetFocusedComponent();
|
|
266
|
+
auto keyboardSource = winrt::make<CompositionInputKeyboardSource>(source);
|
|
267
|
+
auto keyArgs =
|
|
268
|
+
winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::KeyRoutedEventArgs>(
|
|
269
|
+
focusedComponent
|
|
270
|
+
? focusedComponent.Tag()
|
|
271
|
+
: static_cast<facebook::react::Tag>(
|
|
272
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ReactNativeIsland>(
|
|
273
|
+
strongRootView)
|
|
274
|
+
->RootTag()),
|
|
275
|
+
args,
|
|
276
|
+
keyboardSource);
|
|
277
|
+
strongThis->onKeyUp(keyArgs);
|
|
278
|
+
winrt::get_self<CompositionInputKeyboardSource>(keyboardSource)->Disconnect();
|
|
279
|
+
}
|
|
262
280
|
}
|
|
263
281
|
});
|
|
264
282
|
|
|
265
283
|
m_characterReceivedToken =
|
|
266
|
-
keyboardSource.CharacterReceived([
|
|
284
|
+
keyboardSource.CharacterReceived([wkThis = weak_from_this()](
|
|
267
285
|
winrt::Microsoft::UI::Input::InputKeyboardSource const &source,
|
|
268
286
|
winrt::Microsoft::UI::Input::CharacterReceivedEventArgs const &args) {
|
|
269
|
-
if (auto
|
|
270
|
-
if (
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
287
|
+
if (auto strongThis = wkThis.lock()) {
|
|
288
|
+
if (auto strongRootView = strongThis->m_wkRootView.get()) {
|
|
289
|
+
if (strongThis->SurfaceId() == -1)
|
|
290
|
+
return;
|
|
291
|
+
|
|
292
|
+
auto focusedComponent = strongThis->RootComponentView().GetFocusedComponent();
|
|
293
|
+
auto keyboardSource = winrt::make<CompositionInputKeyboardSource>(source);
|
|
294
|
+
auto charArgs = winrt::make<
|
|
295
|
+
winrt::Microsoft::ReactNative::Composition::Input::implementation::CharacterReceivedRoutedEventArgs>(
|
|
296
|
+
focusedComponent
|
|
297
|
+
? focusedComponent.Tag()
|
|
298
|
+
: static_cast<facebook::react::Tag>(
|
|
299
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ReactNativeIsland>(
|
|
300
|
+
strongRootView)
|
|
301
|
+
->RootTag()),
|
|
302
|
+
args,
|
|
303
|
+
keyboardSource);
|
|
304
|
+
strongThis->onCharacterReceived(charArgs);
|
|
305
|
+
winrt::get_self<CompositionInputKeyboardSource>(keyboardSource)->Disconnect();
|
|
306
|
+
}
|
|
286
307
|
}
|
|
287
308
|
});
|
|
288
309
|
}
|
|
@@ -344,7 +365,8 @@ void CompositionEventHandler::onPointerWheelChanged(
|
|
|
344
365
|
auto args = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::PointerRoutedEventArgs>(
|
|
345
366
|
m_context, tag, pointerPoint, keyModifiers);
|
|
346
367
|
|
|
347
|
-
targetComponentView
|
|
368
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(targetComponentView)
|
|
369
|
+
->OnPointerWheelChanged(args);
|
|
348
370
|
}
|
|
349
371
|
}
|
|
350
372
|
|
|
@@ -441,6 +463,7 @@ int64_t CompositionEventHandler::SendMessage(HWND hwnd, uint32_t msg, uint64_t w
|
|
|
441
463
|
case WM_SYSCHAR: {
|
|
442
464
|
if (auto strongRootView = m_wkRootView.get()) {
|
|
443
465
|
auto focusedComponent = RootComponentView().GetFocusedComponent();
|
|
466
|
+
auto keyboardSource = winrt::make<CompositionKeyboardSource>(this);
|
|
444
467
|
auto args = winrt::make<
|
|
445
468
|
winrt::Microsoft::ReactNative::Composition::Input::implementation::CharacterReceivedRoutedEventArgs>(
|
|
446
469
|
focusedComponent
|
|
@@ -450,9 +473,9 @@ int64_t CompositionEventHandler::SendMessage(HWND hwnd, uint32_t msg, uint64_t w
|
|
|
450
473
|
->RootTag()),
|
|
451
474
|
msg,
|
|
452
475
|
wParam,
|
|
453
|
-
lParam
|
|
454
|
-
|
|
455
|
-
onCharacterReceived(
|
|
476
|
+
lParam,
|
|
477
|
+
keyboardSource);
|
|
478
|
+
onCharacterReceived(args);
|
|
456
479
|
winrt::get_self<CompositionKeyboardSource>(keyboardSource)->Disconnect();
|
|
457
480
|
}
|
|
458
481
|
break;
|
|
@@ -463,6 +486,7 @@ int64_t CompositionEventHandler::SendMessage(HWND hwnd, uint32_t msg, uint64_t w
|
|
|
463
486
|
case WM_SYSKEYUP: {
|
|
464
487
|
if (auto strongRootView = m_wkRootView.get()) {
|
|
465
488
|
auto focusedComponent = RootComponentView().GetFocusedComponent();
|
|
489
|
+
auto keyboardSource = winrt::make<CompositionKeyboardSource>(this);
|
|
466
490
|
auto args = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::KeyRoutedEventArgs>(
|
|
467
491
|
focusedComponent
|
|
468
492
|
? focusedComponent.Tag()
|
|
@@ -471,12 +495,12 @@ int64_t CompositionEventHandler::SendMessage(HWND hwnd, uint32_t msg, uint64_t w
|
|
|
471
495
|
->RootTag()),
|
|
472
496
|
msg,
|
|
473
497
|
wParam,
|
|
474
|
-
lParam
|
|
475
|
-
|
|
498
|
+
lParam,
|
|
499
|
+
keyboardSource);
|
|
476
500
|
if (msg == WM_KEYDOWN || msg == WM_SYSKEYDOWN) {
|
|
477
|
-
onKeyDown(
|
|
501
|
+
onKeyDown(args);
|
|
478
502
|
} else {
|
|
479
|
-
onKeyUp(
|
|
503
|
+
onKeyUp(args);
|
|
480
504
|
}
|
|
481
505
|
winrt::get_self<CompositionKeyboardSource>(keyboardSource)->Disconnect();
|
|
482
506
|
}
|
|
@@ -488,20 +512,19 @@ int64_t CompositionEventHandler::SendMessage(HWND hwnd, uint32_t msg, uint64_t w
|
|
|
488
512
|
}
|
|
489
513
|
|
|
490
514
|
void CompositionEventHandler::onKeyDown(
|
|
491
|
-
const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source,
|
|
492
515
|
const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept {
|
|
493
516
|
if (auto focusedComponent = RootComponentView().GetFocusedComponent()) {
|
|
494
|
-
focusedComponent
|
|
517
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(focusedComponent)->OnKeyDown(args);
|
|
495
518
|
|
|
496
519
|
if (args.Handled())
|
|
497
520
|
return;
|
|
498
521
|
}
|
|
499
522
|
|
|
500
523
|
bool fShift =
|
|
501
|
-
(
|
|
524
|
+
(args.KeyboardSource().GetKeyState(winrt::Windows::System::VirtualKey::Shift) &
|
|
502
525
|
winrt::Microsoft::UI::Input::VirtualKeyStates::Down) == winrt::Microsoft::UI::Input::VirtualKeyStates::Down;
|
|
503
526
|
bool fCtrl =
|
|
504
|
-
(
|
|
527
|
+
(args.KeyboardSource().GetKeyState(winrt::Windows::System::VirtualKey::Control) &
|
|
505
528
|
winrt::Microsoft::UI::Input::VirtualKeyStates::Down) == winrt::Microsoft::UI::Input::VirtualKeyStates::Down;
|
|
506
529
|
|
|
507
530
|
if (fShift && fCtrl && args.Key() == static_cast<winrt::Windows::System::VirtualKey>(VkKeyScanA('d')) &&
|
|
@@ -522,10 +545,9 @@ void CompositionEventHandler::onKeyDown(
|
|
|
522
545
|
}
|
|
523
546
|
|
|
524
547
|
void CompositionEventHandler::onKeyUp(
|
|
525
|
-
const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source,
|
|
526
548
|
const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept {
|
|
527
549
|
if (auto focusedComponent = RootComponentView().GetFocusedComponent()) {
|
|
528
|
-
focusedComponent
|
|
550
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(focusedComponent)->OnKeyUp(args);
|
|
529
551
|
|
|
530
552
|
if (args.Handled())
|
|
531
553
|
return;
|
|
@@ -533,10 +555,10 @@ void CompositionEventHandler::onKeyUp(
|
|
|
533
555
|
}
|
|
534
556
|
|
|
535
557
|
void CompositionEventHandler::onCharacterReceived(
|
|
536
|
-
const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source,
|
|
537
558
|
const winrt::Microsoft::ReactNative::Composition::Input::CharacterReceivedRoutedEventArgs &args) noexcept {
|
|
538
559
|
if (auto focusedComponent = RootComponentView().GetFocusedComponent()) {
|
|
539
|
-
focusedComponent
|
|
560
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(focusedComponent)
|
|
561
|
+
->OnCharacterReceived(args);
|
|
540
562
|
|
|
541
563
|
if (args.Handled())
|
|
542
564
|
return;
|
|
@@ -624,7 +646,8 @@ void CompositionEventHandler::HandleIncomingPointerEvent(
|
|
|
624
646
|
auto args =
|
|
625
647
|
winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::PointerRoutedEventArgs>(
|
|
626
648
|
m_context, componentView.Tag(), pointerPoint, keyModifiers);
|
|
627
|
-
componentView
|
|
649
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(componentView)
|
|
650
|
+
->OnPointerEntered(args);
|
|
628
651
|
|
|
629
652
|
if (shouldEmitEvent) {
|
|
630
653
|
const auto eventEmitter =
|
|
@@ -702,7 +725,7 @@ void CompositionEventHandler::HandleIncomingPointerEvent(
|
|
|
702
725
|
|
|
703
726
|
auto args = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::PointerRoutedEventArgs>(
|
|
704
727
|
m_context, componentView.Tag(), pointerPoint, keyModifiers);
|
|
705
|
-
componentView
|
|
728
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(componentView)->OnPointerExited(args);
|
|
706
729
|
}
|
|
707
730
|
|
|
708
731
|
for (auto itComponentView = viewsToEmitJSLeaveEventsTo.rbegin(); itComponentView != viewsToEmitJSLeaveEventsTo.rend();
|
|
@@ -853,7 +876,8 @@ void CompositionEventHandler::onPointerMoved(
|
|
|
853
876
|
m_context, tag, pointerPoint, keyModifiers);
|
|
854
877
|
auto targetComponentView = fabricuiManager->GetViewRegistry().componentViewDescriptorWithTag(tag).view;
|
|
855
878
|
|
|
856
|
-
targetComponentView
|
|
879
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(targetComponentView)
|
|
880
|
+
->OnPointerMoved(args);
|
|
857
881
|
|
|
858
882
|
auto targetView = FindClosestFabricManagedTouchableView(
|
|
859
883
|
fabricuiManager->GetViewRegistry().componentViewDescriptorWithTag(tag).view);
|
|
@@ -907,7 +931,8 @@ void CompositionEventHandler::onPointerPressed(
|
|
|
907
931
|
auto targetComponentView = fabricuiManager->GetViewRegistry().componentViewDescriptorWithTag(tag).view;
|
|
908
932
|
auto args = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::PointerRoutedEventArgs>(
|
|
909
933
|
m_context, tag, pointerPoint, keyModifiers);
|
|
910
|
-
targetComponentView
|
|
934
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(targetComponentView)
|
|
935
|
+
->OnPointerPressed(args);
|
|
911
936
|
|
|
912
937
|
ActiveTouch activeTouch{0};
|
|
913
938
|
activeTouch.touchType = UITouchType::Mouse;
|
|
@@ -968,7 +993,8 @@ void CompositionEventHandler::onPointerReleased(
|
|
|
968
993
|
auto args = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::PointerRoutedEventArgs>(
|
|
969
994
|
m_context, tag, pointerPoint, keyModifiers);
|
|
970
995
|
|
|
971
|
-
targetComponentView
|
|
996
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(targetComponentView)
|
|
997
|
+
->OnPointerReleased(args);
|
|
972
998
|
|
|
973
999
|
UpdateActiveTouch(activeTouch->second, ptScaled, ptLocal);
|
|
974
1000
|
DispatchTouchEvent(TouchEventType::End, pointerId, pointerPoint, keyModifiers);
|
|
@@ -987,7 +1013,8 @@ bool CompositionEventHandler::CapturePointer(
|
|
|
987
1013
|
auto targetComponentView =
|
|
988
1014
|
fabricuiManager->GetViewRegistry().componentViewDescriptorWithTag(m_pointerCapturingComponentTag).view;
|
|
989
1015
|
|
|
990
|
-
targetComponentView
|
|
1016
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(targetComponentView)
|
|
1017
|
+
->OnPointerCaptureLost();
|
|
991
1018
|
}
|
|
992
1019
|
}
|
|
993
1020
|
|
|
@@ -1018,7 +1045,8 @@ bool CompositionEventHandler::releasePointerCapture(PointerId pointerId, faceboo
|
|
|
1018
1045
|
auto targetComponentView =
|
|
1019
1046
|
fabricuiManager->GetViewRegistry().componentViewDescriptorWithTag(m_pointerCapturingComponentTag).view;
|
|
1020
1047
|
|
|
1021
|
-
targetComponentView
|
|
1048
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(targetComponentView)
|
|
1049
|
+
->OnPointerCaptureLost();
|
|
1022
1050
|
}
|
|
1023
1051
|
|
|
1024
1052
|
if (m_capturedPointers.size() == 0) {
|
|
@@ -27,13 +27,14 @@ struct FabricUIManager;
|
|
|
27
27
|
struct winrt::Microsoft::ReactNative::implementation::ComponentView;
|
|
28
28
|
typedef int PointerId;
|
|
29
29
|
|
|
30
|
-
class CompositionEventHandler {
|
|
30
|
+
class CompositionEventHandler : public std::enable_shared_from_this<CompositionEventHandler> {
|
|
31
31
|
public:
|
|
32
32
|
CompositionEventHandler(
|
|
33
33
|
const winrt::Microsoft::ReactNative::ReactContext &context,
|
|
34
34
|
const winrt::Microsoft::ReactNative::ReactNativeIsland &ReactNativeIsland);
|
|
35
35
|
virtual ~CompositionEventHandler();
|
|
36
36
|
|
|
37
|
+
void Initialize() noexcept;
|
|
37
38
|
int64_t SendMessage(HWND hwnd, uint32_t msg, uint64_t wParam, int64_t lParam) noexcept;
|
|
38
39
|
void RemoveTouchHandlers();
|
|
39
40
|
winrt::Microsoft::UI::Input::VirtualKeyStates GetKeyState(winrt::Windows::System::VirtualKey key) noexcept;
|
|
@@ -62,14 +63,9 @@ class CompositionEventHandler {
|
|
|
62
63
|
void onPointerCaptureLost(
|
|
63
64
|
const winrt::Microsoft::ReactNative::Composition::Input::PointerPoint &pointerPoint,
|
|
64
65
|
winrt::Windows::System::VirtualKeyModifiers keyModifiers) noexcept;
|
|
65
|
-
void onKeyDown(
|
|
66
|
-
|
|
67
|
-
const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept;
|
|
68
|
-
void onKeyUp(
|
|
69
|
-
const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source,
|
|
70
|
-
const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept;
|
|
66
|
+
void onKeyDown(const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept;
|
|
67
|
+
void onKeyUp(const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept;
|
|
71
68
|
void onCharacterReceived(
|
|
72
|
-
const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source,
|
|
73
69
|
const winrt::Microsoft::ReactNative::Composition::Input::CharacterReceivedRoutedEventArgs &args) noexcept;
|
|
74
70
|
|
|
75
71
|
void getTargetPointerArgs(
|