Skip to content

Commit 8b99499

Browse files
author
Hrvoje Cavrak
committed
DeskHop v0.65
- Fixed bug with gaming mode
1 parent f08d305 commit 8b99499

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.6)
22

33
set(VERSION_MAJOR 00)
4-
set(VERSION_MINOR 157)
4+
set(VERSION_MINOR 158)
55

66
set(PICO_SDK_FETCH_FROM_GIT off)
77
set(PICO_BOARD=pico)

src/handlers.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ void switchlock_hotkey_handler(device_t *state, hid_keyboard_report_t *report) {
6868
}
6969

7070
/* This key combo toggles gaming mode */
71-
void toggle_relative_mode_handler(device_t *state, hid_keyboard_report_t *report) {
72-
state->relative_mouse ^= 1;
73-
send_value(state->relative_mouse, RELATIVE_MODE_MSG);
71+
void toggle_gaming_mode_handler(device_t *state, hid_keyboard_report_t *report) {
72+
state->gaming_mode ^= 1;
73+
send_value(state->gaming_mode, GAMING_MODE_MSG);
7474
};
7575

7676
/* This key combo locks both outputs simultaneously */
@@ -229,9 +229,9 @@ void handle_proxy_msg(uart_packet_t *packet, device_t *state) {
229229
queue_packet(&packet->data[1], (enum packet_type_e)packet->data[0], PACKET_DATA_LENGTH - 1);
230230
}
231231

232-
/* Process request to reboot the board */
233-
void handle_toggle_relative_msg(uart_packet_t *packet, device_t *state) {
234-
state->relative_mouse = packet->data[0];
232+
/* Process relative mouse command */
233+
void handle_toggle_gaming_msg(uart_packet_t *packet, device_t *state) {
234+
state->gaming_mode = packet->data[0];
235235
}
236236

237237
/* Process api communication messages */

src/include/main.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ enum packet_type_e {
124124
FLASH_LED_MSG = 9,
125125
WIPE_CONFIG_MSG = 10,
126126
HEARTBEAT_MSG = 12,
127-
RELATIVE_MODE_MSG = 13,
127+
GAMING_MODE_MSG = 13,
128128
CONSUMER_CONTROL_MSG = 14,
129129
SYSTEM_CONTROL_MSG = 15,
130130
SAVE_CONFIG_MSG = 18,
@@ -185,7 +185,6 @@ typedef struct {
185185
/********* Screen **********/
186186
#define MIN_SCREEN_COORD 0
187187
#define MAX_SCREEN_COORD 32767
188-
#define SCREEN_MIDPOINT 16384
189188

190189
/********* Configuration storage definitions **********/
191190

@@ -424,6 +423,7 @@ typedef struct {
424423
bool switch_lock; // True when device is prevented from switching
425424
bool onboard_led_state; // True when LED is ON
426425
bool relative_mouse; // True when relative mouse mode is used
426+
bool gaming_mode; // True when gaming mode is on (relative passthru + lock)
427427
bool config_mode_active; // True when config mode is active
428428
bool digitizer_active; // True when digitizer Win/Mac workaround is active
429429

@@ -534,7 +534,7 @@ void fw_upgrade_hotkey_handler_B(device_t *, hid_keyboard_report_t *);
534534
void mouse_zoom_hotkey_handler(device_t *, hid_keyboard_report_t *);
535535
void all_keys_released_handler(device_t *);
536536
void switchlock_hotkey_handler(device_t *, hid_keyboard_report_t *);
537-
void toggle_relative_mode_handler(device_t *, hid_keyboard_report_t *);
537+
void toggle_gaming_mode_handler(device_t *, hid_keyboard_report_t *);
538538
void screenlock_hotkey_handler(device_t *, hid_keyboard_report_t *);
539539
void output_config_hotkey_handler(device_t *, hid_keyboard_report_t *);
540540
void wipe_config_hotkey_handler(device_t *, hid_keyboard_report_t *);
@@ -561,7 +561,7 @@ void handle_heartbeat_msg(uart_packet_t *, device_t *);
561561
void handle_proxy_msg(uart_packet_t *, device_t *);
562562
void handle_api_msgs(uart_packet_t *, device_t *);
563563
void handle_api_read_all_msg(uart_packet_t *, device_t *);
564-
void handle_toggle_relative_msg(uart_packet_t *, device_t *);
564+
void handle_toggle_gaming_msg(uart_packet_t *, device_t *);
565565

566566
void switch_output(device_t *, uint8_t);
567567

src/keyboard.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ hotkey_combo_t hotkeys[] = {
5656
.keys = {HID_KEY_G},
5757
.key_count = 1,
5858
.acknowledge = true,
59-
.action_handler = &toggle_relative_mode_handler},
59+
.action_handler = &toggle_gaming_mode_handler},
6060

6161
/* Erase stored config */
6262
{.modifier = KEYBOARD_MODIFIER_RIGHTSHIFT,

src/mouse.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ void check_screen_switch(const mouse_values_t *values, device_t *state) {
184184

185185
int direction = jump_left ? LEFT : RIGHT;
186186

187-
/* No switching allowed if explicitly disabled */
188-
if (state->switch_lock)
187+
/* No switching allowed if explicitly disabled or in gaming mode */
188+
if (state->switch_lock || state->gaming_mode)
189189
return;
190190

191191
/* No jump condition met == nothing to do, return */
@@ -243,7 +243,7 @@ mouse_report_t create_mouse_report(device_t *state, mouse_values_t *values) {
243243
};
244244

245245
/* Workaround for Windows multiple desktops */
246-
if (state->relative_mouse) {
246+
if (state->relative_mouse || state->gaming_mode) {
247247
mouse_report.x = values->move_x;
248248
mouse_report.y = values->move_y;
249249
mouse_report.mode = RELATIVE;

src/uart.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const uart_handler_t uart_handler[] = {
7676
{.type = SWITCH_LOCK_MSG, .handler = handle_switch_lock_msg},
7777
{.type = SYNC_BORDERS_MSG, .handler = handle_sync_borders_msg},
7878
{.type = FLASH_LED_MSG, .handler = handle_flash_led_msg},
79-
{.type = RELATIVE_MODE_MSG, .handler = handle_toggle_relative_msg},
79+
{.type = GAMING_MODE_MSG, .handler = handle_toggle_gaming_msg},
8080
{.type = CONSUMER_CONTROL_MSG, .handler = handle_consumer_control_msg},
8181

8282
/* Config */

0 commit comments

Comments
 (0)