Add gamepad navigation support for everything except context menus and dialogs

This commit is contained in:
Cameron Gutman
2018-09-30 13:41:32 -07:00
parent 9fb0bffd61
commit d706e81cd4
9 changed files with 291 additions and 14 deletions

View File

@@ -24,6 +24,7 @@
#include "backend/autoupdatechecker.h"
#include "streaming/session.h"
#include "settings/streamingpreferences.h"
#include "gui/sdlgamepadkeynavigation.h"
#if !defined(QT_DEBUG) && defined(Q_OS_WIN32)
// Log to file for release Windows builds
@@ -288,6 +289,7 @@ int main(int argc, char *argv[])
qmlRegisterType<ComputerModel>("ComputerModel", 1, 0, "ComputerModel");
qmlRegisterType<AppModel>("AppModel", 1, 0, "AppModel");
qmlRegisterType<StreamingPreferences>("StreamingPreferences", 1, 0, "StreamingPreferences");
qmlRegisterType<SdlGamepadKeyNavigation>("SdlGamepadKeyNavigation", 1, 0, "SdlGamepadKeyNavigation");
qmlRegisterUncreatableType<Session>("Session", 1, 0, "Session", "Session cannot be created from QML");
qmlRegisterSingletonType<ComputerManager>("ComputerManager", 1, 0,
"ComputerManager",
@@ -338,6 +340,10 @@ int main(int argc, char *argv[])
SDL_GetError());
}
// Use atexit() to ensure SDL_Quit() is called. This avoids
// racing with object destruction where SDL may be used.
atexit(SDL_Quit);
// Avoid the default behavior of changing the timer resolution to 1 ms.
// We don't want this all the time that Moonlight is open. We will set
// it manually when we start streaming.
@@ -345,7 +351,5 @@ int main(int argc, char *argv[])
int err = app.exec();
SDL_Quit();
return err;
}