File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -128,10 +128,25 @@ public bool Init(AvaloniaX11Platform platform)
128
128
var touchMinorAtom = XInternAtom ( _x11 . Display , "Abs MT Touch Minor" , false ) ;
129
129
130
130
var pressureAtom = XInternAtom ( _x11 . Display , "Abs MT Pressure" , false ) ;
131
- _pressureXIValuatorClassInfo = _pointerDevice . Valuators . FirstOrDefault ( t => t . Label == pressureAtom ) ;
132
131
133
- _touchMajorXIValuatorClassInfo = _pointerDevice . Valuators . FirstOrDefault ( t => t . Label == touchMajorAtom ) ;
134
- _touchMinorXIValuatorClassInfo = _pointerDevice . Valuators . FirstOrDefault ( t => t . Label == touchMinorAtom ) ;
132
+ var pressureXIValuatorClassInfo = _pointerDevice . Valuators . FirstOrDefault ( t => t . Label == pressureAtom ) ;
133
+ if ( pressureXIValuatorClassInfo . Label == pressureAtom )
134
+ {
135
+ // Why check twice? The XIValuatorClassInfo is struct, so the FirstOrDefault will return the default struct when not found.
136
+ _pressureXIValuatorClassInfo = pressureXIValuatorClassInfo ;
137
+ }
138
+
139
+ var touchMajorXIValuatorClassInfo = _pointerDevice . Valuators . FirstOrDefault ( t => t . Label == touchMajorAtom ) ;
140
+ if ( touchMajorXIValuatorClassInfo . Label == touchMajorAtom )
141
+ {
142
+ _touchMajorXIValuatorClassInfo = touchMajorXIValuatorClassInfo ;
143
+ }
144
+
145
+ var touchMinorXIValuatorClassInfo = _pointerDevice . Valuators . FirstOrDefault ( t => t . Label == touchMinorAtom ) ;
146
+ if ( touchMinorXIValuatorClassInfo . Label == touchMinorAtom )
147
+ {
148
+ _touchMinorXIValuatorClassInfo = touchMinorXIValuatorClassInfo ;
149
+ }
135
150
}
136
151
137
152
/*
You can’t perform that action at this time.
0 commit comments