summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2023-10-23 16:21:16 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2023-10-23 16:21:16 +0200
commit3307a1281f9487eef0c3f9e628c3160765688575 (patch)
tree5511110c17eb5238133267f323a88b328cde63f7 /src/drivers
parentfa1f00cc468ab45d996c3170aee68a4155410c2e (diff)
Prepare Fl_Wayland_Screen_driver.cxx for removal of Fl_Int_Vector
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx19
1 files changed, 18 insertions, 1 deletions
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 <FL/platform.H>
#include <FL/fl_ask.H>
#include <FL/filename.H>
-#include "../../Fl_Int_Vector.H"
+#if FLTK_USE_STD
+# include <vector>
+ typedef std::vector<int> Fl_Int_Vector;
+#else
+# include "../../Fl_Int_Vector.H"
+#endif
#include "../../print_button.h"
#include <dlfcn.h>
#include <linux/input.h>
@@ -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
}