DeskHop v0.65

- Fixed bug with gaming mode
This commit is contained in:
Hrvoje Cavrak 2024-09-14 15:20:09 +02:00
parent f08d305d83
commit 8b99499ac0
6 changed files with 16 additions and 16 deletions

View File

@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.6)
set(VERSION_MAJOR 00)
set(VERSION_MINOR 157)
set(VERSION_MINOR 158)
set(PICO_SDK_FETCH_FROM_GIT off)
set(PICO_BOARD=pico)

View File

@ -68,9 +68,9 @@ void switchlock_hotkey_handler(device_t *state, hid_keyboard_report_t *report) {
}
/* This key combo toggles gaming mode */
void toggle_relative_mode_handler(device_t *state, hid_keyboard_report_t *report) {
state->relative_mouse ^= 1;
send_value(state->relative_mouse, RELATIVE_MODE_MSG);
void toggle_gaming_mode_handler(device_t *state, hid_keyboard_report_t *report) {
state->gaming_mode ^= 1;
send_value(state->gaming_mode, GAMING_MODE_MSG);
};
/* This key combo locks both outputs simultaneously */
@ -229,9 +229,9 @@ void handle_proxy_msg(uart_packet_t *packet, device_t *state) {
queue_packet(&packet->data[1], (enum packet_type_e)packet->data[0], PACKET_DATA_LENGTH - 1);
}
/* Process request to reboot the board */
void handle_toggle_relative_msg(uart_packet_t *packet, device_t *state) {
state->relative_mouse = packet->data[0];
/* Process relative mouse command */
void handle_toggle_gaming_msg(uart_packet_t *packet, device_t *state) {
state->gaming_mode = packet->data[0];
}
/* Process api communication messages */

View File

@ -124,7 +124,7 @@ enum packet_type_e {
FLASH_LED_MSG = 9,
WIPE_CONFIG_MSG = 10,
HEARTBEAT_MSG = 12,
RELATIVE_MODE_MSG = 13,
GAMING_MODE_MSG = 13,
CONSUMER_CONTROL_MSG = 14,
SYSTEM_CONTROL_MSG = 15,
SAVE_CONFIG_MSG = 18,
@ -185,7 +185,6 @@ typedef struct {
/********* Screen **********/
#define MIN_SCREEN_COORD 0
#define MAX_SCREEN_COORD 32767
#define SCREEN_MIDPOINT 16384
/********* Configuration storage definitions **********/
@ -424,6 +423,7 @@ typedef struct {
bool switch_lock; // True when device is prevented from switching
bool onboard_led_state; // True when LED is ON
bool relative_mouse; // True when relative mouse mode is used
bool gaming_mode; // True when gaming mode is on (relative passthru + lock)
bool config_mode_active; // True when config mode is active
bool digitizer_active; // True when digitizer Win/Mac workaround is active
@ -534,7 +534,7 @@ void fw_upgrade_hotkey_handler_B(device_t *, hid_keyboard_report_t *);
void mouse_zoom_hotkey_handler(device_t *, hid_keyboard_report_t *);
void all_keys_released_handler(device_t *);
void switchlock_hotkey_handler(device_t *, hid_keyboard_report_t *);
void toggle_relative_mode_handler(device_t *, hid_keyboard_report_t *);
void toggle_gaming_mode_handler(device_t *, hid_keyboard_report_t *);
void screenlock_hotkey_handler(device_t *, hid_keyboard_report_t *);
void output_config_hotkey_handler(device_t *, hid_keyboard_report_t *);
void wipe_config_hotkey_handler(device_t *, hid_keyboard_report_t *);
@ -561,7 +561,7 @@ void handle_heartbeat_msg(uart_packet_t *, device_t *);
void handle_proxy_msg(uart_packet_t *, device_t *);
void handle_api_msgs(uart_packet_t *, device_t *);
void handle_api_read_all_msg(uart_packet_t *, device_t *);
void handle_toggle_relative_msg(uart_packet_t *, device_t *);
void handle_toggle_gaming_msg(uart_packet_t *, device_t *);
void switch_output(device_t *, uint8_t);

View File

@ -56,7 +56,7 @@ hotkey_combo_t hotkeys[] = {
.keys = {HID_KEY_G},
.key_count = 1,
.acknowledge = true,
.action_handler = &toggle_relative_mode_handler},
.action_handler = &toggle_gaming_mode_handler},
/* Erase stored config */
{.modifier = KEYBOARD_MODIFIER_RIGHTSHIFT,

View File

@ -184,8 +184,8 @@ void check_screen_switch(const mouse_values_t *values, device_t *state) {
int direction = jump_left ? LEFT : RIGHT;
/* No switching allowed if explicitly disabled */
if (state->switch_lock)
/* No switching allowed if explicitly disabled or in gaming mode */
if (state->switch_lock || state->gaming_mode)
return;
/* 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) {
};
/* Workaround for Windows multiple desktops */
if (state->relative_mouse) {
if (state->relative_mouse || state->gaming_mode) {
mouse_report.x = values->move_x;
mouse_report.y = values->move_y;
mouse_report.mode = RELATIVE;

View File

@ -76,7 +76,7 @@ const uart_handler_t uart_handler[] = {
{.type = SWITCH_LOCK_MSG, .handler = handle_switch_lock_msg},
{.type = SYNC_BORDERS_MSG, .handler = handle_sync_borders_msg},
{.type = FLASH_LED_MSG, .handler = handle_flash_led_msg},
{.type = RELATIVE_MODE_MSG, .handler = handle_toggle_relative_msg},
{.type = GAMING_MODE_MSG, .handler = handle_toggle_gaming_msg},
{.type = CONSUMER_CONTROL_MSG, .handler = handle_consumer_control_msg},
/* Config */