glfw / glfw

A multi-platform library for OpenGL, OpenGL ES, Vulkan, window and input
https://www.glfw.org
zlib License
12.76k stars 5.12k forks source link

Disabled cursor mode doesn't work right when connected over RDP #1276

Closed Pokechu22 closed 6 months ago

Pokechu22 commented 6 years ago

OS and version: Windows 10 64-bit Release or commit: Tested both 617a322bd88c1b27f1fd7d05dc3723b6c5461a68 and the version comes with LWJGL 3.1.2 (2f5e2303380d084ab9b097765d34f98504324d65 it seems)

When connected over RDP, disabled cursor input doesn't work correctly; the cursor goes far off the screen (causing rapid rotation if mouse input is being used for that -- e.g. the wave example program). (This was originally reported as MC-126875).

To reproduce:

  1. Set up and build the cursor test. Enable RDP connections to your machine.
  2. Connect to a machine from another machine, and start the cursor test.
  3. Press T to enable tracking of the cursor.
  4. Move the cursor around some. Note that everything is fine.
  5. Press D to switch to disabled cursor move.
  6. Move the cursor. The tracking lines should disappear and the cursor's position in the logs will be said to be far off the screen.

This doesn't happen when connected locally.

Here's the output provided by the program:
Cursor position: 755.000000 574.000000
2.621: Cursor position: 527.000000 479.000000 (-228.000000 -95.000000)
2.636: Cursor position: 391.000000 439.000000 (-136.000000 -40.000000)
2.651: Cursor position: 312.000000 402.000000 (-79.000000 -37.000000)
2.668: Cursor position: 298.000000 384.000000 (-14.000000 -18.000000)
2.682: Cursor position: 290.000000 359.000000 (-8.000000 -25.000000)
2.691: Cursor position: 287.000000 345.000000 (-3.000000 -14.000000)
2.707: Cursor position: 276.000000 309.000000 (-11.000000 -36.000000)
2.722: Cursor position: 261.000000 278.000000 (-15.000000 -31.000000)
2.739: Cursor position: 253.000000 257.000000 (-8.000000 -21.000000)
2.754: Cursor position: 249.000000 238.000000 (-4.000000 -19.000000)
2.771: Cursor position: 249.000000 225.000000 (+0.000000 -13.000000)
2.788: Cursor position: 249.000000 214.000000 (+0.000000 -11.000000)
2.804: Cursor position: 250.000000 206.000000 (+1.000000 -8.000000)
2.819: Cursor position: 253.000000 203.000000 (+3.000000 -3.000000)
2.826: Cursor position: 253.000000 202.000000 (+0.000000 -1.000000)
2.843: Cursor position: 253.000000 200.000000 (+0.000000 -2.000000)
2.859: Cursor position: 254.000000 197.000000 (+1.000000 -3.000000)
2.875: Cursor position: 255.000000 193.000000 (+1.000000 -4.000000)
2.890: Cursor position: 255.000000 189.000000 (+0.000000 -4.000000)
2.907: Cursor position: 256.000000 186.000000 (+1.000000 -3.000000)
3.421: Cursor position: 257.000000 185.000000 (+1.000000 -1.000000)
3.507: Cursor position: 257.000000 181.000000 (+0.000000 -4.000000)
3.515: Cursor position: 257.000000 170.000000 (+0.000000 -11.000000)
3.531: Cursor position: 256.000000 151.000000 (-1.000000 -19.000000)
3.547: Cursor position: 249.000000 136.000000 (-7.000000 -15.000000)
3.563: Cursor position: 243.000000 121.000000 (-6.000000 -15.000000)
3.579: Cursor position: 236.000000 107.000000 (-7.000000 -14.000000)
3.603: Cursor position: 231.000000 93.000000 (-5.000000 -14.000000)
3.621: Cursor position: 230.000000 88.000000 (-1.000000 -5.000000)
3.635: Cursor position: 229.000000 84.000000 (-1.000000 -4.000000)
3.653: Cursor position: 229.000000 80.000000 (+0.000000 -4.000000)
3.668: Cursor position: 229.000000 77.000000 (+0.000000 -3.000000)
3.683: Cursor position: 229.000000 73.000000 (+0.000000 -4.000000)
3.699: Cursor position: 229.000000 69.000000 (+0.000000 -4.000000)
3.707: Cursor position: 229.000000 67.000000 (+0.000000 -2.000000)
3.722: Cursor position: 229.000000 64.000000 (+0.000000 -3.000000)
3.747: Cursor position: 229.000000 61.000000 (+0.000000 -3.000000)
3.763: Cursor position: 228.000000 58.000000 (-1.000000 -3.000000)
3.771: Cursor position: 227.000000 57.000000 (-1.000000 -1.000000)
3.786: Cursor position: 227.000000 52.000000 (+0.000000 -5.000000)
3.811: Cursor position: 226.000000 49.000000 (-1.000000 -3.000000)
3.819: Cursor position: 226.000000 48.000000 (+0.000000 -1.000000)
3.851: Cursor position: 226.000000 46.000000 (+0.000000 -2.000000)
3.866: Cursor position: 226.000000 44.000000 (+0.000000 -2.000000)
3.883: Cursor position: 225.000000 40.000000 (-1.000000 -4.000000)
3.899: Cursor position: 221.000000 37.000000 (-4.000000 -3.000000)
3.915: Cursor position: 218.000000 33.000000 (-3.000000 -4.000000)
3.931: Cursor position: 217.000000 31.000000 (-1.000000 -2.000000)
3.947: Cursor position: 215.000000 27.000000 (-2.000000 -4.000000)
3.963: Cursor position: 214.000000 25.000000 (-1.000000 -2.000000)
3.978: Cursor position: 213.000000 22.000000 (-1.000000 -3.000000)
3.994: Cursor position: 210.000000 18.000000 (-3.000000 -4.000000)
4.011: Cursor position: 206.000000 13.000000 (-4.000000 -5.000000)
4.027: Cursor position: 202.000000 8.000000 (-4.000000 -5.000000)
4.035: Cursor position: 201.000000 7.000000 (-1.000000 -1.000000)
4.054: Cursor position: 198.000000 6.000000 (-3.000000 -1.000000)
4.068: Cursor position: 195.000000 4.000000 (-3.000000 -2.000000)
4.083: Cursor position: 194.000000 4.000000 (-1.000000 +0.000000)
4.099: Cursor position: 194.000000 3.000000 (+0.000000 -1.000000)
4.276: Cursor position: 192.000000 2.000000 (-2.000000 -1.000000)
6.123: Cursor position: 192.000000 5.000000 (+0.000000 +3.000000)
6.139: Cursor position: 192.000000 13.000000 (+0.000000 +8.000000)
6.155: Cursor position: 194.000000 24.000000 (+2.000000 +11.000000)
6.171: Cursor position: 198.000000 37.000000 (+4.000000 +13.000000)
6.187: Cursor position: 203.000000 46.000000 (+5.000000 +9.000000)
6.203: Cursor position: 207.000000 55.000000 (+4.000000 +9.000000)
6.218: Cursor position: 210.000000 64.000000 (+3.000000 +9.000000)
6.235: Cursor position: 214.000000 73.000000 (+4.000000 +9.000000)
6.253: Cursor position: 219.000000 84.000000 (+5.000000 +11.000000)
6.267: Cursor position: 222.000000 91.000000 (+3.000000 +7.000000)
6.283: Cursor position: 223.000000 96.000000 (+1.000000 +5.000000)
6.300: Cursor position: 225.000000 102.000000 (+2.000000 +6.000000)
6.315: Cursor position: 226.000000 106.000000 (+1.000000 +4.000000)
6.331: Cursor position: 227.000000 113.000000 (+1.000000 +7.000000)
6.348: Cursor position: 228.000000 122.000000 (+1.000000 +9.000000)
6.363: Cursor position: 229.000000 128.000000 (+1.000000 +6.000000)
6.379: Cursor position: 230.000000 134.000000 (+1.000000 +6.000000)
6.396: Cursor position: 231.000000 141.000000 (+1.000000 +7.000000)
6.411: Cursor position: 231.000000 146.000000 (+0.000000 +5.000000)
6.425: Cursor position: 231.000000 149.000000 (+0.000000 +3.000000)
6.443: Cursor position: 231.000000 160.000000 (+0.000000 +11.000000)
6.458: Cursor position: 231.000000 171.000000 (+0.000000 +11.000000)
6.474: Cursor position: 231.000000 179.000000 (+0.000000 +8.000000)
6.490: Cursor position: 231.000000 187.000000 (+0.000000 +8.000000)
6.507: Cursor position: 230.000000 200.000000 (-1.000000 +13.000000)
6.523: Cursor position: 225.000000 211.000000 (-5.000000 +11.000000)
6.539: Cursor position: 224.000000 215.000000 (-1.000000 +4.000000)
6.555: Cursor position: 223.000000 222.000000 (-1.000000 +7.000000)
6.570: Cursor position: 220.000000 230.000000 (-3.000000 +8.000000)
6.587: Cursor position: 220.000000 234.000000 (+0.000000 +4.000000)
6.603: Cursor position: 219.000000 237.000000 (-1.000000 +3.000000)
6.619: Cursor position: 219.000000 241.000000 (+0.000000 +4.000000)
6.636: Cursor position: 219.000000 243.000000 (+0.000000 +2.000000)
6.654: Cursor position: 218.000000 244.000000 (-1.000000 +1.000000)
6.666: Cursor position: 217.000000 244.000000 (-1.000000 +0.000000)
8.587: Cursor position: 218.000000 244.000000 (+1.000000 +0.000000)
8.603: Cursor position: 218.000000 241.000000 (+0.000000 -3.000000)
8.618: Cursor position: 220.000000 238.000000 (+2.000000 -3.000000)
8.635: Cursor position: 221.000000 236.000000 (+1.000000 -2.000000)
8.651: Cursor position: 223.000000 233.000000 (+2.000000 -3.000000)
8.659: Cursor position: 223.000000 232.000000 (+0.000000 -1.000000)
8.682: Cursor position: 225.000000 229.000000 (+2.000000 -3.000000)
8.691: Cursor position: 226.000000 227.000000 (+1.000000 -2.000000)
8.710: Cursor position: 227.000000 227.000000 (+1.000000 +0.000000)
8.725: Cursor position: 228.000000 223.000000 (+1.000000 -4.000000)
8.739: Cursor position: 228.000000 218.000000 (+0.000000 -5.000000)
8.755: Cursor position: 228.000000 212.000000 (+0.000000 -6.000000)
8.770: Cursor position: 228.000000 206.000000 (+0.000000 -6.000000)
8.786: Cursor position: 228.000000 198.000000 (+0.000000 -8.000000)
8.803: Cursor position: 228.000000 193.000000 (+0.000000 -5.000000)
8.818: Cursor position: 228.000000 187.000000 (+0.000000 -6.000000)
8.834: Cursor position: 226.000000 182.000000 (-2.000000 -5.000000)
8.851: Cursor position: 226.000000 179.000000 (+0.000000 -3.000000)
8.891: Cursor position: 225.000000 178.000000 (-1.000000 -1.000000)
8.915: Cursor position: 224.000000 178.000000 (-1.000000 +0.000000)
8.931: Cursor position: 224.000000 177.000000 (+0.000000 -1.000000)
8.955: Cursor position: 223.000000 176.000000 (-1.000000 -1.000000)
8.978: Cursor position: 220.000000 175.000000 (-3.000000 -1.000000)
8.986: Cursor position: 219.000000 175.000000 (-1.000000 +0.000000)
9.002: Cursor position: 214.000000 174.000000 (-5.000000 -1.000000)
9.019: Cursor position: 205.000000 171.000000 (-9.000000 -3.000000)
9.034: Cursor position: 195.000000 170.000000 (-10.000000 -1.000000)
9.051: Cursor position: 186.000000 169.000000 (-9.000000 -1.000000)
9.069: Cursor position: 175.000000 167.000000 (-11.000000 -2.000000)
9.082: Cursor position: 164.000000 166.000000 (-11.000000 -1.000000)
9.099: Cursor position: 156.000000 165.000000 (-8.000000 -1.000000)
9.115: Cursor position: 151.000000 163.000000 (-5.000000 -2.000000)
9.131: Cursor position: 148.000000 163.000000 (-3.000000 +0.000000)
9.147: Cursor position: 145.000000 162.000000 (-3.000000 -1.000000)
9.162: Cursor position: 142.000000 161.000000 (-3.000000 -1.000000)
9.187: Cursor position: 138.000000 159.000000 (-4.000000 -2.000000)
9.203: Cursor position: 134.000000 159.000000 (-4.000000 +0.000000)
9.218: Cursor position: 130.000000 156.000000 (-4.000000 -3.000000)
9.235: Cursor position: 126.000000 155.000000 (-4.000000 -1.000000)
9.251: Cursor position: 122.000000 153.000000 (-4.000000 -2.000000)
9.267: Cursor position: 118.000000 151.000000 (-4.000000 -2.000000)
9.283: Cursor position: 113.000000 149.000000 (-5.000000 -2.000000)
9.299: Cursor position: 110.000000 147.000000 (-3.000000 -2.000000)
9.318: Cursor position: 107.000000 145.000000 (-3.000000 -2.000000)
9.331: Cursor position: 106.000000 143.000000 (-1.000000 -2.000000)
9.346: Cursor position: 104.000000 141.000000 (-2.000000 -2.000000)
9.363: Cursor position: 102.000000 140.000000 (-2.000000 -1.000000)
9.379: Cursor position: 101.000000 139.000000 (-1.000000 -1.000000)
9.394: Cursor position: 100.000000 138.000000 (-1.000000 -1.000000)
9.422: Cursor position: 99.000000 137.000000 (-1.000000 -1.000000)
(( cursor is disabled ))
11.698: Cursor position: 45534.000000 29852.000000 (+45435.000000 +29715.000000)
11.722: Cursor position: 91072.000000 59676.000000 (+45538.000000 +29824.000000)
11.730: Cursor position: 136644.000000 89500.000000 (+45572.000000 +29824.000000)
11.762: Cursor position: 182250.000000 119379.000000 (+45606.000000 +29879.000000)
11.866: Cursor position: 227856.000000 149312.000000 (+45606.000000 +29933.000000)
11.891: Cursor position: 273496.000000 179300.000000 (+45640.000000 +29988.000000)
11.914: Cursor position: 319170.000000 209288.000000 (+45674.000000 +29988.000000)
11.938: Cursor position: 364844.000000 239385.000000 (+45674.000000 +30097.000000)
11.946: Cursor position: 410552.000000 269537.000000 (+45708.000000 +30152.000000)
11.962: Cursor position: 456294.000000 299689.000000 (+45742.000000 +30152.000000)
11.986: Cursor position: 502036.000000 329895.000000 (+45742.000000 +30206.000000)
12.003: Cursor position: 547847.000000 360211.000000 (+45811.000000 +30316.000000)
12.178: Cursor position: 593692.000000 390636.000000 (+45845.000000 +30425.000000)
12.234: Cursor position: 639537.000000 421116.000000 (+45845.000000 +30480.000000)
12.362: Cursor position: 685416.000000 451596.000000 (+45879.000000 +30480.000000)
12.378: Cursor position: 731329.000000 482076.000000 (+45913.000000 +30480.000000)
12.418: Cursor position: 777276.000000 512556.000000 (+45947.000000 +30480.000000)
12.431: Cursor position: 823223.000000 543090.000000 (+45947.000000 +30534.000000)
12.483: Cursor position: 869239.000000 573624.000000 (+46016.000000 +30534.000000)
12.554: Cursor position: 915289.000000 604213.000000 (+46050.000000 +30589.000000)
12.883: Cursor position: 961373.000000 634856.000000 (+46084.000000 +30643.000000)
12.915: Cursor position: 1007491.000000 665499.000000 (+46118.000000 +30643.000000)
12.971: Cursor position: 1053643.000000 696142.000000 (+46152.000000 +30643.000000)
12.994: Cursor position: 1099829.000000 726785.000000 (+46186.000000 +30643.000000)
13.026: Cursor position: 1146015.000000 757483.000000 (+46186.000000 +30698.000000)
13.178: Cursor position: 1192235.000000 788181.000000 (+46220.000000 +30698.000000)
13.475: Cursor position: 1238489.000000 818879.000000 (+46254.000000 +30698.000000)
13.962: Cursor position: 1284778.000000 849577.000000 (+46289.000000 +30698.000000)
13.987: Cursor position: 1331135.000000 880330.000000 (+46357.000000 +30753.000000)
14.035: Cursor position: 1377526.000000 911083.000000 (+46391.000000 +30753.000000)
14.082: Cursor position: 1423951.000000 941890.000000 (+46425.000000 +30807.000000)
14.122: Cursor position: 1470444.000000 972697.000000 (+46493.000000 +30807.000000)
14.146: Cursor position: 1516972.000000 1003559.000000 (+46528.000000 +30862.000000)
14.202: Cursor position: 1563534.000000 1034421.000000 (+46562.000000 +30862.000000)
14.219: Cursor position: 1610130.000000 1065337.000000 (+46596.000000 +30916.000000)
14.266: Cursor position: 1656760.000000 1096308.000000 (+46630.000000 +30971.000000)
14.450: Cursor position: 1703390.000000 1127334.000000 (+46630.000000 +31026.000000)
14.482: Cursor position: 1750054.000000 1158414.000000 (+46664.000000 +31080.000000)
(( cursor is normal ))
15.404: Cursor position: 99.000000 137.000000 (-1749955.000000 -1158277.000000)
16.522: Cursor position: 136.000000 163.000000 (+37.000000 +26.000000)
16.538: Cursor position: 136.000000 166.000000 (+0.000000 +3.000000)
16.555: Cursor position: 136.000000 169.000000 (+0.000000 +3.000000)
16.563: Cursor position: 137.000000 173.000000 (+1.000000 +4.000000)
16.579: Cursor position: 138.000000 175.000000 (+1.000000 +2.000000)
16.594: Cursor position: 139.000000 179.000000 (+1.000000 +4.000000)
16.611: Cursor position: 139.000000 181.000000 (+0.000000 +2.000000)
16.634: Cursor position: 141.000000 183.000000 (+2.000000 +2.000000)
16.642: Cursor position: 141.000000 184.000000 (+0.000000 +1.000000)
16.660: Cursor position: 142.000000 186.000000 (+1.000000 +2.000000)
16.682: Cursor position: 145.000000 190.000000 (+3.000000 +4.000000)
16.710: Cursor position: 146.000000 191.000000 (+1.000000 +1.000000)
16.722: Cursor position: 147.000000 193.000000 (+1.000000 +2.000000)
16.738: Cursor position: 148.000000 193.000000 (+1.000000 +0.000000)
16.756: Cursor position: 150.000000 195.000000 (+2.000000 +2.000000)
16.770: Cursor position: 154.000000 197.000000 (+4.000000 +2.000000)
16.787: Cursor position: 156.000000 198.000000 (+2.000000 +1.000000)
16.802: Cursor position: 159.000000 199.000000 (+3.000000 +1.000000)
17.099: Cursor position: 161.000000 199.000000 (+2.000000 +0.000000)
17.114: Cursor position: 162.000000 198.000000 (+1.000000 -1.000000)
17.139: Cursor position: 162.000000 197.000000 (+0.000000 -1.000000)
17.147: Cursor position: 162.000000 196.000000 (+0.000000 -1.000000)
17.163: Cursor position: 162.000000 195.000000 (+0.000000 -1.000000)
17.195: Cursor position: 162.000000 193.000000 (+0.000000 -2.000000)
21.163: Cursor position: 163.000000 193.000000 (+1.000000 +0.000000)
21.258: Cursor position: 164.000000 193.000000 (+1.000000 +0.000000)
21.402: Cursor position: 165.000000 194.000000 (+1.000000 +1.000000)
21.436: Cursor position: 166.000000 194.000000 (+1.000000 +0.000000)
21.458: Cursor position: 166.000000 195.000000 (+0.000000 +1.000000)
21.467: Cursor position: 167.000000 195.000000 (+1.000000 +0.000000)
21.483: Cursor position: 167.000000 196.000000 (+0.000000 +1.000000)
21.546: Cursor position: 168.000000 197.000000 (+1.000000 +1.000000)
21.571: Cursor position: 168.000000 199.000000 (+0.000000 +2.000000)
21.603: Cursor position: 169.000000 200.000000 (+1.000000 +1.000000)
21.643: Cursor position: 169.000000 201.000000 (+0.000000 +1.000000)
21.675: Cursor position: 169.000000 202.000000 (+0.000000 +1.000000)
21.699: Cursor position: 169.000000 203.000000 (+0.000000 +1.000000)
21.706: Cursor position: 170.000000 204.000000 (+1.000000 +1.000000)
21.731: Cursor position: 170.000000 205.000000 (+0.000000 +1.000000)
21.739: Cursor position: 170.000000 206.000000 (+0.000000 +1.000000)
21.769: Cursor position: 170.000000 207.000000 (+0.000000 +1.000000)
21.779: Cursor position: 170.000000 208.000000 (+0.000000 +1.000000)
21.795: Cursor position: 170.000000 210.000000 (+0.000000 +2.000000)
21.811: Cursor position: 170.000000 212.000000 (+0.000000 +2.000000)
21.835: Cursor position: 170.000000 214.000000 (+0.000000 +2.000000)
21.842: Cursor position: 170.000000 215.000000 (+0.000000 +1.000000)
21.867: Cursor position: 170.000000 217.000000 (+0.000000 +2.000000)
21.875: Cursor position: 170.000000 218.000000 (+0.000000 +1.000000)
21.915: Cursor position: 170.000000 220.000000 (+0.000000 +2.000000)
22.698: Cursor position: 169.000000 220.000000 (-1.000000 +0.000000)
22.715: Cursor position: 168.000000 220.000000 (-1.000000 +0.000000)
22.748: Cursor position: 167.000000 220.000000 (-1.000000 +0.000000)
22.779: Cursor position: 166.000000 220.000000 (-1.000000 +0.000000)
22.826: Cursor position: 165.000000 220.000000 (-1.000000 +0.000000)
22.842: Cursor position: 164.000000 219.000000 (-1.000000 -1.000000)
22.874: Cursor position: 163.000000 219.000000 (-1.000000 +0.000000)
22.890: Cursor position: 161.000000 218.000000 (-2.000000 -1.000000)
22.923: Cursor position: 160.000000 216.000000 (-1.000000 -2.000000)
22.955: Cursor position: 158.000000 216.000000 (-2.000000 +0.000000)
22.970: Cursor position: 157.000000 215.000000 (-1.000000 -1.000000)
22.987: Cursor position: 156.000000 214.000000 (-1.000000 -1.000000)
23.010: Cursor position: 153.000000 212.000000 (-3.000000 -2.000000)
23.058: Cursor position: 152.000000 212.000000 (-1.000000 +0.000000)
23.226: Cursor position: 148.000000 209.000000 (-4.000000 -3.000000)
23.235: Cursor position: 146.000000 206.000000 (-2.000000 -3.000000)
23.250: Cursor position: 136.000000 198.000000 (-10.000000 -8.000000)
23.267: Cursor position: 127.000000 192.000000 (-9.000000 -6.000000)
23.283: Cursor position: 117.000000 184.000000 (-10.000000 -8.000000)
23.299: Cursor position: 108.000000 178.000000 (-9.000000 -6.000000)
23.315: Cursor position: 95.000000 171.000000 (-13.000000 -7.000000)
23.331: Cursor position: 82.000000 165.000000 (-13.000000 -6.000000)
23.347: Cursor position: 66.000000 159.000000 (-16.000000 -6.000000)
23.362: Cursor position: 45.000000 155.000000 (-21.000000 -4.000000)
23.378: Cursor position: 26.000000 153.000000 (-19.000000 -2.000000)
23.395: Cursor position: 11.000000 152.000000 (-15.000000 -1.000000)


I did do some debug logging of what the raw WM_INPUT event looked like. On my local machine, the flags value is 0 and the positions are 0 4 or similar. However, when connected via RDP, the flags value is 3 and positions are very large (e.g. 9984 12588). 3 is MOUSE_MOVE_ABSOLUTE | MOUSE_VIRTUAL_DESKTOP per the documentation on the RAWMOUSE structure, but unfortunately it doesn't explain how MOUSE_VIRTUAL_DESKTOP is supposed to be handled.

I have found some other sources though. This StackOverflow post gives an example of what works for them (but the author admits that it's not from any documentation). I also found Microsoft/DirectXTK@ef56b63f3739381e451f7a5a5bd2c9779d2a7555 which seems to be a case of them fixing the same issue. However, I haven't had time to experiment with this yet (if I do get it working, I'll try to submit a pull request).

Pokechu22 commented 6 years ago

After some further testing, there are two issues. One is that MOUSE_VIRTUAL_DESKTOP is weird, but that's not all. I've implemented the same thing from the DirectXTK commit (Pokechu22@92380fa), but that doesn't actually work right. The cursor moves fine for a bit, but when it gets to the edge of the monitor, it stops.

It seems that SetCursorPos doesn't work right when the cursor is hidden via SetCursor(NULL), so the re-centering logic isn't working. I've verified that by adding another key to the cursor test (this is not in the previously linked commit):

        case GLFW_KEY_M:
        {
            int width, height;
            glfwGetWindowSize(window, &width, &height);
            glfwSetCursorPos(window, width / 2, height / 2);
            break;
        }

When the cursor is visible, it moves back to the center and moving it around starts from the center. However, when it is hidden (not disabled), the tracking lines move to the center but the actual cursor does not. I suspect that this is a special behavior for the NULL cursor, and will try using an invisible custom cursor instead.

LiliumAtratum commented 3 years ago

Hey, is it still being worked on? I tired using the master branch version of glfw and the problem is still there! As my software is used over RDP a lot (Chrome Remote Desktop shows similar problem) this is a big bummer! It seems as if my absolute mouse position was mapped the values dx and dy instead of x and y. When I rotate my 3D camera that is controlled by the disabled cursor, I keeps spinning faster and faster. The problem is not as extreme when I start from the middle of the screen, but the behavior is still erroneous there.

Pokechu22 commented 3 years ago

I haven't worked with RDP in several years. However, the changes in #1279 may still be relevant.

Note that the behavior of a NULL cursor causing cursor position updates to not be sent is possibly specific to Windows' Remote Desktop Connection, and Chrome Remote Desktop might have a different behavior (or might not support cursor position updates at all).

LiliumAtratum commented 3 years ago

What I found is that setting cursor position does not work at all with RDP, regardless of the cursor mode. When beginning dragging (left mouse click) I did the following:

The setting of cursor position simply didn't work. The 3D camera was rotating faster when moving away from the initial drag point and slower when the mouse pointer was returning to it (some space simulator games come to mind)

I found that glfw does similar thing under the hood when using the disabled cursor, but it is comparing against virtual mouse position that does not match the initial mouse position and so the numbers get huge really fast.

Pokechu22 commented 3 years ago

I don't have anything set up to test anymore, but both "The setting of cursor position simply didn't work" and "but it is comparing against virtual mouse position that does not match the initial mouse position" sound like things I fixed in #1279, so it may be useful to try to rebuild that.

flriancu commented 2 years ago

Hi @Pokechu22 , @elmindreda ,

Are there any plans to update this issue going forward? The latest master (56a4cb0) still seems to have this behavior over RDP.

I tried integrating the changes from PR #1279 into the above commit, but it seems I'm missing something as I could not get it working.

Thank you!

dougbinks commented 7 months ago

I have replicated this issue with RDP, but I have also discovered that it also appears when using a VM - in particular I tested with Windows 8 x64 Pro with VMWare Player and this issue was present.

dougbinks commented 7 months ago

After some experimentation the VM issue appears to be a different problem with a very similar effect. The main differences are that the solution #2431 doesn't fix the issue, and if the cursor is held stationary for a while after switching to disabled cursor it behaves as expected - so it's likely this is a separate issue potentially due to a delayed mouse message appearing to cause a large virtual position change (I will investigate this later).