diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2023-03-26 17:38:44 +0200 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2023-03-26 17:38:44 +0200 |
| commit | cce40848ce89df2b3a68cbda2aae3e03feee3cfa (patch) | |
| tree | 7ddf6ea8e69ce213f9543793897eb4a0dace119b /src | |
| parent | a242e4a65d0f6e58520d014ad96eb38ebfcd831a (diff) | |
Improve methods Fl_Wayland_Screen_Driver::en/disable_im()
Diffstat (limited to 'src')
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx index ef19578cf..2eaa69b0d 100644 --- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx @@ -802,16 +802,6 @@ static const struct wl_keyboard_listener wl_keyboard_listener = { }; -void Fl_Wayland_Screen_Driver::enable_im() { - if (seat->text_input) zwp_text_input_v3_enable(seat->text_input); -} - - -void Fl_Wayland_Screen_Driver::disable_im() { - if (seat->text_input) zwp_text_input_v3_disable(seat->text_input); -} - - void text_input_enter(void *data, struct zwp_text_input_v3 *zwp_text_input_v3, struct wl_surface *surface) { //puts("text_input_enter"); @@ -883,6 +873,25 @@ static const struct zwp_text_input_v3_listener text_input_listener = { }; +void Fl_Wayland_Screen_Driver::enable_im() { + if (text_input_base && !seat->text_input) { + seat->text_input = zwp_text_input_manager_v3_get_text_input(text_input_base, seat->wl_seat); + //printf("seat->text_input=%p\n",seat->text_input); + zwp_text_input_v3_add_listener(seat->text_input, &text_input_listener, NULL); + } +} + + +void Fl_Wayland_Screen_Driver::disable_im() { + if (seat->text_input) { + zwp_text_input_v3_disable(seat->text_input); + zwp_text_input_v3_commit(seat->text_input); + zwp_text_input_v3_destroy(seat->text_input); + seat->text_input = NULL; + } +} + + static void seat_capabilities(void *data, struct wl_seat *wl_seat, uint32_t capabilities) { struct seat *seat = (struct seat*)data; @@ -908,11 +917,7 @@ static void seat_capabilities(void *data, struct wl_seat *wl_seat, uint32_t capa seat->wl_keyboard = NULL; } Fl_Wayland_Screen_Driver *scr_driver = (Fl_Wayland_Screen_Driver*)Fl::screen_driver(); - if (scr_driver->text_input_base) { - seat->text_input = zwp_text_input_manager_v3_get_text_input(scr_driver->text_input_base, seat->wl_seat); -//printf("seat->text_input=%p\n",seat->text_input); - zwp_text_input_v3_add_listener(seat->text_input, &text_input_listener, NULL); - } + scr_driver->enable_im(); } static void seat_name(void *data, struct wl_seat *wl_seat, const char *name) { |
