aboutsummaryrefslogtreecommitdiff
path: root/cast/standalone_receiver/sdl_glue.cc
diff options
context:
space:
mode:
Diffstat (limited to 'cast/standalone_receiver/sdl_glue.cc')
-rw-r--r--cast/standalone_receiver/sdl_glue.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/cast/standalone_receiver/sdl_glue.cc b/cast/standalone_receiver/sdl_glue.cc
index 7c2c94da..c4619f09 100644
--- a/cast/standalone_receiver/sdl_glue.cc
+++ b/cast/standalone_receiver/sdl_glue.cc
@@ -4,6 +4,8 @@
#include "cast/standalone_receiver/sdl_glue.h"
+#include <utility>
+
#include "platform/api/task_runner.h"
#include "platform/api/time.h"
#include "util/osp_logging.h"
@@ -21,6 +23,11 @@ SDLEventLoopProcessor::SDLEventLoopProcessor(
SDLEventLoopProcessor::~SDLEventLoopProcessor() = default;
+void SDLEventLoopProcessor::RegisterForKeyboardEvent(
+ SDLEventLoopProcessor::KeyboardEventCallback cb) {
+ keyboard_callbacks_.push_back(std::move(cb));
+}
+
void SDLEventLoopProcessor::ProcessPendingEvents() {
// Process all pending events.
SDL_Event event;
@@ -30,6 +37,10 @@ void SDLEventLoopProcessor::ProcessPendingEvents() {
if (quit_callback_) {
quit_callback_();
}
+ } else if (event.type == SDL_KEYUP) {
+ for (auto& cb : keyboard_callbacks_) {
+ cb(event.key);
+ }
}
}