Skip to content

Commit

Permalink
refactor: define virtual tablet device name in header file
Browse files Browse the repository at this point in the history
  • Loading branch information
Xtr126 committed Nov 12, 2023
1 parent cb0c8f9 commit bc7295b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/src/main/cpp/mouse_cursor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
#include <unistd.h>
#include <cstring>
#include <cstdio>
#include "mouse_cursor.h"

int uinput_fd = -1;
struct input_event ie {};
const char* deviceName = "x-virtual-tablet";
const char* device_name = x_virtual_tablet;

void setAbsMinMax(int width, int height) {
struct uinput_abs_setup uinputAbsSetup {};
Expand All @@ -35,7 +36,7 @@ Java_xtr_keymapper_server_InputService_initMouseCursor
memset(&ie, 0, sizeof(struct input_event));
memset(&uinputSetup, 0x00, sizeof(uinputSetup));

strncpy(uinputSetup.name, deviceName, strlen(deviceName));
strncpy(uinputSetup.name, device_name, strlen(device_name));
uinputSetup.id.version = 1;
uinputSetup.id.bustype = BUS_VIRTUAL;
setAbsMinMax(width, height);
Expand Down
1 change: 1 addition & 0 deletions app/src/main/cpp/mouse_cursor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#define x_virtual_tablet "x-virtual-tablet"

0 comments on commit bc7295b

Please sign in to comment.