|
|
commit 7fe6f4cf1d155235922956b242fb40d28e89b135
Author: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Fri May 13 09:13:11 2022 +0200
Commit: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Fri May 13 09:13:11 2022 +0200
Have FLTK follow the Wayland surface holding keyboard focus.
src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx | 5 +++++
src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx | 3 ---
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
index fef6e43..7b12ca1 100644
--- src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
+++ 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 src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
index f7a93fb..4dddcd1 100644
--- src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
+++ 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();
}
[ Direct Link to Message ] | |
|
| |