summaryrefslogtreecommitdiff
path: root/src/drivers/Wayland
diff options
context:
space:
mode:
authorMatthiasWM <visualc.git@matthiasm.com>2023-11-29 13:16:35 +0100
committerMatthiasWM <visualc.git@matthiasm.com>2023-11-29 13:16:35 +0100
commit06e2bd7f0e295a34c28ddbb4fa7a03644540bb5c (patch)
tree0c0f9fc3cbb5d290e56ce373695de4991c78bf64 /src/drivers/Wayland
parent75c879e2ff5022a4084b259c53a769d77ae13713 (diff)
parent44b845cc42b9a0326b6aa3438462bcd1b77ddeb4 (diff)
Merge branch 'master' of https://github.com/fltk/fltk
Diffstat (limited to 'src/drivers/Wayland')
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.H2
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx18
2 files changed, 20 insertions, 0 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.H b/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.H
index 83b13e155..df321fc10 100644
--- a/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.H
+++ b/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.H
@@ -46,6 +46,8 @@ private:
void swap_buffers() FL_OVERRIDE;
void resize(int is_a_resize, int w, int h) FL_OVERRIDE;
char swap_type() FL_OVERRIDE;
+ void swap_interval(int) FL_OVERRIDE;
+ int swap_interval() const FL_OVERRIDE;
Fl_Gl_Choice *find(int m, const int *alistp) FL_OVERRIDE;
GLContext create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g) FL_OVERRIDE;
void set_gl_context(Fl_Window* w, GLContext context) FL_OVERRIDE;
diff --git a/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
index 4553c1a0e..ac625fe6f 100644
--- a/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
@@ -63,6 +63,9 @@ struct gl_start_support { // to support use of gl_start / gl_finish
static EGLConfig wld_egl_conf = NULL;
+static EGLint swap_interval_ = 1;
+static EGLint max_swap_interval = 1000;
+static EGLint min_swap_interval = 0;
EGLDisplay Fl_Wayland_Gl_Window_Driver::egl_display = EGL_NO_DISPLAY;
@@ -170,6 +173,9 @@ Fl_Gl_Choice *Fl_Wayland_Gl_Window_Driver::find(int m, const int *alistp)
Fl::fatal("failed to choose an EGL config\n");
}
+ eglGetConfigAttrib(egl_display, g->egl_conf, EGL_MAX_SWAP_INTERVAL, &max_swap_interval);
+ eglGetConfigAttrib(egl_display, g->egl_conf, EGL_MIN_SWAP_INTERVAL, &min_swap_interval);
+
first = g;
return g;
}
@@ -431,6 +437,18 @@ void Fl_Wayland_Gl_Window_Driver::gl_start() {
glClear(GL_COLOR_BUFFER_BIT);
}
+void Fl_Wayland_Gl_Window_Driver::swap_interval(int interval) {
+ if (interval < min_swap_interval) interval = min_swap_interval;
+ if (interval > max_swap_interval) interval = max_swap_interval;
+ if (egl_display && eglSwapInterval(egl_display, interval))
+ swap_interval_ = interval;
+ // printf("swap_interval_=%d\n",swap_interval_);
+}
+
+
+int Fl_Wayland_Gl_Window_Driver::swap_interval() const {
+ return swap_interval_;
+}
FL_EXPORT EGLContext fl_wl_glcontext(GLContext rc) { return (EGLContext)rc; }