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
HTTPD_PY := $(HTTPD_PY) --no-dir-check
CHROME_ARGS += --allow-nacl-socket-api=localhost
LIBS = ppapi_gles2 ppapi ppapi_cpp pthread nacl_io

View File

@ -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;

View File

@ -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

View File

@ -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:*:*"
] }
]
}

View File

@ -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;
extern MoonlightInstance* g_Instance;