aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/qt_sdl/InputConfig/MapButton.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend/qt_sdl/InputConfig/MapButton.h')
-rw-r--r--src/frontend/qt_sdl/InputConfig/MapButton.h29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/frontend/qt_sdl/InputConfig/MapButton.h b/src/frontend/qt_sdl/InputConfig/MapButton.h
index a1b1a16..afefed7 100644
--- a/src/frontend/qt_sdl/InputConfig/MapButton.h
+++ b/src/frontend/qt_sdl/InputConfig/MapButton.h
@@ -1,5 +1,5 @@
/*
- Copyright 2016-2021 Arisotura
+ Copyright 2016-2022 melonDS team
This file is part of melonDS.
@@ -163,6 +163,7 @@ public:
setCheckable(true);
setText(mappingText());
+ setFocusPolicy(Qt::StrongFocus); //Fixes binding keys in macOS
connect(this, &JoyMapButton::clicked, this, &JoyMapButton::onClick);
@@ -245,19 +246,21 @@ protected:
Sint16 axisval = SDL_JoystickGetAxis(joy, i);
int diff = abs(axisval - axesRest[i]);
- if (axesRest[i] < -16384 && axisval >= 0)
- {
- *mapping = (oldmap & 0xFFFF) | 0x10000 | (2 << 20) | (i << 24);
- click();
- return;
- }
- else if (diff > 16384)
+ if (diff >= 16384)
{
- int axistype;
- if (axisval > 0) axistype = 0;
- else axistype = 1;
+ if (axesRest[i] < -16384) // Trigger
+ {
+ *mapping = (oldmap & 0xFFFF) | 0x10000 | (2 << 20) | (i << 24);
+ }
+ else // Analog stick
+ {
+ int axistype;
+ if (axisval > 0) axistype = 0;
+ else axistype = 1;
+
+ *mapping = (oldmap & 0xFFFF) | 0x10000 | (axistype << 20) | (i << 24);
+ }
- *mapping = (oldmap & 0xFFFF) | 0x10000 | (axistype << 20) | (i << 24);
click();
return;
}
@@ -352,4 +355,4 @@ private:
int axesRest[16];
};
-#endif // MAPBUTTON_H \ No newline at end of file
+#endif // MAPBUTTON_H