From 3307a1281f9487eef0c3f9e628c3160765688575 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Mon, 23 Oct 2023 16:21:16 +0200 Subject: Prepare Fl_Wayland_Screen_driver.cxx for removal of Fl_Int_Vector --- src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx index b42e17814..a82afff73 100644 --- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx @@ -26,7 +26,12 @@ #include #include #include -#include "../../Fl_Int_Vector.H" +#if FLTK_USE_STD +# include + typedef std::vector Fl_Int_Vector; +#else +# include "../../Fl_Int_Vector.H" +#endif #include "../../print_button.h" #include #include @@ -490,8 +495,12 @@ static int search_int_vector(Fl_Int_Vector& v, int val) { static void remove_int_vector(Fl_Int_Vector& v, int val) { int pos = search_int_vector(v, val); if (pos < 0) return; +#if FLTK_USE_STD + v.erase(v.begin()+pos); +#else int last = v.pop_back(); if (last != val) v[pos] = last; +#endif } @@ -519,7 +528,11 @@ 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)); +#if FLTK_USE_STD + key_vector.clear(); +#else key_vector.size(0); +#endif // 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); @@ -759,7 +772,11 @@ static void wl_keyboard_leave(void *data, struct wl_keyboard *wl_keyboard, Fl_Window *win = Fl_Wayland_Window_Driver::surface_to_window(surface); if (!win && Fl::focus()) win = Fl::focus()->top_window(); if (win) Fl::handle(FL_UNFOCUS, win); +#if FLTK_USE_STD + key_vector.clear(); +#else key_vector.size(0); +#endif } -- cgit v1.2.3