aboutsummaryrefslogtreecommitdiff
path: root/src/input.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/input.c')
-rw-r--r--src/input.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/input.c b/src/input.c
index e082393..93aed4e 100644
--- a/src/input.c
+++ b/src/input.c
@@ -410,6 +410,25 @@ bool pw_input_iterate(struct pw_input *input, struct pw_framebuffer *fb) {
return update_mouse(input, fb);
}
+enum pw_window_flags pw_input_window(struct pw_input *input) {
+ enum pw_window_flags result = PW_WINDOW_NONE;
+ if (!input) {
+ SDL_InvalidParamError("input");
+ return result;
+ }
+
+ SDL_WindowFlags flags = SDL_GetWindowFlags(input->window);
+ if (!(flags &
+ (SDL_WINDOW_MINIMIZED | SDL_WINDOW_HIDDEN | SDL_WINDOW_MINIMIZED))) {
+ result |= PW_WINDOW_VISIBLE;
+ }
+ if (flags & SDL_WINDOW_INPUT_FOCUS) {
+ result |= PW_WINDOW_FOCUS;
+ }
+
+ return result;
+}
+
size_t pw_input_players(struct pw_input *input) {
if (!input) {
SDL_InvalidParamError("input");
@@ -451,6 +470,22 @@ enum pw_keymod pw_input_keymod(struct pw_input *input) {
return input->keyboard.mod;
}
+bool pw_input_key(struct pw_input *input, int32_t *key) {
+ if (!input) {
+ if (key) {
+ *key = -1;
+ }
+ return SDL_InvalidParamError("input");
+ }
+
+ struct pw_keyboard_queue *q = &input->keyboard.text;
+ if (key) {
+ return dequeue_item(q, (uint32_t *)key);
+ } else {
+ return q->start != q->end;
+ }
+}
+
enum pw_mouse_button pw_input_mouse(struct pw_input *input,
struct pw_coordinates *pos) {
if (!input) {