diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-05-13 09:13:11 +0200 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-05-13 09:13:11 +0200 |
| commit | 7fe6f4cf1d155235922956b242fb40d28e89b135 (patch) | |
| tree | 6908dd56eaaffc12c1386707678769c462f2e6f5 | |
| parent | 4b30f78567e09e46f40d13d418bba6dd273d65af (diff) | |
Have FLTK follow the Wayland surface holding keyboard focus.
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx | 5 | ||||
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx index fef6e43f7..7b12ca124 100644 --- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx @@ -512,6 +512,9 @@ static void wl_keyboard_enter(void *data, struct wl_keyboard *wl_keyboard, //fprintf(stderr, "keyboard enter fl_win=%p; keys pressed are:\n", Fl_Wayland_Screen_Driver::surface_to_window(surface)); seat->keyboard_surface = surface; seat->keyboard_enter_serial = serial; + Fl_Window *win = Fl_Wayland_Screen_Driver::surface_to_window(surface); + Fl::handle(FL_FOCUS, win); + fl_find(fl_xid(win)); } struct key_repeat_data_t { @@ -704,6 +707,8 @@ static void wl_keyboard_leave(void *data, struct wl_keyboard *wl_keyboard, struct seat *seat = (struct seat*)data; //fprintf(stderr, "keyboard leave fl_win=%p\n", Fl_Wayland_Screen_Driver::surface_to_window(surface)); seat->keyboard_surface = NULL; + Fl_Window *win = Fl_Wayland_Screen_Driver::surface_to_window(surface); + if (win) Fl::handle(FL_UNFOCUS, win); } static void wl_keyboard_modifiers(void *data, struct wl_keyboard *wl_keyboard, diff --git a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx index f7a93fb7e..4dddcd146 100644 --- a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx @@ -795,8 +795,6 @@ static void handle_configure(struct libdecor_frame *frame, else if (window_state & LIBDECOR_WINDOW_STATE_ACTIVE) { if (!window->fl_win->border()) libdecor_frame_set_visibility(window->frame, false); else if (!libdecor_frame_is_visible(window->frame)) libdecor_frame_set_visibility(window->frame, true); - Fl::handle(FL_FOCUS, window->fl_win); - fl_find(window); } if (window_state & LIBDECOR_WINDOW_STATE_MAXIMIZED) state = libdecor_state_new(width, height); @@ -876,7 +874,6 @@ static void xdg_surface_configure(void *data, struct xdg_surface *xdg_surface, u } window->configured_width = window->fl_win->w(); window->configured_height = window->fl_win->h(); - Fl::handle(FL_FOCUS, window->fl_win); window->fl_win->redraw(); Fl_Window_Driver::driver(window->fl_win)->flush(); } |
