@@ -1224,6 +1224,29 @@ xrdp_wm_clear_popup(struct xrdp_wm *self)
1224
1224
return 0 ;
1225
1225
}
1226
1226
1227
+ /*****************************************************************************/
1228
+ int
1229
+ xrdp_wm_mouse_touch (struct xrdp_wm * self , int gesture , int param )
1230
+ {
1231
+ LOG (LOG_LEVEL_DEBUG , "mouse touch event gesture %d param %d" , gesture , param );
1232
+
1233
+ switch (gesture )
1234
+ {
1235
+ case TOUCH_TWO_FINGERS_UP :
1236
+ case TOUCH_TWO_FINGERS_DOWN :
1237
+ self -> mm -> mod -> mod_event (self -> mm -> mod , WM_TOUCH_VSCROLL ,
1238
+ self -> mouse_x , self -> mouse_y , param , 0 );
1239
+ break ;
1240
+ case TOUCH_TWO_FINGERS_RIGHT :
1241
+ case TOUCH_TWO_FINGERS_LEFT :
1242
+ self -> mm -> mod -> mod_event (self -> mm -> mod , WM_TOUCH_HSCROLL ,
1243
+ self -> mouse_x , self -> mouse_y , param , 0 );
1244
+ break ;
1245
+ }
1246
+
1247
+ return 0 ;
1248
+ }
1249
+
1227
1250
/*****************************************************************************/
1228
1251
int
1229
1252
xrdp_wm_mouse_click (struct xrdp_wm * self , int x , int y , int but , int down )
@@ -1769,13 +1792,41 @@ xrdp_wm_process_input_mouse(struct xrdp_wm *self, int device_flags,
1769
1792
/* vertical mouse wheel */
1770
1793
if (device_flags & PTRFLAGS_WHEEL )
1771
1794
{
1795
+ int delta = 0 ;
1772
1796
if (device_flags & PTRFLAGS_WHEEL_NEGATIVE )
1773
1797
{
1774
- xrdp_wm_mouse_click (self , 0 , 0 , 5 , 0 );
1798
+ /**
1799
+ * [MS-RDPBCGR] 2.2.8.1.1.3.1.1.3 Mouse Event (TS_POINTER_EVENT)
1800
+ * In negative scrolling, rotation distance is negative and the delta
1801
+ * is represented by the lowest byte.
1802
+ * Examples:
1803
+ * device_flags = 0x020a, positive vertical scrolling, distance 10
1804
+ * device_flags = 0x03f6, negative vertical scrolling, distance -10
1805
+ *
1806
+ * The negative number is represented by complement.
1807
+ */
1808
+ delta = (device_flags & WheelRotationMask ) | ~WheelRotationMask ;
1809
+ if (delta != 0 )
1810
+ {
1811
+ // Use nature scrolling, up direction is negative.
1812
+ xrdp_wm_mouse_touch (self , TOUCH_TWO_FINGERS_UP , delta );
1813
+ }
1814
+ else
1815
+ {
1816
+ xrdp_wm_mouse_click (self , 0 , 0 , 5 , 0 );
1817
+ }
1775
1818
}
1776
1819
else
1777
1820
{
1778
- xrdp_wm_mouse_click (self , 0 , 0 , 4 , 0 );
1821
+ delta = device_flags & WheelRotationMask ;
1822
+ if (delta != 0 )
1823
+ {
1824
+ xrdp_wm_mouse_touch (self , TOUCH_TWO_FINGERS_DOWN , delta );
1825
+ }
1826
+ else
1827
+ {
1828
+ xrdp_wm_mouse_click (self , 0 , 0 , 4 , 0 );
1829
+ }
1779
1830
}
1780
1831
}
1781
1832
@@ -1787,13 +1838,41 @@ xrdp_wm_process_input_mouse(struct xrdp_wm *self, int device_flags,
1787
1838
*/
1788
1839
if (device_flags & PTRFLAGS_HWHEEL )
1789
1840
{
1841
+ int delta = 0 ;
1790
1842
if (device_flags & PTRFLAGS_WHEEL_NEGATIVE )
1791
1843
{
1792
- xrdp_wm_mouse_click (self , 0 , 0 , 6 , 0 );
1844
+ /**
1845
+ * [MS-RDPBCGR] 2.2.8.1.1.3.1.1.3 Mouse Event (TS_POINTER_EVENT)
1846
+ * In negative scrolling, rotation distance is negative and the delta
1847
+ * is represented by the lowest byte.
1848
+ * Examples:
1849
+ * device_flags = 0x040a, positive horizontal scrolling, distance 10
1850
+ * device_flags = 0x05f6, negative horizontal scrolling, distance -10
1851
+ *
1852
+ * The negative number is represented by complement.
1853
+ */
1854
+ delta = (device_flags & WheelRotationMask ) | ~WheelRotationMask ;
1855
+ if (delta != 0 )
1856
+ {
1857
+ // Use nature scrolling, right direction is negative.
1858
+ xrdp_wm_mouse_touch (self , TOUCH_TWO_FINGERS_RIGHT , delta );
1859
+ }
1860
+ else
1861
+ {
1862
+ xrdp_wm_mouse_click (self , 0 , 0 , 6 , 0 );
1863
+ }
1793
1864
}
1794
1865
else
1795
1866
{
1796
- xrdp_wm_mouse_click (self , 0 , 0 , 7 , 0 );
1867
+ delta = device_flags & WheelRotationMask ;
1868
+ if (delta != 0 )
1869
+ {
1870
+ xrdp_wm_mouse_touch (self , TOUCH_TWO_FINGERS_LEFT , delta );
1871
+ }
1872
+ else
1873
+ {
1874
+ xrdp_wm_mouse_click (self , 0 , 0 , 7 , 0 );
1875
+ }
1797
1876
}
1798
1877
}
1799
1878
0 commit comments