diff --git a/Makefile b/Makefile index 0582a8b..202a0a0 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,7 @@ include $(NACL_SDK_ROOT)/tools/common.mk # Dirty hack to allow 'make serve' to work in this directory HTTPD_PY := $(HTTPD_PY) --no-dir-check +CHROME_ARGS += --allow-nacl-socket-api=localhost LIBS = ppapi_gles2 ppapi ppapi_cpp pthread nacl_io diff --git a/input.cpp b/input.cpp index cb8f8b9..bb50ce7 100644 --- a/input.cpp +++ b/input.cpp @@ -31,6 +31,7 @@ void MoonlightInstance::DidLockMouse(int32_t result) { void MoonlightInstance::MouseLockLost() { m_MouseLocked = false; + m_KeyModifiers = 0; } void MoonlightInstance::UpdateModifiers(PP_InputEvent_Type eventType, short keyCode) { @@ -127,6 +128,12 @@ bool MoonlightInstance::HandleInputEvent(const pp::InputEvent& event) { // Update modifier state before sending the key event UpdateModifiers(event.GetType(), keyboardEvent.GetKeyCode()); + if (m_KeyModifiers == (MODIFIER_ALT | MODIFIER_CTRL | MODIFIER_SHIFT)) { + g_Instance->UnlockMouse(); + m_MouseLocked = false; + return true; + } + LiSendKeyboardEvent(KEY_PREFIX << 8 | keyboardEvent.GetKeyCode(), KEY_ACTION_DOWN, m_KeyModifiers); return true; diff --git a/main.cpp b/main.cpp index e86c96b..3b3ac1d 100644 --- a/main.cpp +++ b/main.cpp @@ -101,7 +101,7 @@ void MoonlightInstance::handleShowGames(std::string showGamesMessage) { } void MoonlightInstance::handleStartStream(std::string startStreamMessage) { - // Populate the stream configuration + // Populate the stream configuration LiInitializeStreamConfiguration(&s_StreamConfig); s_StreamConfig.width = 1280; s_StreamConfig.height = 720; @@ -112,7 +112,7 @@ void MoonlightInstance::handleStartStream(std::string startStreamMessage) { s_StreamConfig.audioConfiguration = AUDIO_CONFIGURATION_STEREO; // Store the host, which is between two colons - std::string host = startStreamMessage.substr(strlen(START_STREAM_DIRECTIVE), startStreamMessage.substr(strlen(START_STREAM_DIRECTIVE)).find(":") + 1); + std::string host = startStreamMessage.substr(strlen(START_STREAM_DIRECTIVE), startStreamMessage.substr(strlen(START_STREAM_DIRECTIVE)).find(":")); strcpy(s_Host, host.c_str()); // store the gameID to start, which is after the last colon diff --git a/manifest.json b/manifest.json index 2df2138..323044f 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "manifest_version": 2, - "name": "Moonlight Chrome", + "name": "Moonlight", "version": "0.01", "description": "A Moonlight streaming plugin for Google Chrome", "icons": { @@ -15,6 +15,15 @@ "scripts": ["background.js"] } }, - "permissions": ["fullscreen"] + "permissions": [ + "pointerLock", + "fullscreen", { + "socket": [ + "tcp-connect", + "resolve-host", + "udp-bind:*:*", + "udp-send-to:*:*" + ] } + ] } diff --git a/moonlight.hpp b/moonlight.hpp index 80d8a2a..63f441d 100644 --- a/moonlight.hpp +++ b/moonlight.hpp @@ -54,7 +54,6 @@ class MoonlightInstance : public pp::Instance, public pp::MouseLock { void handleShowGames(std::string showGamesMessage); void handleStartStream(std::string startStreamMessage); void handleStopStream(std::string stopStreamMessage); - void UpdateModifiers(PP_InputEvent_Type eventType, short keyCode); bool HandleInputEvent(const pp::InputEvent& event); @@ -111,4 +110,4 @@ class MoonlightInstance : public pp::Instance, public pp::MouseLock { char m_KeyModifiers; }; -extern MoonlightInstance* g_Instance; \ No newline at end of file +extern MoonlightInstance* g_Instance;