File tree Expand file tree Collapse file tree 1 file changed +20
-3
lines changed
Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -152,10 +152,27 @@ void switch_to_another_pc(
152152}
153153
154154void switch_virtual_desktop_macos (device_t * state , int direction ) {
155- /* Fix for MACOS: Send relative mouse movement here, one or two pixels in the
156- direction of movement, BEFORE absolute report sets X to 0 */
155+ /*
156+ * Fix for MACOS: Before sending new absolute report setting X to 0:
157+ * 1. Move the cursor to the edge of the screen directly in the middle to handle screens
158+ * of different heights
159+ * 2. Send relative mouse movement one or two pixels in the direction of movement to get
160+ * the cursor onto the next screen
161+ */
162+ mouse_report_t edge_position = {
163+ .x = (direction == LEFT ) ? MIN_SCREEN_COORD : MAX_SCREEN_COORD ,
164+ .y = MAX_SCREEN_COORD / 2 ,
165+ .mode = ABSOLUTE ,
166+ .buttons = state -> mouse_buttons ,
167+ };
168+
157169 uint16_t move = (direction == LEFT ) ? - MACOS_SWITCH_MOVE_X : MACOS_SWITCH_MOVE_X ;
158- mouse_report_t move_relative_one = {.x = move , .mode = RELATIVE };
170+ mouse_report_t move_relative_one = {
171+ .x = move ,
172+ .mode = RELATIVE ,
173+ };
174+
175+ output_mouse_report (& edge_position , state );
159176
160177 /* Once doesn't seem reliable enough, do it a few times */
161178 for (int i = 0 ; i < MACOS_SWITCH_MOVE_COUNT ; i ++ )
You can’t perform that action at this time.
0 commit comments