Have FLTK follow the Wayland surface holding keyboard focus.

This commit is contained in:
ManoloFLTK 2022-05-13 09:13:11 +02:00
parent 4b30f78567
commit 7fe6f4cf1d
2 changed files with 5 additions and 3 deletions

View File

@ -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,

View File

@ -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();
}