File tree 1 file changed +20
-3
lines changed
1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -179,10 +179,27 @@ void switch_to_another_pc(
179
179
}
180
180
181
181
void switch_virtual_desktop_macos (device_t * state , int direction ) {
182
- /* Fix for MACOS: Send relative mouse movement here, one or two pixels in the
183
- direction of movement, BEFORE absolute report sets X to 0 */
182
+ /*
183
+ * Fix for MACOS: Before sending new absolute report setting X to 0:
184
+ * 1. Move the cursor to the edge of the screen directly in the middle to handle screens
185
+ * of different heights
186
+ * 2. Send relative mouse movement one or two pixels in the direction of movement to get
187
+ * the cursor onto the next screen
188
+ */
189
+ mouse_report_t edge_position = {
190
+ .x = (direction == LEFT ) ? MIN_SCREEN_COORD : MAX_SCREEN_COORD ,
191
+ .y = MAX_SCREEN_COORD / 2 ,
192
+ .mode = ABSOLUTE ,
193
+ .buttons = state -> mouse_buttons ,
194
+ };
195
+
184
196
uint16_t move = (direction == LEFT ) ? - MACOS_SWITCH_MOVE_X : MACOS_SWITCH_MOVE_X ;
185
- mouse_report_t move_relative_one = {.x = move , .mode = RELATIVE };
197
+ mouse_report_t move_relative_one = {
198
+ .x = move ,
199
+ .mode = RELATIVE ,
200
+ };
201
+
202
+ output_mouse_report (& edge_position , state );
186
203
187
204
/* Once doesn't seem reliable enough, do it a few times */
188
205
for (int i = 0 ; i < MACOS_SWITCH_MOVE_COUNT ; i ++ )
You can’t perform that action at this time.
0 commit comments