mirror of
https://github.com/fltk/fltk.git
synced 2026-08-18 00:48:43 +08:00
Wayland: improve key repeat and window focus.
Test program windowfocus would erroneously repeat a single typed character. Function xdg_toplevel_set_parent() is best followed by a call to wl_surface_commit().
This commit is contained in:
@@ -880,11 +880,6 @@ static void wl_keyboard_key(void *data, struct wl_keyboard *wl_keyboard,
|
||||
// otherwise send it to Wayland-defined focus window
|
||||
Fl_Window *win = ( Fl::focus() ? Fl::focus()->top_window() :
|
||||
Fl_Wayland_Window_Driver::surface_to_window(seat->keyboard_surface) );
|
||||
if (win) {
|
||||
set_event_xy(win);
|
||||
Fl::e_is_click = 0;
|
||||
Fl::handle(event, win);
|
||||
}
|
||||
if (event == FL_KEYDOWN && status == XKB_COMPOSE_NOTHING &&
|
||||
!(sym >= FL_Shift_L && sym <= FL_Alt_R)) {
|
||||
// Handling of key repeats :
|
||||
@@ -903,6 +898,11 @@ static void wl_keyboard_key(void *data, struct wl_keyboard *wl_keyboard,
|
||||
Fl::add_timeout(key_repeat_delay, (Fl_Timeout_Handler)key_repeat_timer_cb,
|
||||
key_repeat_data);
|
||||
}
|
||||
if (win) {
|
||||
set_event_xy(win);
|
||||
Fl::e_is_click = 0;
|
||||
Fl::handle(event, win);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ void Fl_Wayland_Window_Driver::take_focus()
|
||||
xdg_toplevel_set_parent(xdg_toplevel(), top_dr->xdg_toplevel());
|
||||
// this will remove the parent-child relationship
|
||||
xdg_toplevel_set_parent(xdg_toplevel(), NULL);
|
||||
wl_display_roundtrip(Fl_Wayland_Screen_Driver::wl_display);
|
||||
wl_surface_commit(w->wl_surface);
|
||||
}
|
||||
// this sets the first window
|
||||
fl_wl_find(w);
|
||||
|
||||
Reference in New Issue
Block a user