summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2023-04-17 08:19:59 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2023-04-17 08:19:59 +0200
commit256e368368767da8166fb107b0882a4799f7d53f (patch)
tree2895de7a71bab950bee82e17f86988e517fd43c8 /src
parentac76239db7f25fbc14ec2351bcb99cc3f6dcc2f4 (diff)
Wayland: account for memorised keyboard surface before wl_surface_destroy()
Diffstat (limited to 'src')
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx1
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx11
2 files changed, 7 insertions, 5 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
index b327f7bc2..e76820057 100644
--- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
@@ -553,6 +553,7 @@ static void wl_keyboard_enter(void *data, struct wl_keyboard *wl_keyboard,
{
struct Fl_Wayland_Screen_Driver::seat *seat = (struct Fl_Wayland_Screen_Driver::seat*)data;
//fprintf(stderr, "keyboard enter fl_win=%p; keys pressed are: ", Fl_Wayland_Window_Driver::surface_to_window(surface));
+ key_vector.size(0);
// Replace wl_array_for_each(p, keys) rejected by C++
for (uint32_t *p = (uint32_t *)(keys)->data;
(const char *) p < ((const char *) (keys)->data + (keys)->size);
diff --git a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
index 6a1778698..d13386ec7 100644
--- a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
@@ -421,8 +421,9 @@ static void delayed_delete_Fl_X(Fl_X *i) {
static void destroy_surface_caution_pointer_focus(struct wl_surface *surface,
- Fl_Wayland_Screen_Driver *scr_driver) {
- if (scr_driver->seat->pointer_focus == surface) scr_driver->seat->pointer_focus = NULL;
+ struct Fl_Wayland_Screen_Driver::seat *seat) {
+ if (seat->pointer_focus == surface) seat->pointer_focus = NULL;
+ if (seat->keyboard_surface == surface) seat->keyboard_surface = NULL;
wl_surface_destroy(surface);
}
@@ -463,7 +464,7 @@ void Fl_Wayland_Window_Driver::hide() {
}
if (wld_win->wl_surface) {
Fl_Wayland_Screen_Driver *scr_driver = (Fl_Wayland_Screen_Driver*)Fl::screen_driver();
- destroy_surface_caution_pointer_focus(wld_win->wl_surface, scr_driver);
+ destroy_surface_caution_pointer_focus(wld_win->wl_surface, scr_driver->seat);
wld_win->wl_surface = NULL;
}
if (wld_win->custom_cursor) delete_cursor_(wld_win);
@@ -1272,7 +1273,7 @@ void Fl_Wayland_Window_Driver::makeWindow()
// a tall menuwindow with a menutitle: don't create the menutitle at all
// and undo what has been created/allocated before
struct wld_window *xid = fl_wl_xid(previous_floatingtitle);
- destroy_surface_caution_pointer_focus(xid->wl_surface, scr_driver);
+ destroy_surface_caution_pointer_focus(xid->wl_surface, scr_driver->seat);
free(xid);
Fl_Window_Driver::driver(previous_floatingtitle)->hide_common();
previous_floatingtitle = NULL;
@@ -1765,7 +1766,7 @@ void Fl_Wayland_Window_Driver::reposition_menu_window(int x, int y) {
xdg_popup_destroy(old_popup);
delete old_win_pos;
xdg_surface_destroy(old_xdg);
- destroy_surface_caution_pointer_focus(old_surface, scr_driver);
+ destroy_surface_caution_pointer_focus(old_surface, scr_driver->seat);
this->y(y);
}