Add option to enable mouse acceleration for remote desktop usage
This commit is contained in:
parent
af17d56cbd
commit
9e2fd67487
7 changed files with 35 additions and 8 deletions
|
|
@ -22,13 +22,20 @@ const int SdlInputHandler::k_ButtonMap[] = {
|
|||
UP_FLAG, DOWN_FLAG, LEFT_FLAG, RIGHT_FLAG
|
||||
};
|
||||
|
||||
SdlInputHandler::SdlInputHandler(bool multiController)
|
||||
SdlInputHandler::SdlInputHandler(StreamingPreferences& prefs)
|
||||
: m_LastMouseMotionTime(0),
|
||||
m_MultiController(multiController)
|
||||
m_MultiController(prefs.multiController)
|
||||
{
|
||||
// Allow gamepad input when the app doesn't have focus
|
||||
SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1");
|
||||
|
||||
// If mouse acceleration is enabled, use relative mode warp (which
|
||||
// is via normal motion events that are influenced by mouse acceleration).
|
||||
// Otherwise, we'll use raw input capture which is straight from the device
|
||||
// without modification by the OS.
|
||||
SDL_SetHint(SDL_HINT_MOUSE_RELATIVE_MODE_WARP,
|
||||
prefs.mouseAcceleration ? "1" : "0");
|
||||
|
||||
// We need to reinit this each time, since you only get
|
||||
// an initial set of gamepad arrival events once per init.
|
||||
SDL_assert(!SDL_WasInit(SDL_INIT_GAMECONTROLLER));
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "settings/streamingpreferences.h"
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
struct GamepadState {
|
||||
|
|
@ -18,7 +20,7 @@ struct GamepadState {
|
|||
class SdlInputHandler
|
||||
{
|
||||
public:
|
||||
explicit SdlInputHandler(bool multiController);
|
||||
explicit SdlInputHandler(StreamingPreferences& prefs);
|
||||
|
||||
~SdlInputHandler();
|
||||
|
||||
|
|
|
|||
|
|
@ -728,7 +728,7 @@ void Session::exec(int displayOriginX, int displayOriginY)
|
|||
|
||||
// Initialize the gamepad code with our preferences
|
||||
StreamingPreferences prefs;
|
||||
SdlInputHandler inputHandler(prefs.multiController);
|
||||
SdlInputHandler inputHandler(prefs);
|
||||
|
||||
// The UI should have ensured the old game was already quit
|
||||
// if we decide to stream a different game.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue