summaryrefslogtreecommitdiff
path: root/mozilla-1580595.patch
blob: 7e45ef167bed0c96effeb9e0665db16af2bea971 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
diff -up firefox-88.0/dom/events/EventStateManager.cpp.1580595 firefox-88.0/dom/events/EventStateManager.cpp
--- firefox-88.0/dom/events/EventStateManager.cpp.1580595	2021-04-16 01:11:48.000000000 +0200
+++ firefox-88.0/dom/events/EventStateManager.cpp	2021-04-23 10:16:59.821826691 +0200
@@ -4760,7 +4760,15 @@ void EventStateManager::SetPointerLock(n
     if (dragService) {
       dragService->Suppress();
     }
+
+    // Activate native pointer lock on platforms where it is required (Wayland)
+    aWidget->LockNativePointer();
   } else {
+    if (aWidget) {
+      // Deactivate native pointer lock on platforms where it is required
+      aWidget->UnlockNativePointer();
+    }
+
     // Unlocking, so return pointer to the original position by firing a
     // synthetic mouse event. We first reset sLastRefPoint to its
     // pre-pointerlock position, so that the synthetic mouse event reports
diff -up firefox-88.0/dom/ipc/BrowserParent.cpp.1580595 firefox-88.0/dom/ipc/BrowserParent.cpp
--- firefox-88.0/dom/ipc/BrowserParent.cpp.1580595	2021-04-16 01:11:48.000000000 +0200
+++ firefox-88.0/dom/ipc/BrowserParent.cpp	2021-04-23 10:16:59.821826691 +0200
@@ -236,7 +236,8 @@ BrowserParent::BrowserParent(ContentPare
       mHasLayers(false),
       mHasPresented(false),
       mIsReadyToHandleInputEvents(false),
-      mIsMouseEnterIntoWidgetEventSuppressed(false) {
+      mIsMouseEnterIntoWidgetEventSuppressed(false),
+      mLockedNativePointer(false) {
   MOZ_ASSERT(aManager);
   // When the input event queue is disabled, we don't need to handle the case
   // that some input events are dispatched before PBrowserConstructor.
@@ -601,6 +602,7 @@ void BrowserParent::RemoveWindowListener
 }
 
 void BrowserParent::Deactivated() {
+  UnlockNativePointer();
   UnsetTopLevelWebFocus(this);
   UnsetLastMouseRemoteTarget(this);
   PointerLockManager::ReleaseLockedRemoteTarget(this);
@@ -1109,6 +1111,7 @@ void BrowserParent::UpdateDimensions(con
     mChromeOffset = chromeOffset;
 
     Unused << SendUpdateDimensions(GetDimensionInfo());
+    UpdateNativePointerLockCenter(widget);
   }
 }
 
@@ -1129,6 +1132,17 @@ DimensionInfo BrowserParent::GetDimensio
   return di;
 }
 
+void BrowserParent::UpdateNativePointerLockCenter(nsIWidget* aWidget) {
+  if (!mLockedNativePointer) {
+    return;
+  }
+  LayoutDeviceIntRect dims(
+      {0, 0},
+      ViewAs<LayoutDevicePixel>(
+          mDimensions, PixelCastJustification::LayoutDeviceIsScreenForTabDims));
+  aWidget->SetNativePointerLockCenter((dims + mChromeOffset).Center());
+}
+
 void BrowserParent::SizeModeChanged(const nsSizeMode& aSizeMode) {
   if (!mIsDestroyed && aSizeMode != mSizeMode) {
     mSizeMode = aSizeMode;
@@ -1915,6 +1929,30 @@ mozilla::ipc::IPCResult BrowserParent::R
   return IPC_OK();
 }
 
+mozilla::ipc::IPCResult BrowserParent::RecvLockNativePointer() {
+  if (nsCOMPtr<nsIWidget> widget = GetWidget()) {
+    mLockedNativePointer = true;  // do before updating the center
+    UpdateNativePointerLockCenter(widget);
+    widget->LockNativePointer();
+  }
+  return IPC_OK();
+}
+
+void BrowserParent::UnlockNativePointer() {
+  if (!mLockedNativePointer) {
+    return;
+  }
+  if (nsCOMPtr<nsIWidget> widget = GetWidget()) {
+    widget->UnlockNativePointer();
+    mLockedNativePointer = false;
+  }
+}
+
+mozilla::ipc::IPCResult BrowserParent::RecvUnlockNativePointer() {
+  UnlockNativePointer();
+  return IPC_OK();
+}
+
 void BrowserParent::SendRealKeyEvent(WidgetKeyboardEvent& aEvent) {
   if (mIsDestroyed || !mIsReadyToHandleInputEvents) {
     return;
diff -up firefox-88.0/dom/ipc/BrowserParent.h.1580595 firefox-88.0/dom/ipc/BrowserParent.h
--- firefox-88.0/dom/ipc/BrowserParent.h.1580595	2021-04-16 01:11:48.000000000 +0200
+++ firefox-88.0/dom/ipc/BrowserParent.h	2021-04-23 10:16:59.821826691 +0200
@@ -551,6 +551,10 @@ class BrowserParent final : public PBrow
   mozilla::ipc::IPCResult RecvSynthesizeNativeTouchpadDoubleTap(
       const LayoutDeviceIntPoint& aPoint, const uint32_t& aModifierFlags);
 
+  mozilla::ipc::IPCResult RecvLockNativePointer();
+
+  mozilla::ipc::IPCResult RecvUnlockNativePointer();
+
   void SendMouseEvent(const nsAString& aType, float aX, float aY,
                       int32_t aButton, int32_t aClickCount, int32_t aModifiers);
 
@@ -805,6 +809,10 @@ class BrowserParent final : public PBrow
   // and have to ensure that the child did not modify links to be loaded.
   bool QueryDropLinksForVerification();
 
+  void UnlockNativePointer();
+
+  void UpdateNativePointerLockCenter(nsIWidget* aWidget);
+
  private:
   // This is used when APZ needs to find the BrowserParent associated with a
   // layer to dispatch events.
@@ -990,6 +998,10 @@ class BrowserParent final : public PBrow
   // BrowserChild was not ready to handle it. We will resend it when the next
   // time we fire a mouse event and the BrowserChild is ready.
   bool mIsMouseEnterIntoWidgetEventSuppressed : 1;
+
+  // True after RecvLockNativePointer has been called and until
+  // UnlockNativePointer has been called.
+  bool mLockedNativePointer : 1;
 };
 
 struct MOZ_STACK_CLASS BrowserParent::AutoUseNewTab final {
diff -up firefox-88.0/dom/ipc/PBrowser.ipdl.1580595 firefox-88.0/dom/ipc/PBrowser.ipdl
--- firefox-88.0/dom/ipc/PBrowser.ipdl.1580595	2021-04-16 01:11:48.000000000 +0200
+++ firefox-88.0/dom/ipc/PBrowser.ipdl	2021-04-23 10:16:59.821826691 +0200
@@ -545,6 +545,9 @@ parent:
     async SynthesizeNativeTouchpadDoubleTap(LayoutDeviceIntPoint aPoint,
                                             uint32_t aModifierFlags);
 
+    async LockNativePointer();
+    async UnlockNativePointer();
+
     async AccessKeyNotHandled(WidgetKeyboardEvent event);
 
     async RegisterProtocolHandler(nsString scheme, nsIURI handlerURI, nsString title,
diff -up firefox-88.0/widget/gtk/mozwayland/mozwayland.c.1580595 firefox-88.0/widget/gtk/mozwayland/mozwayland.c
--- firefox-88.0/widget/gtk/mozwayland/mozwayland.c.1580595	2021-04-15 21:44:37.000000000 +0200
+++ firefox-88.0/widget/gtk/mozwayland/mozwayland.c	2021-04-23 10:16:59.822826721 +0200
@@ -23,6 +23,7 @@ const struct wl_interface wl_callback_in
 const struct wl_interface wl_data_device_interface;
 const struct wl_interface wl_data_device_manager_interface;
 const struct wl_interface wl_keyboard_interface;
+const struct wl_interface wl_pointer_interface;
 const struct wl_interface wl_region_interface;
 const struct wl_interface wl_registry_interface;
 const struct wl_interface wl_shm_interface;
diff -up firefox-88.0/widget/gtk/nsWaylandDisplay.cpp.1580595 firefox-88.0/widget/gtk/nsWaylandDisplay.cpp
--- firefox-88.0/widget/gtk/nsWaylandDisplay.cpp.1580595	2021-04-23 10:16:59.814826481 +0200
+++ firefox-88.0/widget/gtk/nsWaylandDisplay.cpp	2021-04-23 10:26:31.795941023 +0200
@@ -115,6 +115,16 @@ void nsWaylandDisplay::SetIdleInhibitMan
   mIdleInhibitManager = aIdleInhibitManager;
 }
 
+void nsWaylandDisplay::SetRelativePointerManager(
+    zwp_relative_pointer_manager_v1* aRelativePointerManager) {
+  mRelativePointerManager = aRelativePointerManager;
+}
+
+void nsWaylandDisplay::SetPointerConstraints(
+    zwp_pointer_constraints_v1* aPointerConstraints) {
+  mPointerConstraints = aPointerConstraints;
+}
+
 static void global_registry_handler(void* data, wl_registry* registry,
                                     uint32_t id, const char* interface,
                                     uint32_t version) {
@@ -163,6 +173,19 @@ static void global_registry_handler(void
     wl_proxy_set_queue((struct wl_proxy*)idle_inhibit_manager,
                        display->GetEventQueue());
     display->SetIdleInhibitManager(idle_inhibit_manager);
+  } else if (strcmp(interface, "zwp_relative_pointer_manager_v1") == 0) {
+    auto* relative_pointer_manager =
+        WaylandRegistryBind<zwp_relative_pointer_manager_v1>(
+            registry, id, &zwp_relative_pointer_manager_v1_interface, 1);
+    wl_proxy_set_queue((struct wl_proxy*)relative_pointer_manager,
+                       display->GetEventQueue());
+    display->SetRelativePointerManager(relative_pointer_manager);
+  } else if (strcmp(interface, "zwp_pointer_constraints_v1") == 0) {
+    auto* pointer_constraints = WaylandRegistryBind<zwp_pointer_constraints_v1>(
+        registry, id, &zwp_pointer_constraints_v1_interface, 1);
+    wl_proxy_set_queue((struct wl_proxy*)pointer_constraints,
+                       display->GetEventQueue());
+    display->SetPointerConstraints(pointer_constraints);
   } else if (strcmp(interface, "wl_compositor") == 0) {
     // Requested wl_compositor version 4 as we need wl_surface_damage_buffer().
     auto* compositor = WaylandRegistryBind<wl_compositor>(
@@ -276,6 +299,8 @@ nsWaylandDisplay::nsWaylandDisplay(wl_di
       mPrimarySelectionDeviceManagerGtk(nullptr),
       mPrimarySelectionDeviceManagerZwpV1(nullptr),
       mIdleInhibitManager(nullptr),
+      mRelativePointerManager(nullptr),
+      mPointerConstraints(nullptr),
       mRegistry(nullptr),
       mExplicitSync(false) {
   if (!aLighWrapper) {
diff -up firefox-88.0/widget/gtk/nsWaylandDisplay.h.1580595 firefox-88.0/widget/gtk/nsWaylandDisplay.h
--- firefox-88.0/widget/gtk/nsWaylandDisplay.h.1580595	2021-04-23 10:16:59.822826721 +0200
+++ firefox-88.0/widget/gtk/nsWaylandDisplay.h	2021-04-23 10:27:53.216377330 +0200
@@ -14,6 +14,8 @@
 #include "mozilla/widget/gbm.h"
 #include "mozilla/widget/gtk-primary-selection-client-protocol.h"
 #include "mozilla/widget/idle-inhibit-unstable-v1-client-protocol.h"
+#include "mozilla/widget/relative-pointer-unstable-v1-client-protocol.h"
+#include "mozilla/widget/pointer-constraints-unstable-v1-client-protocol.h"
 #include "mozilla/widget/linux-dmabuf-unstable-v1-client-protocol.h"
 #include "mozilla/widget/primary-selection-unstable-v1-client-protocol.h"
 
@@ -61,6 +63,12 @@ class nsWaylandDisplay {
   zwp_idle_inhibit_manager_v1* GetIdleInhibitManager(void) {
     return mIdleInhibitManager;
   }
+  zwp_relative_pointer_manager_v1* GetRelativePointerManager(void) {
+    return mRelativePointerManager;
+  }
+  zwp_pointer_constraints_v1* GetPointerConstraints(void) {
+    return mPointerConstraints;
+  }
 
   bool IsMainThreadDisplay() { return mEventQueue == nullptr; }
 
@@ -75,6 +83,9 @@ class nsWaylandDisplay {
       zwp_primary_selection_device_manager_v1* aPrimarySelectionDeviceManager);
   void SetIdleInhibitManager(zwp_idle_inhibit_manager_v1* aIdleInhibitManager);
 
+  void SetRelativePointerManager(
+      zwp_relative_pointer_manager_v1* aRelativePointerManager);
+  void SetPointerConstraints(zwp_pointer_constraints_v1* aPointerConstraints);
   bool IsExplicitSyncEnabled() { return mExplicitSync; }
 
  private:
@@ -92,6 +103,8 @@ class nsWaylandDisplay {
   gtk_primary_selection_device_manager* mPrimarySelectionDeviceManagerGtk;
   zwp_primary_selection_device_manager_v1* mPrimarySelectionDeviceManagerZwpV1;
   zwp_idle_inhibit_manager_v1* mIdleInhibitManager;
+  zwp_relative_pointer_manager_v1* mRelativePointerManager;
+  zwp_pointer_constraints_v1* mPointerConstraints;
   wl_registry* mRegistry;
   bool mExplicitSync;
 };
diff -up firefox-88.0/widget/gtk/nsWindow.cpp.1580595 firefox-88.0/widget/gtk/nsWindow.cpp
--- firefox-88.0/widget/gtk/nsWindow.cpp.1580595	2021-04-23 10:16:59.819826631 +0200
+++ firefox-88.0/widget/gtk/nsWindow.cpp	2021-04-23 10:16:59.823826750 +0200
@@ -506,6 +506,9 @@ nsWindow::nsWindow() {
 #ifdef MOZ_WAYLAND
   mNeedsCompositorResume = false;
   mCompositorInitiallyPaused = false;
+  mNativePointerLockCenter = LayoutDeviceIntPoint();
+  mRelativePointer = nullptr;
+  mLockedPointer = nullptr;
 #endif
   mWaitingForMoveToRectCB = false;
   mPendingSizeRect = LayoutDeviceIntRect(0, 0, 0, 0);
@@ -8013,6 +8016,13 @@ nsresult nsWindow::SynthesizeNativeMouse
       // all other cases we'll synthesize a motion event that will be emitted by
       // gdk_display_warp_pointer().
       // XXX How to activate native modifier for the other events?
+#ifdef MOZ_WAYLAND
+      // Impossible to warp the pointer on Wayland.
+      // For pointer lock, pointer-constraints and relative-pointer are used.
+      if (GdkIsWaylandDisplay()) {
+        return NS_OK;
+      }
+#endif
       GdkScreen* screen = gdk_window_get_screen(mGdkWindow);
       GdkPoint point = DevicePixelsToGdkPointRoundDown(aPoint);
       gdk_display_warp_pointer(display, screen, point.x, point.y);
@@ -8436,6 +8446,106 @@ already_AddRefed<nsIWidget> nsIWidget::C
 }
 
 #ifdef MOZ_WAYLAND
+static void relative_pointer_handle_relative_motion(
+    void* data, struct zwp_relative_pointer_v1* pointer, uint32_t time_hi,
+    uint32_t time_lo, wl_fixed_t dx_w, wl_fixed_t dy_w, wl_fixed_t dx_unaccel_w,
+    wl_fixed_t dy_unaccel_w) {
+  RefPtr<nsWindow> window(reinterpret_cast<nsWindow*>(data));
+
+  WidgetMouseEvent event(true, eMouseMove, window, WidgetMouseEvent::eReal);
+
+  event.mRefPoint = window->GetNativePointerLockCenter();
+  event.mRefPoint.x += wl_fixed_to_double(dx_unaccel_w);
+  event.mRefPoint.y += wl_fixed_to_double(dy_unaccel_w);
+
+  event.AssignEventTime(window->GetWidgetEventTime(time_lo));
+  window->DispatchInputEvent(&event);
+}
+
+static const struct zwp_relative_pointer_v1_listener relative_pointer_listener =
+    {
+        relative_pointer_handle_relative_motion,
+};
+
+void nsWindow::SetNativePointerLockCenter(
+    const LayoutDeviceIntPoint& aLockCenter) {
+  mNativePointerLockCenter = aLockCenter;
+}
+
+void nsWindow::LockNativePointer() {
+  if (!GdkIsWaylandDisplay()) {
+    return;
+  }
+
+  auto waylandDisplay = WaylandDisplayGet();
+
+  auto* pointerConstraints = waylandDisplay->GetPointerConstraints();
+  if (!pointerConstraints) {
+    return;
+  }
+
+  auto* relativePointerMgr = waylandDisplay->GetRelativePointerManager();
+  if (!relativePointerMgr) {
+    return;
+  }
+
+  GdkDisplay* display = gdk_display_get_default();
+
+  GdkDeviceManager* manager = gdk_display_get_device_manager(display);
+  MOZ_ASSERT(manager);
+
+  GdkDevice* device = gdk_device_manager_get_client_pointer(manager);
+  if (!device) {
+    NS_WARNING("Could not find Wayland pointer to lock");
+    return;
+  }
+  wl_pointer* pointer = gdk_wayland_device_get_wl_pointer(device);
+  MOZ_ASSERT(pointer);
+
+  wl_surface* surface =
+      gdk_wayland_window_get_wl_surface(gtk_widget_get_window(GetGtkWidget()));
+  if (!surface) {
+    /* Can be null when the window is hidden.
+     * Though it's unlikely that a lock request comes in that case, be
+     * defensive. */
+    return;
+  }
+
+  mLockedPointer = zwp_pointer_constraints_v1_lock_pointer(
+      pointerConstraints, surface, pointer, nullptr,
+      ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT);
+  if (!mLockedPointer) {
+    NS_WARNING("Could not lock Wayland pointer");
+    return;
+  }
+
+  mRelativePointer = zwp_relative_pointer_manager_v1_get_relative_pointer(
+      relativePointerMgr, pointer);
+  if (!mRelativePointer) {
+    NS_WARNING("Could not create relative Wayland pointer");
+    zwp_locked_pointer_v1_destroy(mLockedPointer);
+    mLockedPointer = nullptr;
+    return;
+  }
+
+  zwp_relative_pointer_v1_add_listener(mRelativePointer,
+                                       &relative_pointer_listener, this);
+}
+
+void nsWindow::UnlockNativePointer() {
+  if (!GdkIsWaylandDisplay()) {
+    return;
+  }
+  if (mRelativePointer) {
+    zwp_relative_pointer_v1_destroy(mRelativePointer);
+    mRelativePointer = nullptr;
+  }
+  if (mLockedPointer) {
+    zwp_locked_pointer_v1_destroy(mLockedPointer);
+    mLockedPointer = nullptr;
+  }
+}
+
 nsresult nsWindow::GetScreenRect(LayoutDeviceIntRect* aRect) {
   typedef struct _GdkMonitor GdkMonitor;
   static auto s_gdk_display_get_monitor_at_window =
diff -up firefox-88.0/widget/gtk/nsWindow.h.1580595 firefox-88.0/widget/gtk/nsWindow.h
--- firefox-88.0/widget/gtk/nsWindow.h.1580595	2021-04-16 01:11:48.000000000 +0200
+++ firefox-88.0/widget/gtk/nsWindow.h	2021-04-23 10:16:59.822826721 +0200
@@ -424,6 +424,13 @@ class nsWindow final : public nsBaseWidg
   static bool GetTopLevelWindowActiveState(nsIFrame* aFrame);
   static bool TitlebarUseShapeMask();
 #ifdef MOZ_WAYLAND
+  LayoutDeviceIntPoint GetNativePointerLockCenter() {
+    return mNativePointerLockCenter;
+  }
+  virtual void SetNativePointerLockCenter(
+      const LayoutDeviceIntPoint& aLockCenter) override;
+  virtual void LockNativePointer() override;
+  virtual void UnlockNativePointer() override;
   virtual nsresult GetScreenRect(LayoutDeviceIntRect* aRect) override;
   virtual nsRect GetPreferredPopupRect() override {
     return mPreferredPopupRect;
@@ -481,6 +488,7 @@ class nsWindow final : public nsBaseWidg
 #ifdef MOZ_WAYLAND
   bool mNeedsCompositorResume;
   bool mCompositorInitiallyPaused;
+  LayoutDeviceIntPoint mNativePointerLockCenter;
 #endif
   bool mWindowScaleFactorChanged;
   int mWindowScaleFactor;
@@ -562,6 +570,8 @@ class nsWindow final : public nsBaseWidg
 #endif
 #ifdef MOZ_WAYLAND
   RefPtr<mozilla::gfx::VsyncSource> mWaylandVsyncSource;
+  zwp_locked_pointer_v1* mLockedPointer;
+  zwp_relative_pointer_v1* mRelativePointer;
 #endif
 
   // Upper bound on pending ConfigureNotify events to be dispatched to the
diff -up firefox-88.0/widget/gtk/wayland/moz.build.1580595 firefox-88.0/widget/gtk/wayland/moz.build
--- firefox-88.0/widget/gtk/wayland/moz.build.1580595	2021-04-23 11:25:30.201028672 +0200
+++ firefox-88.0/widget/gtk/wayland/moz.build	2021-04-23 11:26:20.015525447 +0200
@@ -11,7 +11,9 @@ SOURCES += [
     "gtk-primary-selection-protocol.c",
     "idle-inhibit-unstable-v1-protocol.c",
     "linux-dmabuf-unstable-v1-protocol.c",
+    "pointer-constraints-unstable-v1-protocol.c",
     "primary-selection-unstable-v1-protocol.c",
+    "relative-pointer-unstable-v1-protocol.c",
     "xdg-output-unstable-v1-protocol.c",
 ]
 
@@ -20,7 +22,9 @@ EXPORTS.mozilla.widget += [
     "gtk-primary-selection-client-protocol.h",
     "idle-inhibit-unstable-v1-client-protocol.h",
     "linux-dmabuf-unstable-v1-client-protocol.h",
+    "pointer-constraints-unstable-v1-client-protocol.h",
     "primary-selection-unstable-v1-client-protocol.h",
+    "relative-pointer-unstable-v1-client-protocol.h",
     "va_drmcommon.h",
     "xdg-output-unstable-v1-client-protocol.h",
 ]
diff -up firefox-88.0/widget/gtk/wayland/pointer-constraints-unstable-v1-client-protocol.h.1580595 firefox-88.0/widget/gtk/wayland/pointer-constraints-unstable-v1-client-protocol.h
--- firefox-88.0/widget/gtk/wayland/pointer-constraints-unstable-v1-client-protocol.h.1580595	2021-04-23 10:16:59.823826750 +0200
+++ firefox-88.0/widget/gtk/wayland/pointer-constraints-unstable-v1-client-protocol.h	2021-04-23 10:16:59.823826750 +0200
@@ -0,0 +1,650 @@
+/* Generated by wayland-scanner 1.18.0 */
+
+#ifndef POINTER_CONSTRAINTS_UNSTABLE_V1_CLIENT_PROTOCOL_H
+#define POINTER_CONSTRAINTS_UNSTABLE_V1_CLIENT_PROTOCOL_H
+
+#include <stdint.h>
+#include <stddef.h>
+#include "wayland-client.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @page page_pointer_constraints_unstable_v1 The
+ * pointer_constraints_unstable_v1 protocol protocol for constraining pointer
+ * motions
+ *
+ * @section page_desc_pointer_constraints_unstable_v1 Description
+ *
+ * This protocol specifies a set of interfaces used for adding constraints to
+ * the motion of a pointer. Possible constraints include confining pointer
+ * motions to a given region, or locking it to its current position.
+ *
+ * In order to constrain the pointer, a client must first bind the global
+ * interface "wp_pointer_constraints" which, if a compositor supports pointer
+ * constraints, is exposed by the registry. Using the bound global object, the
+ * client uses the request that corresponds to the type of constraint it wants
+ * to make. See wp_pointer_constraints for more details.
+ *
+ * Warning! The protocol described in this file is experimental and backward
+ * incompatible changes may be made. Backward compatible changes may be added
+ * together with the corresponding interface version bump. Backward
+ * incompatible changes are done by bumping the version number in the protocol
+ * and interface names and resetting the interface version. Once the protocol
+ * is to be declared stable, the 'z' prefix and the version number in the
+ * protocol and interface names are removed and the interface version number is
+ * reset.
+ *
+ * @section page_ifaces_pointer_constraints_unstable_v1 Interfaces
+ * - @subpage page_iface_zwp_pointer_constraints_v1 - constrain the movement of
+ * a pointer
+ * - @subpage page_iface_zwp_locked_pointer_v1 - receive relative pointer motion
+ * events
+ * - @subpage page_iface_zwp_confined_pointer_v1 - confined pointer object
+ * @section page_copyright_pointer_constraints_unstable_v1 Copyright
+ * <pre>
+ *
+ * Copyright © 2014      Jonas Ådahl
+ * Copyright © 2015      Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ * </pre>
+ */
+struct wl_pointer;
+struct wl_region;
+struct wl_surface;
+struct zwp_confined_pointer_v1;
+struct zwp_locked_pointer_v1;
+struct zwp_pointer_constraints_v1;
+
+/**
+ * @page page_iface_zwp_pointer_constraints_v1 zwp_pointer_constraints_v1
+ * @section page_iface_zwp_pointer_constraints_v1_desc Description
+ *
+ * The global interface exposing pointer constraining functionality. It
+ * exposes two requests: lock_pointer for locking the pointer to its
+ * position, and confine_pointer for locking the pointer to a region.
+ *
+ * The lock_pointer and confine_pointer requests create the objects
+ * wp_locked_pointer and wp_confined_pointer respectively, and the client can
+ * use these objects to interact with the lock.
+ *
+ * For any surface, only one lock or confinement may be active across all
+ * wl_pointer objects of the same seat. If a lock or confinement is requested
+ * when another lock or confinement is active or requested on the same surface
+ * and with any of the wl_pointer objects of the same seat, an
+ * 'already_constrained' error will be raised.
+ * @section page_iface_zwp_pointer_constraints_v1_api API
+ * See @ref iface_zwp_pointer_constraints_v1.
+ */
+/**
+ * @defgroup iface_zwp_pointer_constraints_v1 The zwp_pointer_constraints_v1
+ * interface
+ *
+ * The global interface exposing pointer constraining functionality. It
+ * exposes two requests: lock_pointer for locking the pointer to its
+ * position, and confine_pointer for locking the pointer to a region.
+ *
+ * The lock_pointer and confine_pointer requests create the objects
+ * wp_locked_pointer and wp_confined_pointer respectively, and the client can
+ * use these objects to interact with the lock.
+ *
+ * For any surface, only one lock or confinement may be active across all
+ * wl_pointer objects of the same seat. If a lock or confinement is requested
+ * when another lock or confinement is active or requested on the same surface
+ * and with any of the wl_pointer objects of the same seat, an
+ * 'already_constrained' error will be raised.
+ */
+extern const struct wl_interface zwp_pointer_constraints_v1_interface;
+/**
+ * @page page_iface_zwp_locked_pointer_v1 zwp_locked_pointer_v1
+ * @section page_iface_zwp_locked_pointer_v1_desc Description
+ *
+ * The wp_locked_pointer interface represents a locked pointer state.
+ *
+ * While the lock of this object is active, the wl_pointer objects of the
+ * associated seat will not emit any wl_pointer.motion events.
+ *
+ * This object will send the event 'locked' when the lock is activated.
+ * Whenever the lock is activated, it is guaranteed that the locked surface
+ * will already have received pointer focus and that the pointer will be
+ * within the region passed to the request creating this object.
+ *
+ * To unlock the pointer, send the destroy request. This will also destroy
+ * the wp_locked_pointer object.
+ *
+ * If the compositor decides to unlock the pointer the unlocked event is
+ * sent. See wp_locked_pointer.unlock for details.
+ *
+ * When unlocking, the compositor may warp the cursor position to the set
+ * cursor position hint. If it does, it will not result in any relative
+ * motion events emitted via wp_relative_pointer.
+ *
+ * If the surface the lock was requested on is destroyed and the lock is not
+ * yet activated, the wp_locked_pointer object is now defunct and must be
+ * destroyed.
+ * @section page_iface_zwp_locked_pointer_v1_api API
+ * See @ref iface_zwp_locked_pointer_v1.
+ */
+/**
+ * @defgroup iface_zwp_locked_pointer_v1 The zwp_locked_pointer_v1 interface
+ *
+ * The wp_locked_pointer interface represents a locked pointer state.
+ *
+ * While the lock of this object is active, the wl_pointer objects of the
+ * associated seat will not emit any wl_pointer.motion events.
+ *
+ * This object will send the event 'locked' when the lock is activated.
+ * Whenever the lock is activated, it is guaranteed that the locked surface
+ * will already have received pointer focus and that the pointer will be
+ * within the region passed to the request creating this object.
+ *
+ * To unlock the pointer, send the destroy request. This will also destroy
+ * the wp_locked_pointer object.
+ *
+ * If the compositor decides to unlock the pointer the unlocked event is
+ * sent. See wp_locked_pointer.unlock for details.
+ *
+ * When unlocking, the compositor may warp the cursor position to the set
+ * cursor position hint. If it does, it will not result in any relative
+ * motion events emitted via wp_relative_pointer.
+ *
+ * If the surface the lock was requested on is destroyed and the lock is not
+ * yet activated, the wp_locked_pointer object is now defunct and must be
+ * destroyed.
+ */
+extern const struct wl_interface zwp_locked_pointer_v1_interface;
+/**
+ * @page page_iface_zwp_confined_pointer_v1 zwp_confined_pointer_v1
+ * @section page_iface_zwp_confined_pointer_v1_desc Description
+ *
+ * The wp_confined_pointer interface represents a confined pointer state.
+ *
+ * This object will send the event 'confined' when the confinement is
+ * activated. Whenever the confinement is activated, it is guaranteed that
+ * the surface the pointer is confined to will already have received pointer
+ * focus and that the pointer will be within the region passed to the request
+ * creating this object. It is up to the compositor to decide whether this
+ * requires some user interaction and if the pointer will warp to within the
+ * passed region if outside.
+ *
+ * To unconfine the pointer, send the destroy request. This will also destroy
+ * the wp_confined_pointer object.
+ *
+ * If the compositor decides to unconfine the pointer the unconfined event is
+ * sent. The wp_confined_pointer object is at this point defunct and should
+ * be destroyed.
+ * @section page_iface_zwp_confined_pointer_v1_api API
+ * See @ref iface_zwp_confined_pointer_v1.
+ */
+/**
+ * @defgroup iface_zwp_confined_pointer_v1 The zwp_confined_pointer_v1 interface
+ *
+ * The wp_confined_pointer interface represents a confined pointer state.
+ *
+ * This object will send the event 'confined' when the confinement is
+ * activated. Whenever the confinement is activated, it is guaranteed that
+ * the surface the pointer is confined to will already have received pointer
+ * focus and that the pointer will be within the region passed to the request
+ * creating this object. It is up to the compositor to decide whether this
+ * requires some user interaction and if the pointer will warp to within the
+ * passed region if outside.
+ *
+ * To unconfine the pointer, send the destroy request. This will also destroy
+ * the wp_confined_pointer object.
+ *
+ * If the compositor decides to unconfine the pointer the unconfined event is
+ * sent. The wp_confined_pointer object is at this point defunct and should
+ * be destroyed.
+ */
+extern const struct wl_interface zwp_confined_pointer_v1_interface;
+
+#ifndef ZWP_POINTER_CONSTRAINTS_V1_ERROR_ENUM
+#  define ZWP_POINTER_CONSTRAINTS_V1_ERROR_ENUM
+/**
+ * @ingroup iface_zwp_pointer_constraints_v1
+ * wp_pointer_constraints error values
+ *
+ * These errors can be emitted in response to wp_pointer_constraints
+ * requests.
+ */
+enum zwp_pointer_constraints_v1_error {
+  /**
+   * pointer constraint already requested on that surface
+   */
+  ZWP_POINTER_CONSTRAINTS_V1_ERROR_ALREADY_CONSTRAINED = 1,
+};
+#endif /* ZWP_POINTER_CONSTRAINTS_V1_ERROR_ENUM */
+
+#ifndef ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ENUM
+#  define ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ENUM
+/**
+ * @ingroup iface_zwp_pointer_constraints_v1
+ * the pointer constraint may reactivate
+ *
+ * A persistent pointer constraint may again reactivate once it has
+ * been deactivated. See the corresponding deactivation event
+ * (wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for
+ * details.
+ */
+enum zwp_pointer_constraints_v1_lifetime {
+  ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT = 1,
+  ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT = 2,
+};
+#endif /* ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ENUM */
+
+#define ZWP_POINTER_CONSTRAINTS_V1_DESTROY 0
+#define ZWP_POINTER_CONSTRAINTS_V1_LOCK_POINTER 1
+#define ZWP_POINTER_CONSTRAINTS_V1_CONFINE_POINTER 2
+
+/**
+ * @ingroup iface_zwp_pointer_constraints_v1
+ */
+#define ZWP_POINTER_CONSTRAINTS_V1_DESTROY_SINCE_VERSION 1
+/**
+ * @ingroup iface_zwp_pointer_constraints_v1
+ */
+#define ZWP_POINTER_CONSTRAINTS_V1_LOCK_POINTER_SINCE_VERSION 1
+/**
+ * @ingroup iface_zwp_pointer_constraints_v1
+ */
+#define ZWP_POINTER_CONSTRAINTS_V1_CONFINE_POINTER_SINCE_VERSION 1
+
+/** @ingroup iface_zwp_pointer_constraints_v1 */
+static inline void zwp_pointer_constraints_v1_set_user_data(
+    struct zwp_pointer_constraints_v1* zwp_pointer_constraints_v1,
+    void* user_data) {
+  wl_proxy_set_user_data((struct wl_proxy*)zwp_pointer_constraints_v1,
+                         user_data);
+}
+
+/** @ingroup iface_zwp_pointer_constraints_v1 */
+static inline void* zwp_pointer_constraints_v1_get_user_data(
+    struct zwp_pointer_constraints_v1* zwp_pointer_constraints_v1) {
+  return wl_proxy_get_user_data((struct wl_proxy*)zwp_pointer_constraints_v1);
+}
+
+static inline uint32_t zwp_pointer_constraints_v1_get_version(
+    struct zwp_pointer_constraints_v1* zwp_pointer_constraints_v1) {
+  return wl_proxy_get_version((struct wl_proxy*)zwp_pointer_constraints_v1);
+}
+
+/**
+ * @ingroup iface_zwp_pointer_constraints_v1
+ *
+ * Used by the client to notify the server that it will no longer use this
+ * pointer constraints object.
+ */
+static inline void zwp_pointer_constraints_v1_destroy(
+    struct zwp_pointer_constraints_v1* zwp_pointer_constraints_v1) {
+  wl_proxy_marshal((struct wl_proxy*)zwp_pointer_constraints_v1,
+                   ZWP_POINTER_CONSTRAINTS_V1_DESTROY);
+
+  wl_proxy_destroy((struct wl_proxy*)zwp_pointer_constraints_v1);
+}
+
+/**
+ * @ingroup iface_zwp_pointer_constraints_v1
+ *
+ * The lock_pointer request lets the client request to disable movements of
+ * the virtual pointer (i.e. the cursor), effectively locking the pointer
+ * to a position. This request may not take effect immediately; in the
+ * future, when the compositor deems implementation-specific constraints
+ * are satisfied, the pointer lock will be activated and the compositor
+ * sends a locked event.
+ *
+ * The protocol provides no guarantee that the constraints are ever
+ * satisfied, and does not require the compositor to send an error if the
+ * constraints cannot ever be satisfied. It is thus possible to request a
+ * lock that will never activate.
+ *
+ * There may not be another pointer constraint of any kind requested or
+ * active on the surface for any of the wl_pointer objects of the seat of
+ * the passed pointer when requesting a lock. If there is, an error will be
+ * raised. See general pointer lock documentation for more details.
+ *
+ * The intersection of the region passed with this request and the input
+ * region of the surface is used to determine where the pointer must be
+ * in order for the lock to activate. It is up to the compositor whether to
+ * warp the pointer or require some kind of user interaction for the lock
+ * to activate. If the region is null the surface input region is used.
+ *
+ * A surface may receive pointer focus without the lock being activated.
+ *
+ * The request creates a new object wp_locked_pointer which is used to
+ * interact with the lock as well as receive updates about its state. See
+ * the the description of wp_locked_pointer for further information.
+ *
+ * Note that while a pointer is locked, the wl_pointer objects of the
+ * corresponding seat will not emit any wl_pointer.motion events, but
+ * relative motion events will still be emitted via wp_relative_pointer
+ * objects of the same seat. wl_pointer.axis and wl_pointer.button events
+ * are unaffected.
+ */
+static inline struct zwp_locked_pointer_v1*
+zwp_pointer_constraints_v1_lock_pointer(
+    struct zwp_pointer_constraints_v1* zwp_pointer_constraints_v1,
+    struct wl_surface* surface, struct wl_pointer* pointer,
+    struct wl_region* region, uint32_t lifetime) {
+  struct wl_proxy* id;
+
+  id = wl_proxy_marshal_constructor(
+      (struct wl_proxy*)zwp_pointer_constraints_v1,
+      ZWP_POINTER_CONSTRAINTS_V1_LOCK_POINTER, &zwp_locked_pointer_v1_interface,
+      NULL, surface, pointer, region, lifetime);
+
+  return (struct zwp_locked_pointer_v1*)id;
+}
+
+/**
+ * @ingroup iface_zwp_pointer_constraints_v1
+ *
+ * The confine_pointer request lets the client request to confine the
+ * pointer cursor to a given region. This request may not take effect
+ * immediately; in the future, when the compositor deems implementation-
+ * specific constraints are satisfied, the pointer confinement will be
+ * activated and the compositor sends a confined event.
+ *
+ * The intersection of the region passed with this request and the input
+ * region of the surface is used to determine where the pointer must be
+ * in order for the confinement to activate. It is up to the compositor
+ * whether to warp the pointer or require some kind of user interaction for
+ * the confinement to activate. If the region is null the surface input
+ * region is used.
+ *
+ * The request will create a new object wp_confined_pointer which is used
+ * to interact with the confinement as well as receive updates about its
+ * state. See the the description of wp_confined_pointer for further
+ * information.
+ */
+static inline struct zwp_confined_pointer_v1*
+zwp_pointer_constraints_v1_confine_pointer(
+    struct zwp_pointer_constraints_v1* zwp_pointer_constraints_v1,
+    struct wl_surface* surface, struct wl_pointer* pointer,
+    struct wl_region* region, uint32_t lifetime) {
+  struct wl_proxy* id;
+
+  id =
+      wl_proxy_marshal_constructor((struct wl_proxy*)zwp_pointer_constraints_v1,
+                                   ZWP_POINTER_CONSTRAINTS_V1_CONFINE_POINTER,
+                                   &zwp_confined_pointer_v1_interface, NULL,
+                                   surface, pointer, region, lifetime);
+
+  return (struct zwp_confined_pointer_v1*)id;
+}
+
+/**
+ * @ingroup iface_zwp_locked_pointer_v1
+ * @struct zwp_locked_pointer_v1_listener
+ */
+struct zwp_locked_pointer_v1_listener {
+  /**
+   * lock activation event
+   *
+   * Notification that the pointer lock of the seat's pointer is
+   * activated.
+   */
+  void (*locked)(void* data,
+                 struct zwp_locked_pointer_v1* zwp_locked_pointer_v1);
+  /**
+   * lock deactivation event
+   *
+   * Notification that the pointer lock of the seat's pointer is no
+   * longer active. If this is a oneshot pointer lock (see
+   * wp_pointer_constraints.lifetime) this object is now defunct and
+   * should be destroyed. If this is a persistent pointer lock (see
+   * wp_pointer_constraints.lifetime) this pointer lock may again
+   * reactivate in the future.
+   */
+  void (*unlocked)(void* data,
+                   struct zwp_locked_pointer_v1* zwp_locked_pointer_v1);
+};
+
+/**
+ * @ingroup iface_zwp_locked_pointer_v1
+ */
+static inline int zwp_locked_pointer_v1_add_listener(
+    struct zwp_locked_pointer_v1* zwp_locked_pointer_v1,
+    const struct zwp_locked_pointer_v1_listener* listener, void* data) {
+  return wl_proxy_add_listener((struct wl_proxy*)zwp_locked_pointer_v1,
+                               (void (**)(void))listener, data);
+}
+
+#define ZWP_LOCKED_POINTER_V1_DESTROY 0
+#define ZWP_LOCKED_POINTER_V1_SET_CURSOR_POSITION_HINT 1
+#define ZWP_LOCKED_POINTER_V1_SET_REGION 2
+
+/**
+ * @ingroup iface_zwp_locked_pointer_v1
+ */
+#define ZWP_LOCKED_POINTER_V1_LOCKED_SINCE_VERSION 1
+/**
+ * @ingroup iface_zwp_locked_pointer_v1
+ */
+#define ZWP_LOCKED_POINTER_V1_UNLOCKED_SINCE_VERSION 1
+
+/**
+ * @ingroup iface_zwp_locked_pointer_v1
+ */
+#define ZWP_LOCKED_POINTER_V1_DESTROY_SINCE_VERSION 1
+/**
+ * @ingroup iface_zwp_locked_pointer_v1
+ */
+#define ZWP_LOCKED_POINTER_V1_SET_CURSOR_POSITION_HINT_SINCE_VERSION 1
+/**
+ * @ingroup iface_zwp_locked_pointer_v1
+ */
+#define ZWP_LOCKED_POINTER_V1_SET_REGION_SINCE_VERSION 1
+
+/** @ingroup iface_zwp_locked_pointer_v1 */
+static inline void zwp_locked_pointer_v1_set_user_data(
+    struct zwp_locked_pointer_v1* zwp_locked_pointer_v1, void* user_data) {
+  wl_proxy_set_user_data((struct wl_proxy*)zwp_locked_pointer_v1, user_data);
+}
+
+/** @ingroup iface_zwp_locked_pointer_v1 */
+static inline void* zwp_locked_pointer_v1_get_user_data(
+    struct zwp_locked_pointer_v1* zwp_locked_pointer_v1) {
+  return wl_proxy_get_user_data((struct wl_proxy*)zwp_locked_pointer_v1);
+}
+
+static inline uint32_t zwp_locked_pointer_v1_get_version(
+    struct zwp_locked_pointer_v1* zwp_locked_pointer_v1) {
+  return wl_proxy_get_version((struct wl_proxy*)zwp_locked_pointer_v1);
+}
+
+/**
+ * @ingroup iface_zwp_locked_pointer_v1
+ *
+ * Destroy the locked pointer object. If applicable, the compositor will
+ * unlock the pointer.
+ */
+static inline void zwp_locked_pointer_v1_destroy(
+    struct zwp_locked_pointer_v1* zwp_locked_pointer_v1) {
+  wl_proxy_marshal((struct wl_proxy*)zwp_locked_pointer_v1,
+                   ZWP_LOCKED_POINTER_V1_DESTROY);
+
+  wl_proxy_destroy((struct wl_proxy*)zwp_locked_pointer_v1);
+}
+
+/**
+ * @ingroup iface_zwp_locked_pointer_v1
+ *
+ * Set the cursor position hint relative to the top left corner of the
+ * surface.
+ *
+ * If the client is drawing its own cursor, it should update the position
+ * hint to the position of its own cursor. A compositor may use this
+ * information to warp the pointer upon unlock in order to avoid pointer
+ * jumps.
+ *
+ * The cursor position hint is double buffered. The new hint will only take
+ * effect when the associated surface gets it pending state applied. See
+ * wl_surface.commit for details.
+ */
+static inline void zwp_locked_pointer_v1_set_cursor_position_hint(
+    struct zwp_locked_pointer_v1* zwp_locked_pointer_v1, wl_fixed_t surface_x,
+    wl_fixed_t surface_y) {
+  wl_proxy_marshal((struct wl_proxy*)zwp_locked_pointer_v1,
+                   ZWP_LOCKED_POINTER_V1_SET_CURSOR_POSITION_HINT, surface_x,
+                   surface_y);
+}
+
+/**
+ * @ingroup iface_zwp_locked_pointer_v1
+ *
+ * Set a new region used to lock the pointer.
+ *
+ * The new lock region is double-buffered. The new lock region will
+ * only take effect when the associated surface gets its pending state
+ * applied. See wl_surface.commit for details.
+ *
+ * For details about the lock region, see wp_locked_pointer.
+ */
+static inline void zwp_locked_pointer_v1_set_region(
+    struct zwp_locked_pointer_v1* zwp_locked_pointer_v1,
+    struct wl_region* region) {
+  wl_proxy_marshal((struct wl_proxy*)zwp_locked_pointer_v1,
+                   ZWP_LOCKED_POINTER_V1_SET_REGION, region);
+}
+
+/**
+ * @ingroup iface_zwp_confined_pointer_v1
+ * @struct zwp_confined_pointer_v1_listener
+ */
+struct zwp_confined_pointer_v1_listener {
+  /**
+   * pointer confined
+   *
+   * Notification that the pointer confinement of the seat's
+   * pointer is activated.
+   */
+  void (*confined)(void* data,
+                   struct zwp_confined_pointer_v1* zwp_confined_pointer_v1);
+  /**
+   * pointer unconfined
+   *
+   * Notification that the pointer confinement of the seat's
+   * pointer is no longer active. If this is a oneshot pointer
+   * confinement (see wp_pointer_constraints.lifetime) this object is
+   * now defunct and should be destroyed. If this is a persistent
+   * pointer confinement (see wp_pointer_constraints.lifetime) this
+   * pointer confinement may again reactivate in the future.
+   */
+  void (*unconfined)(void* data,
+                     struct zwp_confined_pointer_v1* zwp_confined_pointer_v1);
+};
+
+/**
+ * @ingroup iface_zwp_confined_pointer_v1
+ */
+static inline int zwp_confined_pointer_v1_add_listener(
+    struct zwp_confined_pointer_v1* zwp_confined_pointer_v1,
+    const struct zwp_confined_pointer_v1_listener* listener, void* data) {
+  return wl_proxy_add_listener((struct wl_proxy*)zwp_confined_pointer_v1,
+                               (void (**)(void))listener, data);
+}
+
+#define ZWP_CONFINED_POINTER_V1_DESTROY 0
+#define ZWP_CONFINED_POINTER_V1_SET_REGION 1
+
+/**
+ * @ingroup iface_zwp_confined_pointer_v1
+ */
+#define ZWP_CONFINED_POINTER_V1_CONFINED_SINCE_VERSION 1
+/**
+ * @ingroup iface_zwp_confined_pointer_v1
+ */
+#define ZWP_CONFINED_POINTER_V1_UNCONFINED_SINCE_VERSION 1
+
+/**
+ * @ingroup iface_zwp_confined_pointer_v1
+ */
+#define ZWP_CONFINED_POINTER_V1_DESTROY_SINCE_VERSION 1
+/**
+ * @ingroup iface_zwp_confined_pointer_v1
+ */
+#define ZWP_CONFINED_POINTER_V1_SET_REGION_SINCE_VERSION 1
+
+/** @ingroup iface_zwp_confined_pointer_v1 */
+static inline void zwp_confined_pointer_v1_set_user_data(
+    struct zwp_confined_pointer_v1* zwp_confined_pointer_v1, void* user_data) {
+  wl_proxy_set_user_data((struct wl_proxy*)zwp_confined_pointer_v1, user_data);
+}
+
+/** @ingroup iface_zwp_confined_pointer_v1 */
+static inline void* zwp_confined_pointer_v1_get_user_data(
+    struct zwp_confined_pointer_v1* zwp_confined_pointer_v1) {
+  return wl_proxy_get_user_data((struct wl_proxy*)zwp_confined_pointer_v1);
+}
+
+static inline uint32_t zwp_confined_pointer_v1_get_version(
+    struct zwp_confined_pointer_v1* zwp_confined_pointer_v1) {
+  return wl_proxy_get_version((struct wl_proxy*)zwp_confined_pointer_v1);
+}
+
+/**
+ * @ingroup iface_zwp_confined_pointer_v1
+ *
+ * Destroy the confined pointer object. If applicable, the compositor will
+ * unconfine the pointer.
+ */
+static inline void zwp_confined_pointer_v1_destroy(
+    struct zwp_confined_pointer_v1* zwp_confined_pointer_v1) {
+  wl_proxy_marshal((struct wl_proxy*)zwp_confined_pointer_v1,
+                   ZWP_CONFINED_POINTER_V1_DESTROY);
+
+  wl_proxy_destroy((struct wl_proxy*)zwp_confined_pointer_v1);
+}
+
+/**
+ * @ingroup iface_zwp_confined_pointer_v1
+ *
+ * Set a new region used to confine the pointer.
+ *
+ * The new confine region is double-buffered. The new confine region will
+ * only take effect when the associated surface gets its pending state
+ * applied. See wl_surface.commit for details.
+ *
+ * If the confinement is active when the new confinement region is applied
+ * and the pointer ends up outside of newly applied region, the pointer may
+ * warped to a position within the new confinement region. If warped, a
+ * wl_pointer.motion event will be emitted, but no
+ * wp_relative_pointer.relative_motion event.
+ *
+ * The compositor may also, instead of using the new region, unconfine the
+ * pointer.
+ *
+ * For details about the confine region, see wp_confined_pointer.
+ */
+static inline void zwp_confined_pointer_v1_set_region(
+    struct zwp_confined_pointer_v1* zwp_confined_pointer_v1,
+    struct wl_region* region) {
+  wl_proxy_marshal((struct wl_proxy*)zwp_confined_pointer_v1,
+                   ZWP_CONFINED_POINTER_V1_SET_REGION, region);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff -up firefox-88.0/widget/gtk/wayland/pointer-constraints-unstable-v1-protocol.c.1580595 firefox-88.0/widget/gtk/wayland/pointer-constraints-unstable-v1-protocol.c
--- firefox-88.0/widget/gtk/wayland/pointer-constraints-unstable-v1-protocol.c.1580595	2021-04-23 10:16:59.823826750 +0200
+++ firefox-88.0/widget/gtk/wayland/pointer-constraints-unstable-v1-protocol.c	2021-04-23 10:16:59.823826750 +0200
@@ -0,0 +1,97 @@
+/* Generated by wayland-scanner 1.18.0 */
+
+/*
+ * Copyright © 2014      Jonas Ådahl
+ * Copyright © 2015      Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include <stdlib.h>
+#include <stdint.h>
+#include "wayland-util.h"
+
+#pragma GCC visibility push(default)
+extern const struct wl_interface wl_pointer_interface;
+extern const struct wl_interface wl_region_interface;
+extern const struct wl_interface wl_surface_interface;
+extern const struct wl_interface zwp_confined_pointer_v1_interface;
+extern const struct wl_interface zwp_locked_pointer_v1_interface;
+#pragma GCC visibility pop
+
+static const struct wl_interface* pointer_constraints_unstable_v1_types[] = {
+    NULL,
+    NULL,
+    &zwp_locked_pointer_v1_interface,
+    &wl_surface_interface,
+    &wl_pointer_interface,
+    &wl_region_interface,
+    NULL,
+    &zwp_confined_pointer_v1_interface,
+    &wl_surface_interface,
+    &wl_pointer_interface,
+    &wl_region_interface,
+    NULL,
+    &wl_region_interface,
+    &wl_region_interface,
+};
+
+static const struct wl_message zwp_pointer_constraints_v1_requests[] = {
+    {"destroy", "", pointer_constraints_unstable_v1_types + 0},
+    {"lock_pointer", "noo?ou", pointer_constraints_unstable_v1_types + 2},
+    {"confine_pointer", "noo?ou", pointer_constraints_unstable_v1_types + 7},
+};
+
+WL_EXPORT const struct wl_interface zwp_pointer_constraints_v1_interface = {
+    "zwp_pointer_constraints_v1",        1, 3,
+    zwp_pointer_constraints_v1_requests, 0, NULL,
+};
+
+static const struct wl_message zwp_locked_pointer_v1_requests[] = {
+    {"destroy", "", pointer_constraints_unstable_v1_types + 0},
+    {"set_cursor_position_hint", "ff",
+     pointer_constraints_unstable_v1_types + 0},
+    {"set_region", "?o", pointer_constraints_unstable_v1_types + 12},
+};
+
+static const struct wl_message zwp_locked_pointer_v1_events[] = {
+    {"locked", "", pointer_constraints_unstable_v1_types + 0},
+    {"unlocked", "", pointer_constraints_unstable_v1_types + 0},
+};
+
+WL_EXPORT const struct wl_interface zwp_locked_pointer_v1_interface = {
+    "zwp_locked_pointer_v1",        1, 3,
+    zwp_locked_pointer_v1_requests, 2, zwp_locked_pointer_v1_events,
+};
+
+static const struct wl_message zwp_confined_pointer_v1_requests[] = {
+    {"destroy", "", pointer_constraints_unstable_v1_types + 0},
+    {"set_region", "?o", pointer_constraints_unstable_v1_types + 13},
+};
+
+static const struct wl_message zwp_confined_pointer_v1_events[] = {
+    {"confined", "", pointer_constraints_unstable_v1_types + 0},
+    {"unconfined", "", pointer_constraints_unstable_v1_types + 0},
+};
+
+WL_EXPORT const struct wl_interface zwp_confined_pointer_v1_interface = {
+    "zwp_confined_pointer_v1",        1, 2,
+    zwp_confined_pointer_v1_requests, 2, zwp_confined_pointer_v1_events,
+};
diff -up firefox-88.0/widget/gtk/wayland/relative-pointer-unstable-v1-client-protocol.h.1580595 firefox-88.0/widget/gtk/wayland/relative-pointer-unstable-v1-client-protocol.h
--- firefox-88.0/widget/gtk/wayland/relative-pointer-unstable-v1-client-protocol.h.1580595	2021-04-23 10:16:59.823826750 +0200
+++ firefox-88.0/widget/gtk/wayland/relative-pointer-unstable-v1-client-protocol.h	2021-04-23 10:16:59.823826750 +0200
@@ -0,0 +1,293 @@
+/* Generated by wayland-scanner 1.18.0 */
+
+#ifndef RELATIVE_POINTER_UNSTABLE_V1_CLIENT_PROTOCOL_H
+#define RELATIVE_POINTER_UNSTABLE_V1_CLIENT_PROTOCOL_H
+
+#include <stdint.h>
+#include <stddef.h>
+#include "wayland-client.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @page page_relative_pointer_unstable_v1 The relative_pointer_unstable_v1
+ * protocol protocol for relative pointer motion events
+ *
+ * @section page_desc_relative_pointer_unstable_v1 Description
+ *
+ * This protocol specifies a set of interfaces used for making clients able to
+ * receive relative pointer events not obstructed by barriers (such as the
+ * monitor edge or other pointer barriers).
+ *
+ * To start receiving relative pointer events, a client must first bind the
+ * global interface "wp_relative_pointer_manager" which, if a compositor
+ * supports relative pointer motion events, is exposed by the registry. After
+ * having created the relative pointer manager proxy object, the client uses
+ * it to create the actual relative pointer object using the
+ * "get_relative_pointer" request given a wl_pointer. The relative pointer
+ * motion events will then, when applicable, be transmitted via the proxy of
+ * the newly created relative pointer object. See the documentation of the
+ * relative pointer interface for more details.
+ *
+ * Warning! The protocol described in this file is experimental and backward
+ * incompatible changes may be made. Backward compatible changes may be added
+ * together with the corresponding interface version bump. Backward
+ * incompatible changes are done by bumping the version number in the protocol
+ * and interface names and resetting the interface version. Once the protocol
+ * is to be declared stable, the 'z' prefix and the version number in the
+ * protocol and interface names are removed and the interface version number is
+ * reset.
+ *
+ * @section page_ifaces_relative_pointer_unstable_v1 Interfaces
+ * - @subpage page_iface_zwp_relative_pointer_manager_v1 - get relative pointer
+ * objects
+ * - @subpage page_iface_zwp_relative_pointer_v1 - relative pointer object
+ * @section page_copyright_relative_pointer_unstable_v1 Copyright
+ * <pre>
+ *
+ * Copyright © 2014      Jonas Ådahl
+ * Copyright © 2015      Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ * </pre>
+ */
+struct wl_pointer;
+struct zwp_relative_pointer_manager_v1;
+struct zwp_relative_pointer_v1;
+
+/**
+ * @page page_iface_zwp_relative_pointer_manager_v1
+ * zwp_relative_pointer_manager_v1
+ * @section page_iface_zwp_relative_pointer_manager_v1_desc Description
+ *
+ * A global interface used for getting the relative pointer object for a
+ * given pointer.
+ * @section page_iface_zwp_relative_pointer_manager_v1_api API
+ * See @ref iface_zwp_relative_pointer_manager_v1.
+ */
+/**
+ * @defgroup iface_zwp_relative_pointer_manager_v1 The
+ * zwp_relative_pointer_manager_v1 interface
+ *
+ * A global interface used for getting the relative pointer object for a
+ * given pointer.
+ */
+extern const struct wl_interface zwp_relative_pointer_manager_v1_interface;
+/**
+ * @page page_iface_zwp_relative_pointer_v1 zwp_relative_pointer_v1
+ * @section page_iface_zwp_relative_pointer_v1_desc Description
+ *
+ * A wp_relative_pointer object is an extension to the wl_pointer interface
+ * used for emitting relative pointer events. It shares the same focus as
+ * wl_pointer objects of the same seat and will only emit events when it has
+ * focus.
+ * @section page_iface_zwp_relative_pointer_v1_api API
+ * See @ref iface_zwp_relative_pointer_v1.
+ */
+/**
+ * @defgroup iface_zwp_relative_pointer_v1 The zwp_relative_pointer_v1 interface
+ *
+ * A wp_relative_pointer object is an extension to the wl_pointer interface
+ * used for emitting relative pointer events. It shares the same focus as
+ * wl_pointer objects of the same seat and will only emit events when it has
+ * focus.
+ */
+extern const struct wl_interface zwp_relative_pointer_v1_interface;
+
+#define ZWP_RELATIVE_POINTER_MANAGER_V1_DESTROY 0
+#define ZWP_RELATIVE_POINTER_MANAGER_V1_GET_RELATIVE_POINTER 1
+
+/**
+ * @ingroup iface_zwp_relative_pointer_manager_v1
+ */
+#define ZWP_RELATIVE_POINTER_MANAGER_V1_DESTROY_SINCE_VERSION 1
+/**
+ * @ingroup iface_zwp_relative_pointer_manager_v1
+ */
+#define ZWP_RELATIVE_POINTER_MANAGER_V1_GET_RELATIVE_POINTER_SINCE_VERSION 1
+
+/** @ingroup iface_zwp_relative_pointer_manager_v1 */
+static inline void zwp_relative_pointer_manager_v1_set_user_data(
+    struct zwp_relative_pointer_manager_v1* zwp_relative_pointer_manager_v1,
+    void* user_data) {
+  wl_proxy_set_user_data((struct wl_proxy*)zwp_relative_pointer_manager_v1,
+                         user_data);
+}
+
+/** @ingroup iface_zwp_relative_pointer_manager_v1 */
+static inline void* zwp_relative_pointer_manager_v1_get_user_data(
+    struct zwp_relative_pointer_manager_v1* zwp_relative_pointer_manager_v1) {
+  return wl_proxy_get_user_data(
+      (struct wl_proxy*)zwp_relative_pointer_manager_v1);
+}
+
+static inline uint32_t zwp_relative_pointer_manager_v1_get_version(
+    struct zwp_relative_pointer_manager_v1* zwp_relative_pointer_manager_v1) {
+  return wl_proxy_get_version(
+      (struct wl_proxy*)zwp_relative_pointer_manager_v1);
+}
+
+/**
+ * @ingroup iface_zwp_relative_pointer_manager_v1
+ *
+ * Used by the client to notify the server that it will no longer use this
+ * relative pointer manager object.
+ */
+static inline void zwp_relative_pointer_manager_v1_destroy(
+    struct zwp_relative_pointer_manager_v1* zwp_relative_pointer_manager_v1) {
+  wl_proxy_marshal((struct wl_proxy*)zwp_relative_pointer_manager_v1,
+                   ZWP_RELATIVE_POINTER_MANAGER_V1_DESTROY);
+
+  wl_proxy_destroy((struct wl_proxy*)zwp_relative_pointer_manager_v1);
+}
+
+/**
+ * @ingroup iface_zwp_relative_pointer_manager_v1
+ *
+ * Create a relative pointer interface given a wl_pointer object. See the
+ * wp_relative_pointer interface for more details.
+ */
+static inline struct zwp_relative_pointer_v1*
+zwp_relative_pointer_manager_v1_get_relative_pointer(
+    struct zwp_relative_pointer_manager_v1* zwp_relative_pointer_manager_v1,
+    struct wl_pointer* pointer) {
+  struct wl_proxy* id;
+
+  id = wl_proxy_marshal_constructor(
+      (struct wl_proxy*)zwp_relative_pointer_manager_v1,
+      ZWP_RELATIVE_POINTER_MANAGER_V1_GET_RELATIVE_POINTER,
+      &zwp_relative_pointer_v1_interface, NULL, pointer);
+
+  return (struct zwp_relative_pointer_v1*)id;
+}
+
+/**
+ * @ingroup iface_zwp_relative_pointer_v1
+ * @struct zwp_relative_pointer_v1_listener
+ */
+struct zwp_relative_pointer_v1_listener {
+  /**
+   * relative pointer motion
+   *
+   * Relative x/y pointer motion from the pointer of the seat
+   * associated with this object.
+   *
+   * A relative motion is in the same dimension as regular wl_pointer
+   * motion events, except they do not represent an absolute
+   * position. For example, moving a pointer from (x, y) to (x', y')
+   * would have the equivalent relative motion (x' - x, y' - y). If a
+   * pointer motion caused the absolute pointer position to be
+   * clipped by for example the edge of the monitor, the relative
+   * motion is unaffected by the clipping and will represent the
+   * unclipped motion.
+   *
+   * This event also contains non-accelerated motion deltas. The
+   * non-accelerated delta is, when applicable, the regular pointer
+   * motion delta as it was before having applied motion acceleration
+   * and other transformations such as normalization.
+   *
+   * Note that the non-accelerated delta does not represent 'raw'
+   * events as they were read from some device. Pointer motion
+   * acceleration is device- and configuration-specific and
+   * non-accelerated deltas and accelerated deltas may have the same
+   * value on some devices.
+   *
+   * Relative motions are not coupled to wl_pointer.motion events,
+   * and can be sent in combination with such events, but also
+   * independently. There may also be scenarios where
+   * wl_pointer.motion is sent, but there is no relative motion. The
+   * order of an absolute and relative motion event originating from
+   * the same physical motion is not guaranteed.
+   *
+   * If the client needs button events or focus state, it can receive
+   * them from a wl_pointer object of the same seat that the
+   * wp_relative_pointer object is associated with.
+   * @param utime_hi high 32 bits of a 64 bit timestamp with microsecond
+   * granularity
+   * @param utime_lo low 32 bits of a 64 bit timestamp with microsecond
+   * granularity
+   * @param dx the x component of the motion vector
+   * @param dy the y component of the motion vector
+   * @param dx_unaccel the x component of the unaccelerated motion vector
+   * @param dy_unaccel the y component of the unaccelerated motion vector
+   */
+  void (*relative_motion)(
+      void* data, struct zwp_relative_pointer_v1* zwp_relative_pointer_v1,
+      uint32_t utime_hi, uint32_t utime_lo, wl_fixed_t dx, wl_fixed_t dy,
+      wl_fixed_t dx_unaccel, wl_fixed_t dy_unaccel);
+};
+
+/**
+ * @ingroup iface_zwp_relative_pointer_v1
+ */
+static inline int zwp_relative_pointer_v1_add_listener(
+    struct zwp_relative_pointer_v1* zwp_relative_pointer_v1,
+    const struct zwp_relative_pointer_v1_listener* listener, void* data) {
+  return wl_proxy_add_listener((struct wl_proxy*)zwp_relative_pointer_v1,
+                               (void (**)(void))listener, data);
+}
+
+#define ZWP_RELATIVE_POINTER_V1_DESTROY 0
+
+/**
+ * @ingroup iface_zwp_relative_pointer_v1
+ */
+#define ZWP_RELATIVE_POINTER_V1_RELATIVE_MOTION_SINCE_VERSION 1
+
+/**
+ * @ingroup iface_zwp_relative_pointer_v1
+ */
+#define ZWP_RELATIVE_POINTER_V1_DESTROY_SINCE_VERSION 1
+
+/** @ingroup iface_zwp_relative_pointer_v1 */
+static inline void zwp_relative_pointer_v1_set_user_data(
+    struct zwp_relative_pointer_v1* zwp_relative_pointer_v1, void* user_data) {
+  wl_proxy_set_user_data((struct wl_proxy*)zwp_relative_pointer_v1, user_data);
+}
+
+/** @ingroup iface_zwp_relative_pointer_v1 */
+static inline void* zwp_relative_pointer_v1_get_user_data(
+    struct zwp_relative_pointer_v1* zwp_relative_pointer_v1) {
+  return wl_proxy_get_user_data((struct wl_proxy*)zwp_relative_pointer_v1);
+}
+
+static inline uint32_t zwp_relative_pointer_v1_get_version(
+    struct zwp_relative_pointer_v1* zwp_relative_pointer_v1) {
+  return wl_proxy_get_version((struct wl_proxy*)zwp_relative_pointer_v1);
+}
+
+/**
+ * @ingroup iface_zwp_relative_pointer_v1
+ */
+static inline void zwp_relative_pointer_v1_destroy(
+    struct zwp_relative_pointer_v1* zwp_relative_pointer_v1) {
+  wl_proxy_marshal((struct wl_proxy*)zwp_relative_pointer_v1,
+                   ZWP_RELATIVE_POINTER_V1_DESTROY);
+
+  wl_proxy_destroy((struct wl_proxy*)zwp_relative_pointer_v1);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff -up firefox-88.0/widget/gtk/wayland/relative-pointer-unstable-v1-protocol.c.1580595 firefox-88.0/widget/gtk/wayland/relative-pointer-unstable-v1-protocol.c
--- firefox-88.0/widget/gtk/wayland/relative-pointer-unstable-v1-protocol.c.1580595	2021-04-23 10:16:59.823826750 +0200
+++ firefox-88.0/widget/gtk/wayland/relative-pointer-unstable-v1-protocol.c	2021-04-23 10:16:59.823826750 +0200
@@ -0,0 +1,69 @@
+/* Generated by wayland-scanner 1.18.0 */
+
+/*
+ * Copyright © 2014      Jonas Ådahl
+ * Copyright © 2015      Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include <stdlib.h>
+#include <stdint.h>
+#include "wayland-util.h"
+
+#pragma GCC visibility push(default)
+extern const struct wl_interface wl_pointer_interface;
+extern const struct wl_interface zwp_relative_pointer_v1_interface;
+#pragma GCC visibility pop
+
+static const struct wl_interface* relative_pointer_unstable_v1_types[] = {
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    &zwp_relative_pointer_v1_interface,
+    &wl_pointer_interface,
+};
+
+static const struct wl_message zwp_relative_pointer_manager_v1_requests[] = {
+    {"destroy", "", relative_pointer_unstable_v1_types + 0},
+    {"get_relative_pointer", "no", relative_pointer_unstable_v1_types + 6},
+};
+
+WL_EXPORT const struct wl_interface zwp_relative_pointer_manager_v1_interface =
+    {
+        "zwp_relative_pointer_manager_v1",        1, 2,
+        zwp_relative_pointer_manager_v1_requests, 0, NULL,
+};
+
+static const struct wl_message zwp_relative_pointer_v1_requests[] = {
+    {"destroy", "", relative_pointer_unstable_v1_types + 0},
+};
+
+static const struct wl_message zwp_relative_pointer_v1_events[] = {
+    {"relative_motion", "uuffff", relative_pointer_unstable_v1_types + 0},
+};
+
+WL_EXPORT const struct wl_interface zwp_relative_pointer_v1_interface = {
+    "zwp_relative_pointer_v1",        1, 1,
+    zwp_relative_pointer_v1_requests, 1, zwp_relative_pointer_v1_events,
+};
diff -up firefox-88.0/widget/nsIWidget.h.1580595 firefox-88.0/widget/nsIWidget.h
--- firefox-88.0/widget/nsIWidget.h.1580595	2021-04-16 01:11:48.000000000 +0200
+++ firefox-88.0/widget/nsIWidget.h	2021-04-23 10:16:59.823826750 +0200
@@ -1771,6 +1771,16 @@ class nsIWidget : public nsISupports {
 
 #endif
 
+  /**
+   * If this widget uses native pointer lock instead of warp-to-center
+   * (currently only GTK on Wayland), these methods provide access to that
+   * functionality.
+   */
+  virtual void SetNativePointerLockCenter(
+      const LayoutDeviceIntPoint& aLockCenter) {}
+  virtual void LockNativePointer() {}
+  virtual void UnlockNativePointer() {}
+
   /*
    * Get safe area insets except to cutout.
    * See https://drafts.csswg.org/css-env-1/#safe-area-insets.
diff -up firefox-88.0/widget/PuppetWidget.cpp.1580595 firefox-88.0/widget/PuppetWidget.cpp
--- firefox-88.0/widget/PuppetWidget.cpp.1580595	2021-04-16 01:11:48.000000000 +0200
+++ firefox-88.0/widget/PuppetWidget.cpp	2021-04-23 10:16:59.822826721 +0200
@@ -534,6 +534,20 @@ nsresult PuppetWidget::SynthesizeNativeT
   return NS_OK;
 }
 
+void PuppetWidget::LockNativePointer() {
+  if (!mBrowserChild) {
+    return;
+  }
+  mBrowserChild->SendLockNativePointer();
+}
+
+void PuppetWidget::UnlockNativePointer() {
+  if (!mBrowserChild) {
+    return;
+  }
+  mBrowserChild->SendUnlockNativePointer();
+}
+
 void PuppetWidget::SetConfirmedTargetAPZC(
     uint64_t aInputBlockId,
     const nsTArray<ScrollableLayerGuid>& aTargets) const {
diff -up firefox-88.0/widget/PuppetWidget.h.1580595 firefox-88.0/widget/PuppetWidget.h
--- firefox-88.0/widget/PuppetWidget.h.1580595	2021-04-16 01:11:48.000000000 +0200
+++ firefox-88.0/widget/PuppetWidget.h	2021-04-23 10:16:59.821826691 +0200
@@ -283,6 +283,9 @@ class PuppetWidget : public nsBaseWidget
   virtual nsresult SynthesizeNativeTouchpadDoubleTap(
       LayoutDeviceIntPoint aPoint, uint32_t aModifierFlags) override;
 
+  virtual void LockNativePointer() override;
+  virtual void UnlockNativePointer() override;
+
   virtual void StartAsyncScrollbarDrag(
       const AsyncDragMetrics& aDragMetrics) override;
 
--- firefox-88.0/widget/gtk/mozgtk/mozgtk.c.old	2021-04-23 14:19:07.244820364 +0200
+++ firefox-88.0/widget/gtk/mozgtk/mozgtk.c	2021-04-23 14:19:34.228631957 +0200
@@ -644,6 +644,7 @@ STUB(gtk_color_chooser_get_type)
 STUB(gtk_color_chooser_set_rgba)
 STUB(gtk_color_chooser_get_rgba)
 STUB(gtk_color_chooser_set_use_alpha)
+STUB(gdk_wayland_device_get_wl_pointer)
 #endif
 
 #ifdef GTK2_SYMBOLS
bgstack15