Commit fc998b8ec963101466ee9827423ee29b270d93a2

Ethan Lee 2021-11-08T12:37:10

wayland: Return true for HasScreenKeyboardSupport only if no physical keyboard exists

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/src/video/wayland/SDL_waylandkeyboard.c b/src/video/wayland/SDL_waylandkeyboard.c
index 747a886..3695e1e 100644
--- a/src/video/wayland/SDL_waylandkeyboard.c
+++ b/src/video/wayland/SDL_waylandkeyboard.c
@@ -140,8 +140,13 @@ Wayland_SetTextInputRect(_THIS, SDL_Rect *rect)
 SDL_bool
 Wayland_HasScreenKeyboardSupport(_THIS)
 {
+    /* In reality we just want to return tru when the screen keyboard is the
+     * _only_ way to get text input. So, in addition to checking for the text
+     * input protocol, make sure we don't have any physical keyboards either.
+     */
     SDL_VideoData *driverdata = _this->driverdata;
-    return (driverdata->text_input_manager != NULL);
+    return (driverdata->input->keyboard == NULL &&
+            driverdata->text_input_manager != NULL);
 }
 
 #endif /* SDL_VIDEO_DRIVER_WAYLAND */