diff --git a/daemon/x52d.conf b/daemon/x52d.conf index 02c6205..b6a11cb 100644 --- a/daemon/x52d.conf +++ b/daemon/x52d.conf @@ -85,6 +85,9 @@ Enabled=yes # Speed is proportional to the speed of updates to the virtual mouse Speed=0 +# ReverseScroll reverses the direction of the virtual scroll wheel +ReverseScroll=no + ###################################################################### # Profiles - only valid on Linux ###################################################################### diff --git a/daemon/x52d_config.def b/daemon/x52d_config.def index 9fab8ab..3ba713b 100644 --- a/daemon/x52d_config.def +++ b/daemon/x52d_config.def @@ -75,6 +75,9 @@ CFG(Mouse, Enabled, mouse_enabled, bool, true) // virtual mouse CFG(Mouse, Speed, mouse_speed, int, 0) +// ReverseScroll controls the scrolling direction +CFG(Mouse, ReverseScroll, mouse_reverse_scroll, bool, false) + /********************************************************************** * Profiles - only valid on Linux *********************************************************************/ diff --git a/daemon/x52d_config.h b/daemon/x52d_config.h index bd41c77..4ba7f3d 100644 --- a/daemon/x52d_config.h +++ b/daemon/x52d_config.h @@ -39,6 +39,7 @@ struct x52d_config { bool mouse_enabled; int mouse_speed; + bool mouse_reverse_scroll; bool clutch_enabled; bool clutch_latched; @@ -71,6 +72,7 @@ void x52d_cfg_set_Brightness_MFD(uint16_t param); void x52d_cfg_set_Brightness_LED(uint16_t param); void x52d_cfg_set_Mouse_Enabled(bool param); void x52d_cfg_set_Mouse_Speed(int param); +void x52d_cfg_set_Mouse_ReverseScroll(bool param); void x52d_cfg_set_Profiles_Directory(char* param); void x52d_cfg_set_Profiles_ClutchEnabled(bool param); void x52d_cfg_set_Profiles_ClutchLatched(bool param); diff --git a/daemon/x52d_mouse.c b/daemon/x52d_mouse.c index dd88ec1..be568a5 100644 --- a/daemon/x52d_mouse.c +++ b/daemon/x52d_mouse.c @@ -24,6 +24,7 @@ volatile int mouse_delay = DEFAULT_MOUSE_DELAY; volatile int mouse_mult = MOUSE_MULT_FACTOR; +volatile int mouse_scroll_dir = 1; void x52d_cfg_set_Mouse_Enabled(bool enabled) { @@ -60,3 +61,15 @@ void x52d_cfg_set_Mouse_Speed(int speed) mouse_delay = new_delay; mouse_mult = new_mult; } + +void x52d_cfg_set_Mouse_ReverseScroll(bool enabled) +{ + PINELOG_DEBUG(_("Setting mouse reverse scroll to %s"), + enabled ? _("on") : _("off")); + + if (enabled) { + mouse_scroll_dir = -1; + } else { + mouse_scroll_dir = 1; + } +} diff --git a/daemon/x52d_mouse.h b/daemon/x52d_mouse.h index 3ee85df..adad1a9 100644 --- a/daemon/x52d_mouse.h +++ b/daemon/x52d_mouse.h @@ -14,6 +14,7 @@ extern volatile int mouse_delay; extern volatile int mouse_mult; +extern volatile int mouse_scroll_dir; #define MOUSE_MULT_FACTOR 4 diff --git a/daemon/x52d_mouse_evdev.c b/daemon/x52d_mouse_evdev.c index c7fe831..58e2009 100644 --- a/daemon/x52d_mouse_evdev.c +++ b/daemon/x52d_mouse_evdev.c @@ -57,10 +57,10 @@ static int report_wheel(void) if (scroll_up) { // Scroll up event - wheel = 1; + wheel = 1 * mouse_scroll_dir; } else if (scroll_dn) { // Scroll down event - wheel = -1; + wheel = -1 * mouse_scroll_dir; } if (wheel != 0) { diff --git a/po/libx52.pot b/po/libx52.pot index 62acf0c..b2ec05d 100644 --- a/po/libx52.pot +++ b/po/libx52.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: libx52 0.2.3\n" "Report-Msgid-Bugs-To: https://github.com/nirenjan/libx52/issues\n" -"POT-Creation-Date: 2022-05-16 10:47-0700\n" +"POT-Creation-Date: 2022-06-05 08:22-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -142,11 +142,13 @@ msgstr "" msgid "Unknown LED state %d" msgstr "" -#: libx52/x52_stringify.c:47 daemon/x52d_clock.c:29 daemon/x52d_mouse.c:31 +#: libx52/x52_stringify.c:47 daemon/x52d_clock.c:29 daemon/x52d_mouse.c:32 +#: daemon/x52d_mouse.c:68 msgid "off" msgstr "" -#: libx52/x52_stringify.c:48 daemon/x52d_clock.c:29 daemon/x52d_mouse.c:31 +#: libx52/x52_stringify.c:48 daemon/x52d_clock.c:29 daemon/x52d_mouse.c:32 +#: daemon/x52d_mouse.c:68 msgid "on" msgstr "" @@ -810,21 +812,26 @@ msgstr "" msgid "Shutting down X52 I/O driver thread" msgstr "" -#: daemon/x52d_mouse.c:30 +#: daemon/x52d_mouse.c:31 #, c-format msgid "Setting mouse enable to %s" msgstr "" -#: daemon/x52d_mouse.c:46 +#: daemon/x52d_mouse.c:47 #, c-format msgid "Ignoring mouse speed %d outside supported range (0-%d)" msgstr "" -#: daemon/x52d_mouse.c:58 +#: daemon/x52d_mouse.c:59 #, c-format msgid "Setting mouse speed to %d (delay %d ms, multiplier %f)" msgstr "" +#: daemon/x52d_mouse.c:67 +#, c-format +msgid "Setting mouse reverse scroll to %s" +msgstr "" + #: daemon/x52d_mouse_evdev.c:43 #, c-format msgid "Error writing mouse button event (button %d, state %d)" diff --git a/po/xx_PL.po b/po/xx_PL.po index ff414a8..f055275 100644 --- a/po/xx_PL.po +++ b/po/xx_PL.po @@ -7,15 +7,15 @@ msgid "" msgstr "" "Project-Id-Version: libx52 0.2.3\n" "Report-Msgid-Bugs-To: https://github.com/nirenjan/libx52/issues\n" -"POT-Creation-Date: 2022-05-16 10:47-0700\n" -"PO-Revision-Date: 2021-11-04 15:35-0700\n" +"POT-Creation-Date: 2022-06-05 08:22-0700\n" +"PO-Revision-Date: 2022-06-05 08:51-0700\n" "Last-Translator: Nirenjan Krishnan \n" "Language-Team: Dummy Language for testing i18n\n" "Language: xx_PL\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 3.0\n" +"X-Generator: Poedit 3.0.1\n" #: libx52/x52_strerror.c:23 libx52io/io_strings.c:101 msgid "Success" @@ -142,11 +142,13 @@ msgstr "YYay-MMay-DDay" msgid "Unknown LED state %d" msgstr "Unknownay EDLay atestay %d" -#: libx52/x52_stringify.c:47 daemon/x52d_clock.c:29 daemon/x52d_mouse.c:31 +#: libx52/x52_stringify.c:47 daemon/x52d_clock.c:29 daemon/x52d_mouse.c:32 +#: daemon/x52d_mouse.c:68 msgid "off" msgstr "offay" -#: libx52/x52_stringify.c:48 daemon/x52d_clock.c:29 daemon/x52d_mouse.c:31 +#: libx52/x52_stringify.c:48 daemon/x52d_clock.c:29 daemon/x52d_mouse.c:32 +#: daemon/x52d_mouse.c:68 msgid "on" msgstr "onay" @@ -862,21 +864,26 @@ msgstr "Erroray %d initializingay I/O iverdray eadthray: %s" msgid "Shutting down X52 I/O driver thread" msgstr "Uttingshay ownday X52 I/O iverdray eadthray" -#: daemon/x52d_mouse.c:30 +#: daemon/x52d_mouse.c:31 #, c-format msgid "Setting mouse enable to %s" msgstr "Ettingsay ousemay enableay otay %s" -#: daemon/x52d_mouse.c:46 +#: daemon/x52d_mouse.c:47 #, c-format msgid "Ignoring mouse speed %d outside supported range (0-%d)" msgstr "Ignoringay ousemay eedspay %d outsideay upportedsay angeray (0-%d)" -#: daemon/x52d_mouse.c:58 +#: daemon/x52d_mouse.c:59 #, c-format msgid "Setting mouse speed to %d (delay %d ms, multiplier %f)" msgstr "Ettingsay ousemay eedspay otay %d (elayday %d ms, ultipliermay %f)" +#: daemon/x52d_mouse.c:67 +#, c-format +msgid "Setting mouse reverse scroll to %s" +msgstr "Ettingsay ousemay everseray ollscray otay %s" + #: daemon/x52d_mouse_evdev.c:43 #, c-format msgid "Error writing mouse button event (button %d, state %d)"