react-native-windows 0.74.0-preview.4 → 0.74.1
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/CompositionRootView.idl +4 -2
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +8 -2
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +188 -141
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootView.cpp +53 -35
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootView.h +6 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootView_emptyimpl.cpp +7 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +79 -77
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp +7 -14
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +2 -5
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +2 -1
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +5 -1
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +2 -8
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +20 -15
- package/Microsoft.ReactNative/Fabric/Composition/Theme.cpp +28 -10
- package/Microsoft.ReactNative/Fabric/Composition/Theme.h +4 -3
- package/Microsoft.ReactNative/Fabric/Composition/Theme_emptyimpl.cpp +2 -6
- package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.cpp +2 -5
- package/Microsoft.ReactNative/Theme.idl +1 -2
- package/Microsoft.ReactNative/Utils/KeyboardUtils.cpp +10 -2
- package/Microsoft.ReactNative/Utils/KeyboardUtils.h +4 -1
- package/Microsoft.ReactNative.Cxx/AutoDraw.h +4 -1
- package/Microsoft.ReactNative.Cxx/CompositionSwitcher.Experimental.interop.h +1 -1
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/Scripts/OfficeReact.Win32.nuspec +2 -0
- package/package.json +18 -15
|
@@ -95,8 +95,10 @@ namespace Microsoft.ReactNative
|
|
|
95
95
|
|
|
96
96
|
Object GetUiaProvider();
|
|
97
97
|
|
|
98
|
-
DOC_STRING("
|
|
99
|
-
Microsoft.ReactNative.Composition.
|
|
98
|
+
DOC_STRING("Provides resources used for Platform colors within this RootView")
|
|
99
|
+
Microsoft.ReactNative.Composition.ICustomResourceLoader Resources;
|
|
100
|
+
|
|
101
|
+
Microsoft.ReactNative.Composition.Theme Theme { get; };
|
|
100
102
|
|
|
101
103
|
#ifdef USE_WINUI3
|
|
102
104
|
Microsoft.UI.Content.ContentIsland Island { get; };
|
|
@@ -256,13 +256,19 @@ struct CompDrawingSurfaceBrush : public winrt::implements<
|
|
|
256
256
|
drawingSurface.as(m_drawingSurfaceInterop);
|
|
257
257
|
}
|
|
258
258
|
|
|
259
|
-
HRESULT BeginDraw(ID2D1DeviceContext **deviceContextOut, POINT *offset) noexcept {
|
|
259
|
+
HRESULT BeginDraw(ID2D1DeviceContext **deviceContextOut, float xDpi, float yDpi, POINT *offset) noexcept {
|
|
260
260
|
#ifdef DEBUG
|
|
261
261
|
// Drawing to a zero sized surface is a waste of time
|
|
262
262
|
auto size = m_drawingSurfaceInterop.as<typename TTypeRedirects::CompositionDrawingSurface>().Size();
|
|
263
263
|
assert(size.Width != 0 && size.Height != 0);
|
|
264
264
|
#endif
|
|
265
|
-
|
|
265
|
+
|
|
266
|
+
auto hr =
|
|
267
|
+
m_drawingSurfaceInterop->BeginDraw(nullptr, __uuidof(ID2D1DeviceContext), (void **)deviceContextOut, offset);
|
|
268
|
+
if (SUCCEEDED(hr)) {
|
|
269
|
+
(*deviceContextOut)->SetDpi(xDpi, yDpi);
|
|
270
|
+
}
|
|
271
|
+
return hr;
|
|
266
272
|
}
|
|
267
273
|
|
|
268
274
|
HRESULT EndDraw() noexcept {
|
|
@@ -152,67 +152,78 @@ struct CompositionInputKeyboardSource : winrt::implements<
|
|
|
152
152
|
CompositionEventHandler::CompositionEventHandler(
|
|
153
153
|
const winrt::Microsoft::ReactNative::ReactContext &context,
|
|
154
154
|
const winrt::Microsoft::ReactNative::CompositionRootView &CompositionRootView)
|
|
155
|
-
: m_context(context) {
|
|
156
|
-
m_compRootView = CompositionRootView;
|
|
157
|
-
|
|
155
|
+
: m_context(context), m_wkRootView(CompositionRootView) {
|
|
158
156
|
#ifdef USE_WINUI3
|
|
159
|
-
if (auto island =
|
|
157
|
+
if (auto island = CompositionRootView.Island()) {
|
|
160
158
|
auto pointerSource = winrt::Microsoft::UI::Input::InputPointerSource::GetForIsland(island);
|
|
161
159
|
|
|
162
160
|
m_pointerPressedToken =
|
|
163
161
|
pointerSource.PointerPressed([this](
|
|
164
162
|
winrt::Microsoft::UI::Input::InputPointerSource const &,
|
|
165
163
|
winrt::Microsoft::UI::Input::PointerEventArgs const &args) {
|
|
166
|
-
if (
|
|
167
|
-
|
|
164
|
+
if (auto strongRootView = m_wkRootView.get()) {
|
|
165
|
+
if (SurfaceId() == -1)
|
|
166
|
+
return;
|
|
168
167
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
168
|
+
auto pp = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::PointerPoint>(
|
|
169
|
+
args.CurrentPoint(), strongRootView.ScaleFactor());
|
|
170
|
+
onPointerPressed(pp, args.KeyModifiers());
|
|
171
|
+
}
|
|
172
172
|
});
|
|
173
173
|
|
|
174
174
|
m_pointerReleasedToken =
|
|
175
175
|
pointerSource.PointerReleased([this](
|
|
176
176
|
winrt::Microsoft::UI::Input::InputPointerSource const &,
|
|
177
177
|
winrt::Microsoft::UI::Input::PointerEventArgs const &args) {
|
|
178
|
-
if (
|
|
179
|
-
|
|
178
|
+
if (auto strongRootView = m_wkRootView.get()) {
|
|
179
|
+
if (SurfaceId() == -1)
|
|
180
|
+
return;
|
|
180
181
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
182
|
+
auto pp = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::PointerPoint>(
|
|
183
|
+
args.CurrentPoint(), strongRootView.ScaleFactor());
|
|
184
|
+
onPointerReleased(pp, args.KeyModifiers());
|
|
185
|
+
}
|
|
184
186
|
});
|
|
185
187
|
|
|
186
188
|
m_pointerMovedToken = pointerSource.PointerMoved([this](
|
|
187
189
|
winrt::Microsoft::UI::Input::InputPointerSource const &,
|
|
188
190
|
winrt::Microsoft::UI::Input::PointerEventArgs const &args) {
|
|
189
|
-
auto
|
|
190
|
-
|
|
191
|
-
|
|
191
|
+
if (auto strongRootView = m_wkRootView.get()) {
|
|
192
|
+
if (SurfaceId() == -1)
|
|
193
|
+
return;
|
|
194
|
+
|
|
195
|
+
auto pp = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::PointerPoint>(
|
|
196
|
+
args.CurrentPoint(), strongRootView.ScaleFactor());
|
|
197
|
+
onPointerMoved(pp, args.KeyModifiers());
|
|
198
|
+
}
|
|
192
199
|
});
|
|
193
200
|
|
|
194
201
|
m_pointerCaptureLostToken =
|
|
195
202
|
pointerSource.PointerCaptureLost([this](
|
|
196
203
|
winrt::Microsoft::UI::Input::InputPointerSource const &,
|
|
197
204
|
winrt::Microsoft::UI::Input::PointerEventArgs const &args) {
|
|
198
|
-
if (
|
|
199
|
-
|
|
205
|
+
if (auto strongRootView = m_wkRootView.get()) {
|
|
206
|
+
if (SurfaceId() == -1)
|
|
207
|
+
return;
|
|
200
208
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
209
|
+
auto pp = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::PointerPoint>(
|
|
210
|
+
args.CurrentPoint(), strongRootView.ScaleFactor());
|
|
211
|
+
onPointerCaptureLost(pp, args.KeyModifiers());
|
|
212
|
+
}
|
|
204
213
|
});
|
|
205
214
|
|
|
206
215
|
m_pointerWheelChangedToken =
|
|
207
216
|
pointerSource.PointerWheelChanged([this](
|
|
208
217
|
winrt::Microsoft::UI::Input::InputPointerSource const &,
|
|
209
218
|
winrt::Microsoft::UI::Input::PointerEventArgs const &args) {
|
|
210
|
-
if (
|
|
211
|
-
|
|
219
|
+
if (auto strongRootView = m_wkRootView.get()) {
|
|
220
|
+
if (SurfaceId() == -1)
|
|
221
|
+
return;
|
|
212
222
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
223
|
+
auto pp = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::PointerPoint>(
|
|
224
|
+
args.CurrentPoint(), strongRootView.ScaleFactor());
|
|
225
|
+
onPointerWheelChanged(pp, args.KeyModifiers());
|
|
226
|
+
}
|
|
216
227
|
});
|
|
217
228
|
|
|
218
229
|
auto keyboardSource = winrt::Microsoft::UI::Input::InputKeyboardSource::GetForIsland(island);
|
|
@@ -220,61 +231,71 @@ CompositionEventHandler::CompositionEventHandler(
|
|
|
220
231
|
m_keyDownToken = keyboardSource.KeyDown([this](
|
|
221
232
|
winrt::Microsoft::UI::Input::InputKeyboardSource const &source,
|
|
222
233
|
winrt::Microsoft::UI::Input::KeyEventArgs const &args) {
|
|
223
|
-
if (
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
234
|
+
if (auto strongRootView = m_wkRootView.get()) {
|
|
235
|
+
if (SurfaceId() == -1)
|
|
236
|
+
return;
|
|
237
|
+
|
|
238
|
+
auto focusedComponent = RootComponentView().GetFocusedComponent();
|
|
239
|
+
auto keyArgs =
|
|
240
|
+
winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::KeyRoutedEventArgs>(
|
|
241
|
+
focusedComponent
|
|
242
|
+
? focusedComponent.Tag()
|
|
243
|
+
: static_cast<facebook::react::Tag>(
|
|
244
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::CompositionRootView>(
|
|
245
|
+
strongRootView)
|
|
246
|
+
->GetTag()),
|
|
247
|
+
args);
|
|
248
|
+
auto keyboardSource = winrt::make<CompositionInputKeyboardSource>(source);
|
|
249
|
+
onKeyDown(keyboardSource, keyArgs);
|
|
250
|
+
winrt::get_self<CompositionInputKeyboardSource>(keyboardSource)->Disconnect();
|
|
251
|
+
}
|
|
237
252
|
});
|
|
238
253
|
|
|
239
254
|
m_keyUpToken = keyboardSource.KeyUp([this](
|
|
240
255
|
winrt::Microsoft::UI::Input::InputKeyboardSource const &source,
|
|
241
256
|
winrt::Microsoft::UI::Input::KeyEventArgs const &args) {
|
|
242
|
-
if (
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
257
|
+
if (auto strongRootView = m_wkRootView.get()) {
|
|
258
|
+
if (SurfaceId() == -1)
|
|
259
|
+
return;
|
|
260
|
+
|
|
261
|
+
auto focusedComponent = RootComponentView().GetFocusedComponent();
|
|
262
|
+
auto keyArgs =
|
|
263
|
+
winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::KeyRoutedEventArgs>(
|
|
264
|
+
focusedComponent
|
|
265
|
+
? focusedComponent.Tag()
|
|
266
|
+
: static_cast<facebook::react::Tag>(
|
|
267
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::CompositionRootView>(
|
|
268
|
+
strongRootView)
|
|
269
|
+
->GetTag()),
|
|
270
|
+
args);
|
|
271
|
+
auto keyboardSource = winrt::make<CompositionInputKeyboardSource>(source);
|
|
272
|
+
onKeyUp(keyboardSource, keyArgs);
|
|
273
|
+
winrt::get_self<CompositionInputKeyboardSource>(keyboardSource)->Disconnect();
|
|
274
|
+
}
|
|
256
275
|
});
|
|
257
276
|
|
|
258
277
|
m_characterReceivedToken =
|
|
259
278
|
keyboardSource.CharacterReceived([this](
|
|
260
279
|
winrt::Microsoft::UI::Input::InputKeyboardSource const &source,
|
|
261
280
|
winrt::Microsoft::UI::Input::CharacterReceivedEventArgs const &args) {
|
|
262
|
-
if (
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
281
|
+
if (auto strongRootView = m_wkRootView.get()) {
|
|
282
|
+
if (SurfaceId() == -1)
|
|
283
|
+
return;
|
|
284
|
+
|
|
285
|
+
auto focusedComponent = RootComponentView().GetFocusedComponent();
|
|
286
|
+
auto charArgs = winrt::make<
|
|
287
|
+
winrt::Microsoft::ReactNative::Composition::Input::implementation::CharacterReceivedRoutedEventArgs>(
|
|
288
|
+
focusedComponent
|
|
289
|
+
? focusedComponent.Tag()
|
|
290
|
+
: static_cast<facebook::react::Tag>(
|
|
291
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::CompositionRootView>(
|
|
292
|
+
strongRootView)
|
|
293
|
+
->GetTag()),
|
|
294
|
+
args);
|
|
295
|
+
auto keyboardSource = winrt::make<CompositionInputKeyboardSource>(source);
|
|
296
|
+
onCharacterReceived(keyboardSource, charArgs);
|
|
297
|
+
winrt::get_self<CompositionInputKeyboardSource>(keyboardSource)->Disconnect();
|
|
298
|
+
}
|
|
278
299
|
});
|
|
279
300
|
}
|
|
280
301
|
#endif
|
|
@@ -282,24 +303,29 @@ CompositionEventHandler::CompositionEventHandler(
|
|
|
282
303
|
|
|
283
304
|
CompositionEventHandler::~CompositionEventHandler() {
|
|
284
305
|
#ifdef USE_WINUI3
|
|
285
|
-
if (auto
|
|
286
|
-
auto
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
306
|
+
if (auto strongRootView = m_wkRootView.get()) {
|
|
307
|
+
if (auto island = strongRootView.Island()) {
|
|
308
|
+
auto pointerSource = winrt::Microsoft::UI::Input::InputPointerSource::GetForIsland(island);
|
|
309
|
+
pointerSource.PointerPressed(m_pointerPressedToken);
|
|
310
|
+
pointerSource.PointerReleased(m_pointerReleasedToken);
|
|
311
|
+
pointerSource.PointerMoved(m_pointerMovedToken);
|
|
312
|
+
pointerSource.PointerCaptureLost(m_pointerCaptureLostToken);
|
|
313
|
+
pointerSource.PointerWheelChanged(m_pointerWheelChangedToken);
|
|
314
|
+
auto keyboardSource = winrt::Microsoft::UI::Input::InputKeyboardSource::GetForIsland(island);
|
|
315
|
+
keyboardSource.KeyDown(m_keyDownToken);
|
|
316
|
+
keyboardSource.KeyUp(m_keyUpToken);
|
|
317
|
+
keyboardSource.CharacterReceived(m_characterReceivedToken);
|
|
318
|
+
}
|
|
296
319
|
}
|
|
297
320
|
#endif
|
|
298
321
|
}
|
|
299
322
|
|
|
300
323
|
facebook::react::SurfaceId CompositionEventHandler::SurfaceId() const noexcept {
|
|
301
|
-
|
|
302
|
-
|
|
324
|
+
if (auto strongRootView = m_wkRootView.get()) {
|
|
325
|
+
return static_cast<facebook::react::SurfaceId>(
|
|
326
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::CompositionRootView>(strongRootView)->GetTag());
|
|
327
|
+
}
|
|
328
|
+
return -1;
|
|
303
329
|
}
|
|
304
330
|
|
|
305
331
|
winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView &
|
|
@@ -369,86 +395,104 @@ winrt::Windows::System::VirtualKeyModifiers GetKeyModifiers(uint64_t wParam) {
|
|
|
369
395
|
int64_t CompositionEventHandler::SendMessage(HWND hwnd, uint32_t msg, uint64_t wParam, int64_t lParam) noexcept {
|
|
370
396
|
switch (msg) {
|
|
371
397
|
case WM_LBUTTONDOWN: {
|
|
372
|
-
auto
|
|
373
|
-
|
|
374
|
-
|
|
398
|
+
if (auto strongRootView = m_wkRootView.get()) {
|
|
399
|
+
auto pp = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::PointerPoint>(
|
|
400
|
+
hwnd, msg, wParam, lParam, strongRootView.ScaleFactor());
|
|
401
|
+
onPointerPressed(pp, GetKeyModifiers(wParam));
|
|
402
|
+
}
|
|
375
403
|
return 0;
|
|
376
404
|
}
|
|
377
405
|
case WM_POINTERDOWN: {
|
|
378
|
-
auto
|
|
379
|
-
|
|
380
|
-
|
|
406
|
+
if (auto strongRootView = m_wkRootView.get()) {
|
|
407
|
+
auto pp = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::PointerPoint>(
|
|
408
|
+
hwnd, msg, wParam, lParam, strongRootView.ScaleFactor());
|
|
409
|
+
onPointerPressed(pp, GetKeyModifiers(wParam));
|
|
410
|
+
}
|
|
381
411
|
return 0;
|
|
382
412
|
}
|
|
383
413
|
case WM_LBUTTONUP: {
|
|
384
|
-
auto
|
|
385
|
-
|
|
386
|
-
|
|
414
|
+
if (auto strongRootView = m_wkRootView.get()) {
|
|
415
|
+
auto pp = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::PointerPoint>(
|
|
416
|
+
hwnd, msg, wParam, lParam, strongRootView.ScaleFactor());
|
|
417
|
+
onPointerReleased(pp, GetKeyModifiers(wParam));
|
|
418
|
+
}
|
|
387
419
|
return 0;
|
|
388
420
|
}
|
|
389
421
|
case WM_POINTERUP: {
|
|
390
|
-
auto
|
|
391
|
-
|
|
392
|
-
|
|
422
|
+
if (auto strongRootView = m_wkRootView.get()) {
|
|
423
|
+
auto pp = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::PointerPoint>(
|
|
424
|
+
hwnd, msg, wParam, lParam, strongRootView.ScaleFactor());
|
|
425
|
+
onPointerReleased(pp, GetKeyModifiers(wParam));
|
|
426
|
+
}
|
|
393
427
|
return 0;
|
|
394
428
|
}
|
|
395
429
|
case WM_MOUSEMOVE: {
|
|
396
|
-
auto
|
|
397
|
-
|
|
398
|
-
|
|
430
|
+
if (auto strongRootView = m_wkRootView.get()) {
|
|
431
|
+
auto pp = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::PointerPoint>(
|
|
432
|
+
hwnd, msg, wParam, lParam, strongRootView.ScaleFactor());
|
|
433
|
+
onPointerMoved(pp, GetKeyModifiers(wParam));
|
|
434
|
+
}
|
|
399
435
|
return 0;
|
|
400
436
|
}
|
|
401
437
|
case WM_CAPTURECHANGED: {
|
|
402
|
-
auto
|
|
403
|
-
|
|
404
|
-
|
|
438
|
+
if (auto strongRootView = m_wkRootView.get()) {
|
|
439
|
+
auto pp = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::PointerPoint>(
|
|
440
|
+
hwnd, msg, wParam, lParam, strongRootView.ScaleFactor());
|
|
441
|
+
onPointerCaptureLost(pp, winrt::Windows::System::VirtualKeyModifiers::None);
|
|
442
|
+
}
|
|
405
443
|
return 0;
|
|
406
444
|
}
|
|
407
445
|
case WM_MOUSEWHEEL: {
|
|
408
|
-
auto
|
|
409
|
-
|
|
410
|
-
|
|
446
|
+
if (auto strongRootView = m_wkRootView.get()) {
|
|
447
|
+
auto pp = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::PointerPoint>(
|
|
448
|
+
hwnd, msg, wParam, lParam, strongRootView.ScaleFactor());
|
|
449
|
+
onPointerWheelChanged(pp, GetKeyModifiers(wParam));
|
|
450
|
+
}
|
|
411
451
|
break;
|
|
412
452
|
}
|
|
413
453
|
case WM_CHAR:
|
|
414
454
|
case WM_SYSCHAR: {
|
|
415
|
-
auto
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
455
|
+
if (auto strongRootView = m_wkRootView.get()) {
|
|
456
|
+
auto focusedComponent = RootComponentView().GetFocusedComponent();
|
|
457
|
+
auto args = winrt::make<
|
|
458
|
+
winrt::Microsoft::ReactNative::Composition::Input::implementation::CharacterReceivedRoutedEventArgs>(
|
|
459
|
+
focusedComponent ? focusedComponent.Tag()
|
|
460
|
+
: static_cast<facebook::react::Tag>(
|
|
461
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::CompositionRootView>(
|
|
462
|
+
strongRootView)
|
|
463
|
+
->GetTag()),
|
|
464
|
+
msg,
|
|
465
|
+
wParam,
|
|
466
|
+
lParam);
|
|
467
|
+
auto keyboardSource = winrt::make<CompositionKeyboardSource>(this);
|
|
468
|
+
onCharacterReceived(keyboardSource, args);
|
|
469
|
+
winrt::get_self<CompositionKeyboardSource>(keyboardSource)->Disconnect();
|
|
470
|
+
}
|
|
429
471
|
break;
|
|
430
472
|
}
|
|
431
473
|
case WM_KEYDOWN:
|
|
432
474
|
case WM_KEYUP:
|
|
433
475
|
case WM_SYSKEYDOWN:
|
|
434
476
|
case WM_SYSKEYUP: {
|
|
435
|
-
auto
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
477
|
+
if (auto strongRootView = m_wkRootView.get()) {
|
|
478
|
+
auto focusedComponent = RootComponentView().GetFocusedComponent();
|
|
479
|
+
auto args = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::KeyRoutedEventArgs>(
|
|
480
|
+
focusedComponent ? focusedComponent.Tag()
|
|
481
|
+
: static_cast<facebook::react::Tag>(
|
|
482
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::CompositionRootView>(
|
|
483
|
+
strongRootView)
|
|
484
|
+
->GetTag()),
|
|
485
|
+
msg,
|
|
486
|
+
wParam,
|
|
487
|
+
lParam);
|
|
488
|
+
auto keyboardSource = winrt::make<CompositionKeyboardSource>(this);
|
|
489
|
+
if (msg == WM_KEYDOWN || msg == WM_SYSKEYDOWN) {
|
|
490
|
+
onKeyDown(keyboardSource, args);
|
|
491
|
+
} else {
|
|
492
|
+
onKeyUp(keyboardSource, args);
|
|
493
|
+
}
|
|
494
|
+
winrt::get_self<CompositionKeyboardSource>(keyboardSource)->Disconnect();
|
|
450
495
|
}
|
|
451
|
-
winrt::get_self<CompositionKeyboardSource>(keyboardSource)->Disconnect();
|
|
452
496
|
break;
|
|
453
497
|
}
|
|
454
498
|
}
|
|
@@ -571,9 +615,9 @@ void CompositionEventHandler::HandleIncomingPointerEvent(
|
|
|
571
615
|
|
|
572
616
|
// We only want to emit events to JS if there is a view that is currently listening to said event
|
|
573
617
|
// so we only send those event to the JS side if the element which has been entered is itself listening,
|
|
574
|
-
// or if one of its parents is listening in case those listeners care about the capturing phase. Adding the
|
|
575
|
-
// for native to distinguish between capturing listeners and not could be an optimization to further
|
|
576
|
-
// number of events we send to JS
|
|
618
|
+
// or if one of its parents is listening in case those listeners care about the capturing phase. Adding the
|
|
619
|
+
// ability for native to distinguish between capturing listeners and not could be an optimization to further
|
|
620
|
+
// reduce the number of events we send to JS
|
|
577
621
|
bool hasParentEnterListener = false;
|
|
578
622
|
bool emittedNativeEnteredEvent = false;
|
|
579
623
|
|
|
@@ -673,7 +717,8 @@ void CompositionEventHandler::HandleIncomingPointerEvent(
|
|
|
673
717
|
}
|
|
674
718
|
|
|
675
719
|
for (auto itComponentView = viewsToEmitJSLeaveEventsTo.rbegin(); itComponentView != viewsToEmitJSLeaveEventsTo.rend();
|
|
676
|
-
itComponentView++) { // for (UIView *componentView in [viewsToEmitJSLeaveEventsTo
|
|
720
|
+
itComponentView++) { // for (UIView *componentView in [viewsToEmitJSLeaveEventsTo
|
|
721
|
+
// reverseObjectEnumerator]) {
|
|
677
722
|
auto componentView = *itComponentView;
|
|
678
723
|
|
|
679
724
|
const auto eventEmitter =
|
|
@@ -769,8 +814,10 @@ void CompositionEventHandler::getTargetPointerArgs(
|
|
|
769
814
|
auto targetComponentView = fabricuiManager->GetViewRegistry().componentViewDescriptorWithTag(tag).view;
|
|
770
815
|
auto clientRect = winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(targetComponentView)
|
|
771
816
|
->getClientRect();
|
|
772
|
-
|
|
773
|
-
|
|
817
|
+
if (auto strongRootView = m_wkRootView.get()) {
|
|
818
|
+
ptLocal.x = ptScaled.x - (clientRect.left / strongRootView.ScaleFactor());
|
|
819
|
+
ptLocal.y = ptScaled.y - (clientRect.top / strongRootView.ScaleFactor());
|
|
820
|
+
}
|
|
774
821
|
} else {
|
|
775
822
|
tag = RootComponentView().hitTest(ptScaled, ptLocal);
|
|
776
823
|
}
|
|
@@ -154,7 +154,7 @@ class CompositionEventHandler {
|
|
|
154
154
|
PointerId m_touchId = 0;
|
|
155
155
|
|
|
156
156
|
std::map<PointerId, std::vector<ReactTaggedView>> m_currentlyHoveredViewsPerPointer;
|
|
157
|
-
winrt::Microsoft::ReactNative::CompositionRootView
|
|
157
|
+
winrt::weak_ref<winrt::Microsoft::ReactNative::CompositionRootView> m_wkRootView;
|
|
158
158
|
winrt::Microsoft::ReactNative::ReactContext m_context;
|
|
159
159
|
|
|
160
160
|
facebook::react::Tag m_pointerCapturingComponentTag{-1}; // Component that has captured input
|