mirror of https://github.com/fltk/fltk
Slight simplification of Fl_Wayland_Gl_Window_Driver::swap_buffers()
Also, reorder members of class Fl_Wayland_Gl_Window_Driver
This commit is contained in:
parent
81615bbe0b
commit
f5879ae228
|
@ -106,7 +106,7 @@ member functions of class \c Fl_Wayland_Screen_Driver.
|
|||
Furthermore, class \c Fl_Unix_System_Driver is used by both the Wayland and the X11
|
||||
FLTK platforms.
|
||||
|
||||
The public C API to Wayland, xkb and libdecor libraries are obtained with
|
||||
The public C API to Wayland, xkb, EGL and libdecor libraries are obtained with
|
||||
\code
|
||||
#include <wayland-client.h>
|
||||
#include <wayland-cursor.h>
|
||||
|
@ -115,6 +115,10 @@ The public C API to Wayland, xkb and libdecor libraries are obtained with
|
|||
#include <linux/input.h> // for BTN_LEFT, BTN_RIGHT, BTN_MIDDLE
|
||||
#include "../../../libdecor/src/libdecor.h"
|
||||
#include "../../../libdecor/src/libdecor-plugin.h"
|
||||
#if HAVE_GL
|
||||
# include <wayland-egl.h>
|
||||
# include <EGL/egl.h>
|
||||
#endif // HAVE_GL
|
||||
\endcode
|
||||
as necessary.
|
||||
|
||||
|
@ -1044,11 +1048,9 @@ set to use OpenGL.
|
|||
FLTK calls function \c Fl_Wayland_Gl_Window_Driver::swap_buffers() each time it wants a GL context
|
||||
to be sent to the display. This function contains some pure GL code to emulate an overlay buffer
|
||||
to support Fl_Gl_Window objects overriding their \c draw_overlay() member function.
|
||||
Then, it calls function \c eglSwapBuffers() after having called Wayland code to synchronize EGL use
|
||||
Then, it calls function \c eglSwapBuffers() after having called
|
||||
\c wl_display_dispatch_pending() to synchronize EGL use
|
||||
with the rest of the Wayland compositor's activity.
|
||||
This synchronization procedure is as explained in the
|
||||
<a href=https://wayland.freedesktop.org/docs/html/apb.html#Client-classwl__display>
|
||||
description of function wl_display_prepare_read_queue()</a>.
|
||||
|
||||
|
||||
\section wayland-type FLTK-defined, Wayland-specific types
|
||||
|
|
|
@ -35,6 +35,11 @@ Consequently, FL_DOUBLE is enforced in all Fl_Gl_Window::mode_ values under Wayl
|
|||
class Fl_Wayland_Gl_Window_Driver : public Fl_Gl_Window_Driver {
|
||||
friend Fl_Gl_Window_Driver* Fl_Gl_Window_Driver::newGlWindowDriver(Fl_Gl_Window *);
|
||||
friend class Fl_Wayland_Gl_Plugin;
|
||||
private:
|
||||
static EGLDisplay egl_display;
|
||||
static EGLint configs_count;
|
||||
struct wl_egl_window *egl_window;
|
||||
EGLSurface egl_surface;
|
||||
bool egl_swap_in_progress;
|
||||
Fl_Wayland_Gl_Window_Driver(Fl_Gl_Window *win);
|
||||
float pixels_per_unit() FL_OVERRIDE;
|
||||
|
@ -52,11 +57,7 @@ class Fl_Wayland_Gl_Window_Driver : public Fl_Gl_Window_Driver {
|
|||
void gl_start() FL_OVERRIDE;
|
||||
void gl_visual(Fl_Gl_Choice *c) FL_OVERRIDE;
|
||||
char *alpha_mask_for_string(const char *str, int n, int w, int h, Fl_Fontsize fs) FL_OVERRIDE;
|
||||
static EGLDisplay egl_display;
|
||||
static EGLint configs_count;
|
||||
void init();
|
||||
struct wl_egl_window *egl_window;
|
||||
EGLSurface egl_surface;
|
||||
public:
|
||||
//virtual bool need_scissor() { return true; } // CONTROL_LEAKING_SUB_GL_WINDOWS
|
||||
//void apply_scissor(); // CONTROL_LEAKING_SUB_GL_WINDOWS
|
||||
|
|
|
@ -358,11 +358,7 @@ void Fl_Wayland_Gl_Window_Driver::swap_buffers() {
|
|||
|
||||
if (egl_surface && !egl_swap_in_progress) {
|
||||
egl_swap_in_progress = true; // prevents crash while down resizing rotating glpuzzle
|
||||
while (wl_display_prepare_read(Fl_Wayland_Screen_Driver::wl_display) != 0) {
|
||||
wl_display_dispatch_pending(Fl_Wayland_Screen_Driver::wl_display);
|
||||
}
|
||||
wl_display_flush(Fl_Wayland_Screen_Driver::wl_display);
|
||||
wl_display_read_events(Fl_Wayland_Screen_Driver::wl_display);
|
||||
wl_display_dispatch_pending(Fl_Wayland_Screen_Driver::wl_display);
|
||||
eglSwapBuffers(Fl_Wayland_Gl_Window_Driver::egl_display, egl_surface);
|
||||
egl_swap_in_progress = false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue