mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2025-01-09 09:48:43 +00:00
Disable touch feedback when sending touch natively
This commit is contained in:
parent
05fd7b18b9
commit
f112edc3c3
3 changed files with 44 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <Limelight.h>
|
#include <Limelight.h>
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
#include <SDL_syswm.h>
|
||||||
#include "streaming/streamutils.h"
|
#include "streaming/streamutils.h"
|
||||||
|
|
||||||
#include <QtMath>
|
#include <QtMath>
|
||||||
|
@ -27,6 +28,40 @@ Uint32 SdlInputHandler::longPressTimerCallback(Uint32, void*)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SdlInputHandler::disableTouchFeedback()
|
||||||
|
{
|
||||||
|
SDL_SysWMinfo info;
|
||||||
|
|
||||||
|
SDL_VERSION(&info.version);
|
||||||
|
SDL_GetWindowWMInfo(m_Window, &info);
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN32
|
||||||
|
if (info.subsystem == SDL_SYSWM_WINDOWS) {
|
||||||
|
auto fnSetWindowFeedbackSetting = (decltype(SetWindowFeedbackSetting)*)GetProcAddress(GetModuleHandleW(L"user32.dll"), "SetWindowFeedbackSetting");
|
||||||
|
if (fnSetWindowFeedbackSetting) {
|
||||||
|
constexpr FEEDBACK_TYPE feedbackTypes[] = {
|
||||||
|
FEEDBACK_TOUCH_CONTACTVISUALIZATION,
|
||||||
|
FEEDBACK_PEN_BARRELVISUALIZATION,
|
||||||
|
FEEDBACK_PEN_TAP,
|
||||||
|
FEEDBACK_PEN_DOUBLETAP,
|
||||||
|
FEEDBACK_PEN_PRESSANDHOLD,
|
||||||
|
FEEDBACK_PEN_RIGHTTAP,
|
||||||
|
FEEDBACK_TOUCH_TAP,
|
||||||
|
FEEDBACK_TOUCH_DOUBLETAP,
|
||||||
|
FEEDBACK_TOUCH_PRESSANDHOLD,
|
||||||
|
FEEDBACK_TOUCH_RIGHTTAP,
|
||||||
|
FEEDBACK_GESTURE_PRESSANDTAP,
|
||||||
|
};
|
||||||
|
|
||||||
|
for (FEEDBACK_TYPE ft : feedbackTypes) {
|
||||||
|
BOOL val = FALSE;
|
||||||
|
fnSetWindowFeedbackSetting(info.info.win.window, ft, 0, sizeof(val), &val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void SdlInputHandler::handleAbsoluteFingerEvent(SDL_TouchFingerEvent* event)
|
void SdlInputHandler::handleAbsoluteFingerEvent(SDL_TouchFingerEvent* event)
|
||||||
{
|
{
|
||||||
SDL_Rect src, dst;
|
SDL_Rect src, dst;
|
||||||
|
@ -81,6 +116,11 @@ void SdlInputHandler::handleAbsoluteFingerEvent(SDL_TouchFingerEvent* event)
|
||||||
0.0f, 0.0f, LI_ROT_UNKNOWN) == LI_ERR_UNSUPPORTED) {
|
0.0f, 0.0f, LI_ROT_UNKNOWN) == LI_ERR_UNSUPPORTED) {
|
||||||
emulateAbsoluteFingerEvent(event);
|
emulateAbsoluteFingerEvent(event);
|
||||||
}
|
}
|
||||||
|
else if (!m_DisabledTouchFeedback) {
|
||||||
|
// Disable touch feedback when passing touch natively
|
||||||
|
disableTouchFeedback();
|
||||||
|
m_DisabledTouchFeedback = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SdlInputHandler::emulateAbsoluteFingerEvent(SDL_TouchFingerEvent* event)
|
void SdlInputHandler::emulateAbsoluteFingerEvent(SDL_TouchFingerEvent* event)
|
||||||
|
|
|
@ -27,6 +27,7 @@ SdlInputHandler::SdlInputHandler(StreamingPreferences& prefs, int streamWidth, i
|
||||||
m_StreamHeight(streamHeight),
|
m_StreamHeight(streamHeight),
|
||||||
m_AbsoluteMouseMode(prefs.absoluteMouseMode),
|
m_AbsoluteMouseMode(prefs.absoluteMouseMode),
|
||||||
m_AbsoluteTouchMode(prefs.absoluteTouchMode),
|
m_AbsoluteTouchMode(prefs.absoluteTouchMode),
|
||||||
|
m_DisabledTouchFeedback(false),
|
||||||
m_LeftButtonReleaseTimer(0),
|
m_LeftButtonReleaseTimer(0),
|
||||||
m_RightButtonReleaseTimer(0),
|
m_RightButtonReleaseTimer(0),
|
||||||
m_DragTimer(0),
|
m_DragTimer(0),
|
||||||
|
|
|
@ -140,6 +140,8 @@ private:
|
||||||
|
|
||||||
void emulateAbsoluteFingerEvent(SDL_TouchFingerEvent* event);
|
void emulateAbsoluteFingerEvent(SDL_TouchFingerEvent* event);
|
||||||
|
|
||||||
|
void disableTouchFeedback();
|
||||||
|
|
||||||
void handleRelativeFingerEvent(SDL_TouchFingerEvent* event);
|
void handleRelativeFingerEvent(SDL_TouchFingerEvent* event);
|
||||||
|
|
||||||
void performSpecialKeyCombo(KeyCombo combo);
|
void performSpecialKeyCombo(KeyCombo combo);
|
||||||
|
@ -194,6 +196,7 @@ private:
|
||||||
int m_StreamHeight;
|
int m_StreamHeight;
|
||||||
bool m_AbsoluteMouseMode;
|
bool m_AbsoluteMouseMode;
|
||||||
bool m_AbsoluteTouchMode;
|
bool m_AbsoluteTouchMode;
|
||||||
|
bool m_DisabledTouchFeedback;
|
||||||
|
|
||||||
SDL_TouchFingerEvent m_TouchDownEvent[MAX_FINGERS];
|
SDL_TouchFingerEvent m_TouchDownEvent[MAX_FINGERS];
|
||||||
SDL_TimerID m_LeftButtonReleaseTimer;
|
SDL_TimerID m_LeftButtonReleaseTimer;
|
||||||
|
|
Loading…
Reference in a new issue