Merge branch 'master' of github.com:cgutman/moonlight-chrome

This commit is contained in:
Aidan Campbell 2016-02-13 19:12:07 -05:00
commit 14e007a383
5 changed files with 22 additions and 6 deletions

View File

@ -12,6 +12,7 @@ include $(NACL_SDK_ROOT)/tools/common.mk
# Dirty hack to allow 'make serve' to work in this directory # Dirty hack to allow 'make serve' to work in this directory
HTTPD_PY := $(HTTPD_PY) --no-dir-check HTTPD_PY := $(HTTPD_PY) --no-dir-check
CHROME_ARGS += --allow-nacl-socket-api=localhost
LIBS = ppapi_gles2 ppapi ppapi_cpp pthread nacl_io LIBS = ppapi_gles2 ppapi ppapi_cpp pthread nacl_io

View File

@ -31,6 +31,7 @@ void MoonlightInstance::DidLockMouse(int32_t result) {
void MoonlightInstance::MouseLockLost() { void MoonlightInstance::MouseLockLost() {
m_MouseLocked = false; m_MouseLocked = false;
m_KeyModifiers = 0;
} }
void MoonlightInstance::UpdateModifiers(PP_InputEvent_Type eventType, short keyCode) { 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 // Update modifier state before sending the key event
UpdateModifiers(event.GetType(), keyboardEvent.GetKeyCode()); 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(), LiSendKeyboardEvent(KEY_PREFIX << 8 | keyboardEvent.GetKeyCode(),
KEY_ACTION_DOWN, m_KeyModifiers); KEY_ACTION_DOWN, m_KeyModifiers);
return true; return true;

View File

@ -101,7 +101,7 @@ void MoonlightInstance::handleShowGames(std::string showGamesMessage) {
} }
void MoonlightInstance::handleStartStream(std::string startStreamMessage) { void MoonlightInstance::handleStartStream(std::string startStreamMessage) {
// Populate the stream configuration // Populate the stream configuration
LiInitializeStreamConfiguration(&s_StreamConfig); LiInitializeStreamConfiguration(&s_StreamConfig);
s_StreamConfig.width = 1280; s_StreamConfig.width = 1280;
s_StreamConfig.height = 720; s_StreamConfig.height = 720;
@ -112,7 +112,7 @@ void MoonlightInstance::handleStartStream(std::string startStreamMessage) {
s_StreamConfig.audioConfiguration = AUDIO_CONFIGURATION_STEREO; s_StreamConfig.audioConfiguration = AUDIO_CONFIGURATION_STEREO;
// Store the host, which is between two colons // 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()); strcpy(s_Host, host.c_str());
// store the gameID to start, which is after the last colon // store the gameID to start, which is after the last colon

View File

@ -1,6 +1,6 @@
{ {
"manifest_version": 2, "manifest_version": 2,
"name": "Moonlight Chrome", "name": "Moonlight",
"version": "0.01", "version": "0.01",
"description": "A Moonlight streaming plugin for Google Chrome", "description": "A Moonlight streaming plugin for Google Chrome",
"icons": { "icons": {
@ -15,6 +15,15 @@
"scripts": ["background.js"] "scripts": ["background.js"]
} }
}, },
"permissions": ["fullscreen"] "permissions": [
"pointerLock",
"fullscreen", {
"socket": [
"tcp-connect",
"resolve-host",
"udp-bind:*:*",
"udp-send-to:*:*"
] }
]
} }

View File

@ -55,7 +55,6 @@ class MoonlightInstance : public pp::Instance, public pp::MouseLock {
void handleStartStream(std::string startStreamMessage); void handleStartStream(std::string startStreamMessage);
void handleStopStream(std::string stopStreamMessage); void handleStopStream(std::string stopStreamMessage);
void UpdateModifiers(PP_InputEvent_Type eventType, short keyCode); void UpdateModifiers(PP_InputEvent_Type eventType, short keyCode);
bool HandleInputEvent(const pp::InputEvent& event); bool HandleInputEvent(const pp::InputEvent& event);