mirror of
https://github.com/fltk/fltk.git
synced 2026-06-01 06:14:28 +08:00
Wayland: reduce the number of platform-specific FL_EXPORT directives.
This commit is contained in:
@@ -71,8 +71,8 @@ Fl_Wayland_Gl_Window_Driver::Fl_Wayland_Gl_Window_Driver(Fl_Gl_Window *win) : Fl
|
|||||||
void Fl_Wayland_Gl_Window_Driver::init() {
|
void Fl_Wayland_Gl_Window_Driver::init() {
|
||||||
EGLint major, minor;
|
EGLint major, minor;
|
||||||
|
|
||||||
if (!Fl_Wayland_Screen_Driver::wl_display) fl_open_display();
|
if (!fl_wl_display()) fl_open_display();
|
||||||
egl_display = eglGetDisplay((EGLNativeDisplayType) Fl_Wayland_Screen_Driver::wl_display);
|
egl_display = eglGetDisplay((EGLNativeDisplayType) fl_wl_display());
|
||||||
if (egl_display == EGL_NO_DISPLAY) {
|
if (egl_display == EGL_NO_DISPLAY) {
|
||||||
Fl::fatal("Can't create egl display\n");
|
Fl::fatal("Can't create egl display\n");
|
||||||
}
|
}
|
||||||
@@ -86,17 +86,14 @@ void Fl_Wayland_Gl_Window_Driver::init() {
|
|||||||
//printf("EGL has %d configs\n", configs_count);
|
//printf("EGL has %d configs\n", configs_count);
|
||||||
eglBindAPI(EGL_OPENGL_API);
|
eglBindAPI(EGL_OPENGL_API);
|
||||||
|
|
||||||
gl_event_queue = wl_display_create_queue(Fl_Wayland_Screen_Driver::wl_display);
|
gl_event_queue = wl_display_create_queue(fl_wl_display());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char *Fl_Wayland_Gl_Window_Driver::alpha_mask_for_string(const char *str, int n, int w, int h, Fl_Fontsize fs)
|
char *Fl_Wayland_Gl_Window_Driver::alpha_mask_for_string(const char *str, int n, int w, int h, Fl_Fontsize fs)
|
||||||
{
|
{
|
||||||
// write str to a bitmap just big enough
|
// write str to a bitmap just big enough
|
||||||
struct wld_window *save_win = Fl_Wayland_Window_Driver::wld_window;
|
|
||||||
fl_window = Fl_Wayland_Window_Driver::wld_window = NULL;
|
|
||||||
Fl_Image_Surface *surf = new Fl_Image_Surface(w, h);
|
Fl_Image_Surface *surf = new Fl_Image_Surface(w, h);
|
||||||
fl_window = Fl_Wayland_Window_Driver::wld_window = save_win;
|
|
||||||
Fl_Font f=fl_font();
|
Fl_Font f=fl_font();
|
||||||
Fl_Surface_Device::push_current(surf);
|
Fl_Surface_Device::push_current(surf);
|
||||||
fl_color(FL_BLACK);
|
fl_color(FL_BLACK);
|
||||||
@@ -264,8 +261,8 @@ void Fl_Wayland_Gl_Window_Driver::make_current_before() {
|
|||||||
// Tested apps: shape, glpuzzle, cube, fractals, gl_overlay, fullscreen, unittests,
|
// Tested apps: shape, glpuzzle, cube, fractals, gl_overlay, fullscreen, unittests,
|
||||||
// OpenGL3-glut-test, OpenGL3test.
|
// OpenGL3-glut-test, OpenGL3test.
|
||||||
// Tested wayland compositors: mutter, kde-plasma, weston, sway on FreeBSD.
|
// Tested wayland compositors: mutter, kde-plasma, weston, sway on FreeBSD.
|
||||||
wl_display_roundtrip(Fl_Wayland_Screen_Driver::wl_display);
|
wl_display_roundtrip(fl_wl_display());
|
||||||
wl_display_roundtrip(Fl_Wayland_Screen_Driver::wl_display);
|
wl_display_roundtrip(fl_wl_display());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,11 +316,11 @@ void Fl_Wayland_Gl_Window_Driver::swap_buffers() {
|
|||||||
if (egl_surface && !egl_swap_in_progress) {
|
if (egl_surface && !egl_swap_in_progress) {
|
||||||
egl_swap_in_progress = true;
|
egl_swap_in_progress = true;
|
||||||
//eglSwapInterval(egl_display, 0); // doesn't seem to have any effect in this context
|
//eglSwapInterval(egl_display, 0); // doesn't seem to have any effect in this context
|
||||||
while (wl_display_prepare_read(Fl_Wayland_Screen_Driver::wl_display) != 0) {
|
while (wl_display_prepare_read(fl_wl_display()) != 0) {
|
||||||
wl_display_dispatch_pending(Fl_Wayland_Screen_Driver::wl_display);
|
wl_display_dispatch_pending(fl_wl_display());
|
||||||
}
|
}
|
||||||
wl_display_read_events(Fl_Wayland_Screen_Driver::wl_display);
|
wl_display_read_events(fl_wl_display());
|
||||||
wl_display_dispatch_queue_pending(Fl_Wayland_Screen_Driver::wl_display, gl_event_queue);
|
wl_display_dispatch_queue_pending(fl_wl_display(), gl_event_queue);
|
||||||
eglSwapBuffers(Fl_Wayland_Gl_Window_Driver::egl_display, egl_surface);
|
eglSwapBuffers(Fl_Wayland_Gl_Window_Driver::egl_display, egl_surface);
|
||||||
egl_swap_in_progress = false;
|
egl_swap_in_progress = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class Fl_Wayland_Screen_Driver : public Fl_Screen_Driver
|
|||||||
static int insertion_point_height;
|
static int insertion_point_height;
|
||||||
static bool insertion_point_location_is_valid;
|
static bool insertion_point_location_is_valid;
|
||||||
public:
|
public:
|
||||||
static FL_EXPORT struct wl_display *wl_display;
|
static struct wl_display *wl_display;
|
||||||
static void insertion_point_location(int x, int y, int height);
|
static void insertion_point_location(int x, int y, int height);
|
||||||
static bool insertion_point_location(int *px, int *py, int *pwidth, int *pheight);
|
static bool insertion_point_location(int *px, int *py, int *pwidth, int *pheight);
|
||||||
int get_mouse_unscaled(int &xx, int &yy);
|
int get_mouse_unscaled(int &xx, int &yy);
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ public:
|
|||||||
struct xdg_toplevel *xdg_toplevel();
|
struct xdg_toplevel *xdg_toplevel();
|
||||||
Fl_Wayland_Window_Driver(Fl_Window*);
|
Fl_Wayland_Window_Driver(Fl_Window*);
|
||||||
virtual ~Fl_Wayland_Window_Driver();
|
virtual ~Fl_Wayland_Window_Driver();
|
||||||
static FL_EXPORT struct wld_window *wld_window;
|
static struct wld_window *wld_window;
|
||||||
static void redraw(struct wld_window *window);
|
static void redraw(struct wld_window *window);
|
||||||
|
|
||||||
static inline Fl_Wayland_Window_Driver* driver(const Fl_Window *w) {return (Fl_Wayland_Window_Driver*)Fl_Window_Driver::driver(w);}
|
static inline Fl_Wayland_Window_Driver* driver(const Fl_Window *w) {return (Fl_Wayland_Window_Driver*)Fl_Window_Driver::driver(w);}
|
||||||
|
|||||||
Reference in New Issue
Block a user