@@ -51,42 +51,51 @@ void Wayland_QuitKeyboard(_THIS)
51
51
#endif
52
52
}
53
53
54
+ void Wayland_EnableTextInput (SDL_WaylandTextInput * text_input )
55
+ {
56
+ const SDL_Rect * rect = & text_input -> cursor_rect ;
57
+
58
+ /* For some reason this has to be done twice, it appears to be a
59
+ * bug in mutter? Maybe?
60
+ * -flibit
61
+ */
62
+ zwp_text_input_v3_enable (text_input -> text_input );
63
+ zwp_text_input_v3_commit (text_input -> text_input );
64
+ zwp_text_input_v3_enable (text_input -> text_input );
65
+ zwp_text_input_v3_commit (text_input -> text_input );
66
+
67
+ /* Now that it's enabled, set the input properties */
68
+ zwp_text_input_v3_set_content_type (text_input -> text_input ,
69
+ ZWP_TEXT_INPUT_V3_CONTENT_HINT_NONE ,
70
+ ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NORMAL );
71
+ if (!SDL_RectEmpty (rect )) {
72
+ /* This gets reset on enable so we have to cache it */
73
+ zwp_text_input_v3_set_cursor_rectangle (text_input -> text_input ,
74
+ rect -> x ,
75
+ rect -> y ,
76
+ rect -> w ,
77
+ rect -> h );
78
+ }
79
+ zwp_text_input_v3_commit (text_input -> text_input );
80
+ }
81
+
54
82
void Wayland_StartTextInput (_THIS )
55
83
{
56
84
SDL_VideoData * driverdata = _this -> driverdata ;
57
85
58
86
if (driverdata -> text_input_manager ) {
59
87
struct SDL_WaylandInput * input = driverdata -> input ;
60
88
if (input && input -> text_input ) {
61
- const SDL_Rect * rect = & input -> text_input -> cursor_rect ;
62
-
63
89
/* Don't re-enable if we're already enabled. */
64
90
if (input -> text_input -> is_enabled ) {
65
91
return ;
66
92
}
67
93
68
- /* For some reason this has to be done twice, it appears to be a
69
- * bug in mutter? Maybe?
70
- * -flibit
71
- */
72
- zwp_text_input_v3_enable (input -> text_input -> text_input );
73
- zwp_text_input_v3_commit (input -> text_input -> text_input );
74
- zwp_text_input_v3_enable (input -> text_input -> text_input );
75
- zwp_text_input_v3_commit (input -> text_input -> text_input );
76
-
77
- /* Now that it's enabled, set the input properties */
78
- zwp_text_input_v3_set_content_type (input -> text_input -> text_input ,
79
- ZWP_TEXT_INPUT_V3_CONTENT_HINT_NONE ,
80
- ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NORMAL );
81
- if (!SDL_RectEmpty (rect )) {
82
- /* This gets reset on enable so we have to cache it */
83
- zwp_text_input_v3_set_cursor_rectangle (input -> text_input -> text_input ,
84
- rect -> x ,
85
- rect -> y ,
86
- rect -> w ,
87
- rect -> h );
94
+ Wayland_EnableTextInput (input -> text_input );
95
+ if (input -> xkb .compose_state ) {
96
+ /* Reset compose state so composite and dead keys don't carry over */
97
+ WAYLAND_xkb_compose_state_reset (input -> xkb .compose_state );
88
98
}
89
- zwp_text_input_v3_commit (input -> text_input -> text_input );
90
99
input -> text_input -> is_enabled = SDL_TRUE ;
91
100
}
92
101
}
0 commit comments