mirror of
https://github.com/moonlight-stream/moonlight-chrome.git
synced 2025-08-17 16:46:31 +00:00
49 lines
1.6 KiB
C++
49 lines
1.6 KiB
C++
#include "moonlight.hpp"
|
|
|
|
#include "ppapi/c/ppb_input_event.h"
|
|
|
|
#include "ppapi/cpp/input_event.h"
|
|
#include "ppapi/cpp/mouse_lock.h"
|
|
|
|
void MoonlightInstance::ClStageStarting(int stage) {
|
|
pp::Var response(std::string("Starting ") + std::string(LiGetStageName(stage)) + std::string("..."));
|
|
g_Instance->PostMessage(response);
|
|
}
|
|
|
|
void MoonlightInstance::ClStageFailed(int stage, long errorCode) {
|
|
pp::Var response(std::string("Starting ") + std::string(LiGetStageName(stage)) + std::string("failed"));
|
|
g_Instance->PostMessage(response);
|
|
}
|
|
|
|
void MoonlightInstance::ClConnectionStarted(void) {
|
|
pp::Module::Get()->core()->CallOnMainThread(0,
|
|
g_Instance->m_CallbackFactory.NewCallback(&MoonlightInstance::OnConnectionStarted));
|
|
}
|
|
|
|
void MoonlightInstance::ClConnectionTerminated(long errorCode) {
|
|
// Teardown the connection
|
|
LiStopConnection();
|
|
|
|
pp::Module::Get()->core()->CallOnMainThread(0,
|
|
g_Instance->m_CallbackFactory.NewCallback(&MoonlightInstance::OnConnectionStopped), (uint32_t)errorCode);
|
|
}
|
|
|
|
void MoonlightInstance::ClDisplayMessage(char* message) {
|
|
pp::Var response(message);
|
|
g_Instance->PostMessage(response);
|
|
}
|
|
|
|
void MoonlightInstance::ClDisplayTransientMessage(char* message) {
|
|
pp::Var response(message);
|
|
g_Instance->PostMessage(response);
|
|
}
|
|
|
|
CONNECTION_LISTENER_CALLBACKS MoonlightInstance::s_ClCallbacks = {
|
|
MoonlightInstance::ClStageStarting,
|
|
NULL,
|
|
MoonlightInstance::ClStageFailed,
|
|
MoonlightInstance::ClConnectionStarted,
|
|
MoonlightInstance::ClConnectionTerminated,
|
|
MoonlightInstance::ClDisplayMessage,
|
|
MoonlightInstance::ClDisplayTransientMessage
|
|
}; |