Skip to content

Commit f3a74c5

Browse files
author
Hrvoje Cavrak
committed
Refactoring some function names (#182)
1 parent d78bcd4 commit f3a74c5

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

src/handlers.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ void output_toggle_hotkey_handler(device_t *state, hid_keyboard_report_t *report
2828
return;
2929

3030
state->active_output ^= 1;
31-
switch_output(state, state->active_output);
31+
set_active_output(state, state->active_output);
3232
};
3333

3434
void _get_border_position(device_t *state, border_size_t *border) {
@@ -368,7 +368,7 @@ void handle_heartbeat_msg(uart_packet_t *packet, device_t *state) {
368368
* ==================================================== */
369369

370370
/* Update output variable, set LED on/off and notify the other board so they are in sync. */
371-
void switch_output(device_t *state, uint8_t new_output) {
371+
void set_active_output(device_t *state, uint8_t new_output) {
372372
state->active_output = new_output;
373373
restore_leds(state);
374374
send_value(new_output, OUTPUT_SELECT_MSG);

src/include/main.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ void handle_api_read_all_msg(uart_packet_t *, device_t *);
569569
void handle_toggle_gaming_msg(uart_packet_t *, device_t *);
570570
void handle_screensaver_msg(uart_packet_t *, device_t *);
571571

572-
void switch_output(device_t *, uint8_t);
572+
void set_active_output(device_t *, uint8_t);
573573

574574
/********* Global variables (don't judge) **********/
575575
extern device_t global_state;

src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ int main(void) {
4747
initial_setup(device);
4848

4949
// Initial state, A is the default output
50-
switch_output(device, OUTPUT_A);
50+
set_active_output(device, OUTPUT_A);
5151

5252
while (true) {
5353
for (int i = 0; i < NUM_TASKS; i++)

src/mouse.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ int16_t scale_y_coordinate(int screen_from, int screen_to, device_t *state) {
124124
return ((state->pointer_y - from->border.top) * MAX_SCREEN_COORD) / size_from;
125125
}
126126

127-
void switch_screen(
127+
void switch_to_another_pc(
128128
device_t *state, output_t *output, int output_to, int direction) {
129129
uint8_t *mouse_park_pos = &state->config.output[state->active_output].mouse_park_pos;
130130

@@ -135,12 +135,12 @@ void switch_screen(
135135
mouse_report_t hidden_pointer = {.y = mouse_y, .x = MAX_SCREEN_COORD};
136136

137137
output_mouse_report(&hidden_pointer, state);
138-
switch_output(state, output_to);
138+
set_active_output(state, output_to);
139139
state->pointer_x = (direction == LEFT) ? MAX_SCREEN_COORD : MIN_SCREEN_COORD;
140140
state->pointer_y = scale_y_coordinate(output->number, 1 - output->number, state);
141141
}
142142

143-
void switch_desktop_macos(device_t *state, int direction) {
143+
void switch_virtual_desktop_macos(device_t *state, int direction) {
144144
/* Fix for MACOS: Send relative mouse movement here, one or two pixels in the
145145
direction of movement, BEFORE absolute report sets X to 0 */
146146
uint16_t move = (direction == LEFT) ? -MACOS_SWITCH_MOVE_X : MACOS_SWITCH_MOVE_X;
@@ -151,10 +151,10 @@ void switch_desktop_macos(device_t *state, int direction) {
151151
output_mouse_report(&move_relative_one, state);
152152
}
153153

154-
void switch_desktop(device_t *state, output_t *output, int new_index, int direction) {
154+
void switch_virtual_desktop(device_t *state, output_t *output, int new_index, int direction) {
155155
switch (output->os) {
156156
case MACOS:
157-
switch_desktop_macos(state, direction);
157+
switch_virtual_desktop_macos(state, direction);
158158
break;
159159

160160
case WINDOWS:
@@ -206,16 +206,16 @@ void check_screen_switch(const mouse_values_t *values, device_t *state) {
206206
if (state->mouse_buttons)
207207
return;
208208

209-
switch_screen(state, output, 1 - state->active_output, direction);
209+
switch_to_another_pc(state, output, 1 - state->active_output, direction);
210210
}
211211
/* If here, this output has multiple desktops and we are not on the main one */
212212
else
213-
switch_desktop(state, output, output->screen_index - 1, direction);
213+
switch_virtual_desktop(state, output, output->screen_index - 1, direction);
214214
}
215215

216216
/* We want to jump away from the other computer, only possible if there is another screen to jump to */
217217
else if (output->screen_index < output->screen_count)
218-
switch_desktop(state, output, output->screen_index + 1, direction);
218+
switch_virtual_desktop(state, output, output->screen_index + 1, direction);
219219
}
220220

221221
void extract_report_values(uint8_t *raw_report, device_t *state, mouse_values_t *values, hid_interface_t *iface) {

0 commit comments

Comments
 (0)