From 313ab92531fbfacb955f9de85d3fc611f8064154 Mon Sep 17 00:00:00 2001 From: a1xd <68629610+a1xd@users.noreply.github.com> Date: Mon, 24 Aug 2020 04:24:33 -0400 Subject: clean up wrapper, minimize heap alloc --- common/rawaccel-io.hpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'common/rawaccel-io.hpp') diff --git a/common/rawaccel-io.hpp b/common/rawaccel-io.hpp index 7f55392..582ea68 100644 --- a/common/rawaccel-io.hpp +++ b/common/rawaccel-io.hpp @@ -48,7 +48,7 @@ namespace rawaccel { } - void write(mouse_modifier mod) { + void write(const mouse_modifier& mod) { HANDLE ra_handle = INVALID_HANDLE_VALUE; ra_handle = CreateFileW(L"\\\\.\\rawaccel", 0, 0, 0, OPEN_EXISTING, 0, 0); @@ -62,12 +62,12 @@ namespace rawaccel { BOOL success = DeviceIoControl( ra_handle, RA_WRITE, - &mod, // input buffer - sizeof(mouse_modifier), // input buffer size - NULL, // output buffer - 0, // output buffer size - &dummy, // bytes returned - NULL // overlapped structure + const_cast(&mod), // input buffer + sizeof(mouse_modifier), // input buffer size + NULL, // output buffer + 0, // output buffer size + &dummy, // bytes returned + NULL // overlapped structure ); CloseHandle(ra_handle); -- cgit v1.2.3 From 9010cc593af419dd824dba0ade6a2022aea6143f Mon Sep 17 00:00:00 2001 From: a1xd <68629610+a1xd@users.noreply.github.com> Date: Mon, 31 Aug 2020 19:41:21 -0400 Subject: add independent xy accel to driver other changes: modifier_args type name is now settings, which is now the type passed in driver ioctl remove most settings/args verification from driver, plan to let gui handle most of it add another accel arg, rate, which is used to set the 'accel' parameter of types which call exp (nat/sig), might want to cap it add (update) serializable DriverSettings (ModifierArgs) class to gui and static methods for interop remove properties from ManagedAccel, its now just a black box for accessing modifier methods add exception handling in wrapper_io to throw proper managed types change SettingsManager::Startup to make a new settings file if an error occurs during deserialization change structure of accel types; how offset and weight are applied now depend on additivity of types remove tagged_union and add a handrolled variant/visit impl AccelGui::UpdateActiveValueLabels currently broken for caps and a few other args remove gui default layout and initial natural accel setup cli not updated --- common/rawaccel-io.hpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'common/rawaccel-io.hpp') diff --git a/common/rawaccel-io.hpp b/common/rawaccel-io.hpp index 582ea68..74e2d1e 100644 --- a/common/rawaccel-io.hpp +++ b/common/rawaccel-io.hpp @@ -5,7 +5,8 @@ #define NOMINMAX #include -#include "rawaccel.hpp" +#include "rawaccel-settings.h" +#include "rawaccel-error.hpp" #define RA_READ CTL_CODE(0x8888, 0x888, METHOD_OUT_DIRECT, FILE_ANY_ACCESS) #define RA_WRITE CTL_CODE(0x8888, 0x889, METHOD_BUFFERED, FILE_ANY_ACCESS) @@ -15,7 +16,7 @@ namespace rawaccel { - mouse_modifier read() { + settings read() { HANDLE ra_handle = INVALID_HANDLE_VALUE; ra_handle = CreateFileW(L"\\\\.\\rawaccel", 0, 0, 0, OPEN_EXISTING, 0, 0); @@ -24,7 +25,7 @@ namespace rawaccel { throw install_error(); } - mouse_modifier mod; + settings args; DWORD dummy; BOOL success = DeviceIoControl( @@ -32,8 +33,8 @@ namespace rawaccel { RA_READ, NULL, // input buffer 0, // input buffer size - &mod, // output buffer - sizeof(mouse_modifier), // output buffer size + &args, // output buffer + sizeof(settings), // output buffer size &dummy, // bytes returned NULL // overlapped structure ); @@ -44,11 +45,11 @@ namespace rawaccel { throw std::system_error(GetLastError(), std::system_category(), "DeviceIoControl failed"); } - return mod; + return args; } - void write(const mouse_modifier& mod) { + void write(const settings& args) { HANDLE ra_handle = INVALID_HANDLE_VALUE; ra_handle = CreateFileW(L"\\\\.\\rawaccel", 0, 0, 0, OPEN_EXISTING, 0, 0); @@ -62,8 +63,8 @@ namespace rawaccel { BOOL success = DeviceIoControl( ra_handle, RA_WRITE, - const_cast(&mod), // input buffer - sizeof(mouse_modifier), // input buffer size + const_cast(&args), // input buffer + sizeof(settings), // input buffer size NULL, // output buffer 0, // output buffer size &dummy, // bytes returned -- cgit v1.2.3