mirror of
https://github.com/fltk/fltk.git
synced 2026-05-30 04:55:29 +08:00
Separate platform init functions from platform-specific driver files
This commit is contained in:
+30
-6
@@ -210,6 +210,7 @@ if (FLTK_USE_X11)
|
|||||||
drivers/Xlib/Fl_Xlib_Graphics_Driver_vertex.cxx
|
drivers/Xlib/Fl_Xlib_Graphics_Driver_vertex.cxx
|
||||||
drivers/Xlib/Fl_Xlib_Copy_Surface_Driver.cxx
|
drivers/Xlib/Fl_Xlib_Copy_Surface_Driver.cxx
|
||||||
drivers/Xlib/Fl_Xlib_Image_Surface_Driver.cxx
|
drivers/Xlib/Fl_Xlib_Image_Surface_Driver.cxx
|
||||||
|
drivers/X11/fl_X11_platform_init.cxx
|
||||||
Fl_x.cxx
|
Fl_x.cxx
|
||||||
fl_dnd_x.cxx
|
fl_dnd_x.cxx
|
||||||
Fl_Native_File_Chooser_FLTK.cxx
|
Fl_Native_File_Chooser_FLTK.cxx
|
||||||
@@ -240,7 +241,10 @@ if (FLTK_USE_X11)
|
|||||||
drivers/X11/Fl_X11_Window_Driver.H
|
drivers/X11/Fl_X11_Window_Driver.H
|
||||||
drivers/X11/Fl_X11_System_Driver.H
|
drivers/X11/Fl_X11_System_Driver.H
|
||||||
drivers/Xlib/Fl_Font.H
|
drivers/Xlib/Fl_Font.H
|
||||||
)
|
drivers/Xlib/Fl_Xlib_Copy_Surface_Driver.H
|
||||||
|
drivers/Xlib/Fl_Xlib_Image_Surface_Driver.H
|
||||||
|
drivers/Unix/Fl_Unix_System_Driver.H
|
||||||
|
)
|
||||||
|
|
||||||
elseif (OPTION_USE_WAYLAND)
|
elseif (OPTION_USE_WAYLAND)
|
||||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${CMAKE_CURRENT_BINARY_DIR}")
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
@@ -255,11 +259,22 @@ elseif (OPTION_USE_WAYLAND)
|
|||||||
drivers/Wayland/Fl_Wayland_Copy_Surface_Driver.cxx
|
drivers/Wayland/Fl_Wayland_Copy_Surface_Driver.cxx
|
||||||
drivers/Wayland/Fl_Wayland_Image_Surface_Driver.cxx
|
drivers/Wayland/Fl_Wayland_Image_Surface_Driver.cxx
|
||||||
drivers/Wayland/fl_wayland_clipboard_dnd.cxx
|
drivers/Wayland/fl_wayland_clipboard_dnd.cxx
|
||||||
|
drivers/Wayland/fl_wayland_platform_init.cxx
|
||||||
drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx
|
drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx
|
||||||
Fl_Native_File_Chooser_FLTK.cxx
|
Fl_Native_File_Chooser_FLTK.cxx
|
||||||
Fl_Native_File_Chooser_GTK.cxx
|
Fl_Native_File_Chooser_GTK.cxx
|
||||||
Fl_Native_File_Chooser_Kdialog.cxx
|
Fl_Native_File_Chooser_Kdialog.cxx
|
||||||
)
|
)
|
||||||
|
set (DRIVER_HEADER_FILES
|
||||||
|
drivers/Posix/Fl_Posix_System_Driver.H
|
||||||
|
drivers/Wayland/Fl_Wayland_System_Driver.H
|
||||||
|
drivers/Wayland/Fl_Wayland_Screen_Driver.H
|
||||||
|
drivers/Wayland/Fl_Wayland_Window_Driver.H
|
||||||
|
drivers/Wayland/Fl_Wayland_Graphics_Driver.H
|
||||||
|
drivers/Wayland/Fl_Wayland_Copy_Surface_Driver.H
|
||||||
|
drivers/Wayland/Fl_Wayland_Image_Surface_Driver.H
|
||||||
|
drivers/Unix/Fl_Unix_System_Driver.H
|
||||||
|
)
|
||||||
|
|
||||||
elseif (APPLE)
|
elseif (APPLE)
|
||||||
|
|
||||||
@@ -281,6 +296,7 @@ elseif (APPLE)
|
|||||||
drivers/Posix/Fl_Posix_System_Driver.cxx
|
drivers/Posix/Fl_Posix_System_Driver.cxx
|
||||||
drivers/Darwin/Fl_Darwin_System_Driver.cxx
|
drivers/Darwin/Fl_Darwin_System_Driver.cxx
|
||||||
Fl_get_key_mac.cxx
|
Fl_get_key_mac.cxx
|
||||||
|
drivers/Darwin/fl_macOS_platform_init.cxx
|
||||||
)
|
)
|
||||||
set (DRIVER_HEADER_FILES
|
set (DRIVER_HEADER_FILES
|
||||||
drivers/Posix/Fl_Posix_System_Driver.H
|
drivers/Posix/Fl_Posix_System_Driver.H
|
||||||
@@ -291,6 +307,7 @@ elseif (APPLE)
|
|||||||
drivers/Quartz/Fl_Quartz_Graphics_Driver.H
|
drivers/Quartz/Fl_Quartz_Graphics_Driver.H
|
||||||
drivers/Quartz/Fl_Quartz_Copy_Surface_Driver.H
|
drivers/Quartz/Fl_Quartz_Copy_Surface_Driver.H
|
||||||
drivers/Quartz/Fl_Font.H
|
drivers/Quartz/Fl_Font.H
|
||||||
|
drivers/Quartz/Fl_Quartz_Image_Surface_Driver.H
|
||||||
)
|
)
|
||||||
|
|
||||||
else ()
|
else ()
|
||||||
@@ -316,6 +333,7 @@ else ()
|
|||||||
fl_dnd_win32.cxx
|
fl_dnd_win32.cxx
|
||||||
Fl_Native_File_Chooser_WIN32.cxx
|
Fl_Native_File_Chooser_WIN32.cxx
|
||||||
Fl_get_key_win32.cxx
|
Fl_get_key_win32.cxx
|
||||||
|
drivers/WinAPI/fl_WinAPI_platform_init.cxx
|
||||||
)
|
)
|
||||||
set (DRIVER_HEADER_FILES
|
set (DRIVER_HEADER_FILES
|
||||||
drivers/WinAPI/Fl_WinAPI_System_Driver.H
|
drivers/WinAPI/Fl_WinAPI_System_Driver.H
|
||||||
@@ -323,6 +341,8 @@ else ()
|
|||||||
drivers/WinAPI/Fl_WinAPI_Window_Driver.H
|
drivers/WinAPI/Fl_WinAPI_Window_Driver.H
|
||||||
drivers/GDI/Fl_GDI_Graphics_Driver.H
|
drivers/GDI/Fl_GDI_Graphics_Driver.H
|
||||||
drivers/GDI/Fl_Font.H
|
drivers/GDI/Fl_Font.H
|
||||||
|
drivers/GDI/Fl_GDI_Copy_Surface_Driver.H
|
||||||
|
drivers/GDI/Fl_GDI_Image_Surface_Driver.H
|
||||||
)
|
)
|
||||||
|
|
||||||
endif (FLTK_USE_X11)
|
endif (FLTK_USE_X11)
|
||||||
@@ -372,16 +392,20 @@ set (GL_DRIVER_FILES
|
|||||||
drivers/OpenGL/Fl_OpenGL_Graphics_Driver_vertex.cxx
|
drivers/OpenGL/Fl_OpenGL_Graphics_Driver_vertex.cxx
|
||||||
)
|
)
|
||||||
if (FLTK_USE_X11)
|
if (FLTK_USE_X11)
|
||||||
set (GL_DRIVER_FILES ${GL_DRIVER_FILES} drivers/X11/Fl_X11_Gl_Window_Driver.cxx)
|
set (GL_DRIVER_FILES ${GL_DRIVER_FILES} drivers/X11/Fl_X11_Gl_Window_Driver.cxx drivers/X11/fl_X11_gl_platform_init.cxx)
|
||||||
|
set (GL_DRIVER_HEADER_FILES drivers/X11/Fl_X11_Gl_Window_Driver.H)
|
||||||
elseif (OPTION_USE_WAYLAND)
|
elseif (OPTION_USE_WAYLAND)
|
||||||
set (GL_DRIVER_FILES ${GL_DRIVER_FILES} drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx)
|
set (GL_DRIVER_FILES ${GL_DRIVER_FILES} drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx drivers/Wayland/fl_wayland_gl_platform_init.cxx)
|
||||||
|
set (GL_DRIVER_HEADER_FILES drivers/Wayland/Fl_Wayland_Gl_Window_Driver.H)
|
||||||
elseif (APPLE)
|
elseif (APPLE)
|
||||||
set (GL_DRIVER_FILES ${GL_DRIVER_FILES} drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.cxx)
|
set (GL_DRIVER_FILES ${GL_DRIVER_FILES} drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.cxx drivers/Cocoa/fl_macOS_gl_platform_init.cxx)
|
||||||
|
set (GL_DRIVER_HEADER_FILES drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.H)
|
||||||
elseif (WIN32)
|
elseif (WIN32)
|
||||||
set (GL_DRIVER_FILES ${GL_DRIVER_FILES} drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx)
|
set (GL_DRIVER_FILES ${GL_DRIVER_FILES} drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx drivers/WinAPI/fl_WinAPI_gl_platform_init.cxx)
|
||||||
|
set (GL_DRIVER_HEADER_FILES drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.H)
|
||||||
endif (FLTK_USE_X11)
|
endif (FLTK_USE_X11)
|
||||||
|
|
||||||
set (GL_DRIVER_HEADER_FILES
|
set (GL_DRIVER_HEADER_FILES ${GL_DRIVER_FILES}
|
||||||
drivers/OpenGL/Fl_OpenGL_Display_Device.H
|
drivers/OpenGL/Fl_OpenGL_Display_Device.H
|
||||||
drivers/OpenGL/Fl_OpenGL_Graphics_Driver.H
|
drivers/OpenGL/Fl_OpenGL_Graphics_Driver.H
|
||||||
)
|
)
|
||||||
|
|||||||
+13
-6
@@ -201,12 +201,15 @@ GLCPPFILES = \
|
|||||||
drivers/OpenGL/Fl_OpenGL_Graphics_Driver_rect.cxx \
|
drivers/OpenGL/Fl_OpenGL_Graphics_Driver_rect.cxx \
|
||||||
drivers/OpenGL/Fl_OpenGL_Graphics_Driver_vertex.cxx
|
drivers/OpenGL/Fl_OpenGL_Graphics_Driver_vertex.cxx
|
||||||
|
|
||||||
GLCPPFILES_OSX = drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.cxx
|
GLCPPFILES_OSX = drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.cxx \
|
||||||
GLCPPFILES_X11 = drivers/X11/Fl_X11_Gl_Window_Driver.cxx
|
drivers/Cocoa/fl_macOS_gl_platform_init.cxx
|
||||||
|
GLCPPFILES_X11 = drivers/X11/Fl_X11_Gl_Window_Driver.cxx \
|
||||||
|
drivers/X11/fl_X11_gl_platform_init.cxx
|
||||||
GLCPPFILES_XFT = $(GLCPPFILES_X11)
|
GLCPPFILES_XFT = $(GLCPPFILES_X11)
|
||||||
GLCPPFILES_WIN = drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx
|
GLCPPFILES_WIN = drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx \
|
||||||
|
drivers/WinAPI/fl_WinAPI_gl_platform_init.cxx
|
||||||
GLCPPFILES_WAYLAND = drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
|
GLCPPFILES_WAYLAND = drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx \
|
||||||
|
drivers/Wayland/fl_wayland_gl_platform_init.cxx
|
||||||
|
|
||||||
GLCPPFILES += $(GLCPPFILES_$(BUILD))
|
GLCPPFILES += $(GLCPPFILES_$(BUILD))
|
||||||
|
|
||||||
@@ -249,6 +252,7 @@ QUARTZCPPFILES = \
|
|||||||
drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx \
|
drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx \
|
||||||
drivers/Posix/Fl_Posix_System_Driver.cxx \
|
drivers/Posix/Fl_Posix_System_Driver.cxx \
|
||||||
drivers/Darwin/Fl_Darwin_System_Driver.cxx \
|
drivers/Darwin/Fl_Darwin_System_Driver.cxx \
|
||||||
|
drivers/Darwin/fl_macOS_platform_init.cxx \
|
||||||
Fl_get_key_mac.cxx
|
Fl_get_key_mac.cxx
|
||||||
|
|
||||||
# These C++ files are used under condition: BUILD_X11
|
# These C++ files are used under condition: BUILD_X11
|
||||||
@@ -268,6 +272,7 @@ XLIBCPPFILES = \
|
|||||||
drivers/Unix/Fl_Unix_System_Driver.cxx \
|
drivers/Unix/Fl_Unix_System_Driver.cxx \
|
||||||
drivers/X11/Fl_X11_System_Driver.cxx \
|
drivers/X11/Fl_X11_System_Driver.cxx \
|
||||||
drivers/Posix/Fl_Posix_Printer_Driver.cxx \
|
drivers/Posix/Fl_Posix_Printer_Driver.cxx \
|
||||||
|
drivers/X11/fl_X11_platform_init.cxx \
|
||||||
Fl_x.cxx \
|
Fl_x.cxx \
|
||||||
fl_dnd_x.cxx \
|
fl_dnd_x.cxx \
|
||||||
Fl_Native_File_Chooser_FLTK.cxx \
|
Fl_Native_File_Chooser_FLTK.cxx \
|
||||||
@@ -289,7 +294,8 @@ WLCPPFILES = \
|
|||||||
drivers/Wayland/Fl_Wayland_Image_Surface_Driver.cxx \
|
drivers/Wayland/Fl_Wayland_Image_Surface_Driver.cxx \
|
||||||
drivers/Wayland/Fl_Wayland_Copy_Surface_Driver.cxx \
|
drivers/Wayland/Fl_Wayland_Copy_Surface_Driver.cxx \
|
||||||
drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx \
|
drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx \
|
||||||
drivers/Wayland/fl_wayland_clipboard_dnd.cxx
|
drivers/Wayland/fl_wayland_platform_init.cxx \
|
||||||
|
drivers/Wayland/fl_wayland_clipboard_dnd.cxx
|
||||||
|
|
||||||
|
|
||||||
# fl_dnd_x.cxx Fl_Native_File_Chooser_GTK.cxx
|
# fl_dnd_x.cxx Fl_Native_File_Chooser_GTK.cxx
|
||||||
@@ -338,6 +344,7 @@ GDICPPFILES = \
|
|||||||
drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx \
|
drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx \
|
||||||
drivers/WinAPI/Fl_WinAPI_System_Driver.cxx \
|
drivers/WinAPI/Fl_WinAPI_System_Driver.cxx \
|
||||||
drivers/WinAPI/Fl_WinAPI_Printer_Driver.cxx \
|
drivers/WinAPI/Fl_WinAPI_Printer_Driver.cxx \
|
||||||
|
drivers/WinAPI/fl_WinAPI_platform_init.cxx \
|
||||||
Fl_win32.cxx \
|
Fl_win32.cxx \
|
||||||
fl_dnd_win32.cxx \
|
fl_dnd_win32.cxx \
|
||||||
Fl_Native_File_Chooser_WIN32.cxx \
|
Fl_Native_File_Chooser_WIN32.cxx \
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
//
|
||||||
|
// Class Fl_Cocoa_Gl_Window_Driver for the Fast Light Tool Kit (FLTK).
|
||||||
|
//
|
||||||
|
// Copyright 2021 by Bill Spitzak and others.
|
||||||
|
//
|
||||||
|
// This library is free software. Distribution and use rights are outlined in
|
||||||
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
|
// file is missing or damaged, see the license at:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/COPYING.php
|
||||||
|
//
|
||||||
|
// Please see the following page on how to report bugs and issues:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/bugs.php
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
#if HAVE_GL
|
||||||
|
#include <FL/platform.H>
|
||||||
|
#include <FL/gl.h>
|
||||||
|
#include "../../Fl_Gl_Choice.H"
|
||||||
|
//#include "../../Fl_Screen_Driver.H"
|
||||||
|
#include "Fl_Cocoa_Window_Driver.H"
|
||||||
|
#include "../../Fl_Gl_Window_Driver.H"
|
||||||
|
//#include <FL/Fl_Graphics_Driver.H>
|
||||||
|
#include <OpenGL/OpenGL.h>
|
||||||
|
//#include <FL/Fl_Image_Surface.H>
|
||||||
|
|
||||||
|
extern void gl_texture_reset();
|
||||||
|
|
||||||
|
#ifdef __OBJC__
|
||||||
|
@class NSOpenGLPixelFormat;
|
||||||
|
#else
|
||||||
|
class NSOpenGLPixelFormat;
|
||||||
|
#endif // __OBJC__
|
||||||
|
|
||||||
|
class Fl_Cocoa_Gl_Window_Driver : public Fl_Gl_Window_Driver {
|
||||||
|
friend class Fl_Gl_Window_Driver;
|
||||||
|
Fl_Cocoa_Gl_Window_Driver(Fl_Gl_Window *win) : Fl_Gl_Window_Driver(win) {}
|
||||||
|
virtual float pixels_per_unit();
|
||||||
|
virtual void before_show(int& need_after);
|
||||||
|
virtual void after_show();
|
||||||
|
virtual int mode_(int m, const int *a);
|
||||||
|
virtual void make_current_before();
|
||||||
|
virtual void swap_buffers();
|
||||||
|
virtual void resize(int is_a_resize, int w, int h);
|
||||||
|
virtual char swap_type();
|
||||||
|
virtual Fl_Gl_Choice *find(int m, const int *alistp);
|
||||||
|
virtual GLContext create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int layer = 0);
|
||||||
|
virtual void set_gl_context(Fl_Window* w, GLContext context);
|
||||||
|
virtual void delete_gl_context(GLContext);
|
||||||
|
virtual void make_overlay_current();
|
||||||
|
virtual void redraw_overlay();
|
||||||
|
virtual void gl_start();
|
||||||
|
virtual char *alpha_mask_for_string(const char *str, int n, int w, int h, Fl_Fontsize fs);
|
||||||
|
virtual Fl_RGB_Image* capture_gl_rectangle(int x, int y, int w, int h);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // HAVE_GL
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
#include "../../Fl_Gl_Choice.H"
|
#include "../../Fl_Gl_Choice.H"
|
||||||
#include "../../Fl_Screen_Driver.H"
|
#include "../../Fl_Screen_Driver.H"
|
||||||
#include "Fl_Cocoa_Window_Driver.H"
|
#include "Fl_Cocoa_Window_Driver.H"
|
||||||
#include "../../Fl_Gl_Window_Driver.H"
|
#include "Fl_Cocoa_Gl_Window_Driver.H"
|
||||||
#include <FL/Fl_Graphics_Driver.H>
|
#include <FL/Fl_Graphics_Driver.H>
|
||||||
#include <OpenGL/OpenGL.h>
|
#include <OpenGL/OpenGL.h>
|
||||||
#include <FL/Fl_Image_Surface.H>
|
#include <FL/Fl_Image_Surface.H>
|
||||||
@@ -34,27 +34,6 @@ extern void gl_texture_reset();
|
|||||||
class NSOpenGLPixelFormat;
|
class NSOpenGLPixelFormat;
|
||||||
#endif // __OBJC__
|
#endif // __OBJC__
|
||||||
|
|
||||||
class Fl_Cocoa_Gl_Window_Driver : public Fl_Gl_Window_Driver {
|
|
||||||
friend class Fl_Gl_Window_Driver;
|
|
||||||
Fl_Cocoa_Gl_Window_Driver(Fl_Gl_Window *win) : Fl_Gl_Window_Driver(win) {}
|
|
||||||
virtual float pixels_per_unit();
|
|
||||||
virtual void before_show(int& need_after);
|
|
||||||
virtual void after_show();
|
|
||||||
virtual int mode_(int m, const int *a);
|
|
||||||
virtual void make_current_before();
|
|
||||||
virtual void swap_buffers();
|
|
||||||
virtual void resize(int is_a_resize, int w, int h);
|
|
||||||
virtual char swap_type();
|
|
||||||
virtual Fl_Gl_Choice *find(int m, const int *alistp);
|
|
||||||
virtual GLContext create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int layer = 0);
|
|
||||||
virtual void set_gl_context(Fl_Window* w, GLContext context);
|
|
||||||
virtual void delete_gl_context(GLContext);
|
|
||||||
virtual void make_overlay_current();
|
|
||||||
virtual void redraw_overlay();
|
|
||||||
virtual void gl_start();
|
|
||||||
virtual char *alpha_mask_for_string(const char *str, int n, int w, int h, Fl_Fontsize fs);
|
|
||||||
virtual Fl_RGB_Image* capture_gl_rectangle(int x, int y, int w, int h);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Describes crap needed to create a GLContext.
|
// Describes crap needed to create a GLContext.
|
||||||
class Fl_Cocoa_Gl_Choice : public Fl_Gl_Choice {
|
class Fl_Cocoa_Gl_Choice : public Fl_Gl_Choice {
|
||||||
@@ -121,12 +100,6 @@ void Fl_Cocoa_Gl_Window_Driver::redraw_overlay() {
|
|||||||
pWindow->redraw();
|
pWindow->redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Fl_Gl_Window_Driver *Fl_Gl_Window_Driver::newGlWindowDriver(Fl_Gl_Window *w)
|
|
||||||
{
|
|
||||||
return new Fl_Cocoa_Gl_Window_Driver(w);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Fl_Cocoa_Gl_Window_Driver::before_show(int& need_after) {
|
void Fl_Cocoa_Gl_Window_Driver::before_show(int& need_after) {
|
||||||
need_after = 1;
|
need_after = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,26 +34,6 @@ extern void (*fl_unlock_function)();
|
|||||||
|
|
||||||
int Fl_Cocoa_Screen_Driver::next_marked_length = 0;
|
int Fl_Cocoa_Screen_Driver::next_marked_length = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
\cond DriverDev
|
|
||||||
\addtogroup DriverDeveloper
|
|
||||||
\{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a driver that manages all screen and display related calls.
|
|
||||||
|
|
||||||
This function must be implemented once for every platform.
|
|
||||||
*/
|
|
||||||
Fl_Screen_Driver *Fl_Screen_Driver::newScreenDriver()
|
|
||||||
{
|
|
||||||
return new Fl_Cocoa_Screen_Driver();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
\}
|
|
||||||
\endcond
|
|
||||||
*/
|
|
||||||
|
|
||||||
static Fl_Text_Editor::Key_Binding extra_bindings[] = {
|
static Fl_Text_Editor::Key_Binding extra_bindings[] = {
|
||||||
// Define CMD+key accelerators...
|
// Define CMD+key accelerators...
|
||||||
|
|||||||
@@ -27,23 +27,6 @@
|
|||||||
#include <FL/platform.H>
|
#include <FL/platform.H>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
/**
|
|
||||||
\cond DriverDev
|
|
||||||
\addtogroup DriverDeveloper
|
|
||||||
\{
|
|
||||||
*/
|
|
||||||
|
|
||||||
Fl_Window_Driver *Fl_Window_Driver::newWindowDriver(Fl_Window *w)
|
|
||||||
{
|
|
||||||
return new Fl_Cocoa_Window_Driver(w);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
\}
|
|
||||||
\endcond
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Fl_Cocoa_Window_Driver::Fl_Cocoa_Window_Driver(Fl_Window *win)
|
Fl_Cocoa_Window_Driver::Fl_Cocoa_Window_Driver(Fl_Window *win)
|
||||||
: Fl_Window_Driver(win)
|
: Fl_Window_Driver(win)
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
//
|
||||||
|
// Wayland-specific code to initialize wayland support.
|
||||||
|
//
|
||||||
|
// Copyright 2022 by Bill Spitzak and others.
|
||||||
|
//
|
||||||
|
// This library is free software. Distribution and use rights are outlined in
|
||||||
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
|
// file is missing or damaged, see the license at:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/COPYING.php
|
||||||
|
//
|
||||||
|
// Please see the following page on how to report bugs and issues:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/bugs.php
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#include "Fl_Cocoa_Gl_Window_Driver.H"
|
||||||
|
|
||||||
|
|
||||||
|
Fl_Gl_Window_Driver *Fl_Gl_Window_Driver::newGlWindowDriver(Fl_Gl_Window *w)
|
||||||
|
{
|
||||||
|
return new Fl_Cocoa_Gl_Window_Driver(w);
|
||||||
|
}
|
||||||
@@ -89,16 +89,6 @@ const char *Fl_Darwin_System_Driver::control_name() {
|
|||||||
return "⌃\\"; // "\xe2\x8c\x83\\"; // U+2303 (up arrowhead)
|
return "⌃\\"; // "\xe2\x8c\x83\\"; // U+2303 (up arrowhead)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Creates a driver that manages all system related calls.
|
|
||||||
|
|
||||||
This function must be implemented once for every platform.
|
|
||||||
*/
|
|
||||||
Fl_System_Driver *Fl_System_Driver::newSystemDriver()
|
|
||||||
{
|
|
||||||
return new Fl_Darwin_System_Driver();
|
|
||||||
}
|
|
||||||
|
|
||||||
Fl_Darwin_System_Driver::Fl_Darwin_System_Driver() : Fl_Posix_System_Driver() {
|
Fl_Darwin_System_Driver::Fl_Darwin_System_Driver() : Fl_Posix_System_Driver() {
|
||||||
if (fl_mac_os_version == 0) fl_mac_os_version = calc_mac_os_version();
|
if (fl_mac_os_version == 0) fl_mac_os_version = calc_mac_os_version();
|
||||||
// initialize key table
|
// initialize key table
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
//
|
||||||
|
// macOS-specific code to initialize macOS support.
|
||||||
|
//
|
||||||
|
// Copyright 2022 by Bill Spitzak and others.
|
||||||
|
//
|
||||||
|
// This library is free software. Distribution and use rights are outlined in
|
||||||
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
|
// file is missing or damaged, see the license at:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/COPYING.php
|
||||||
|
//
|
||||||
|
// Please see the following page on how to report bugs and issues:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/bugs.php
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#include "../Quartz/Fl_Quartz_Copy_Surface_Driver.H"
|
||||||
|
#include "../Quartz/Fl_Quartz_Graphics_Driver.H"
|
||||||
|
#include "../Cocoa/Fl_Cocoa_Screen_Driver.H"
|
||||||
|
#include "../Darwin/Fl_Darwin_System_Driver.H"
|
||||||
|
#include "../Cocoa/Fl_Cocoa_Window_Driver.H"
|
||||||
|
#include "../Quartz/Fl_Quartz_Image_Surface_Driver.H"
|
||||||
|
|
||||||
|
|
||||||
|
Fl_Copy_Surface_Driver *Fl_Copy_Surface_Driver::newCopySurfaceDriver(int w, int h)
|
||||||
|
{
|
||||||
|
return new Fl_Quartz_Copy_Surface_Driver(w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Fl_Graphics_Driver *Fl_Graphics_Driver::newMainGraphicsDriver()
|
||||||
|
{
|
||||||
|
return new Fl_Quartz_Graphics_Driver();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Fl_Screen_Driver *Fl_Screen_Driver::newScreenDriver()
|
||||||
|
{
|
||||||
|
return new Fl_Cocoa_Screen_Driver();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Fl_System_Driver *Fl_System_Driver::newSystemDriver()
|
||||||
|
{
|
||||||
|
return new Fl_Darwin_System_Driver();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Fl_Window_Driver *Fl_Window_Driver::newWindowDriver(Fl_Window *w)
|
||||||
|
{
|
||||||
|
return new Fl_Cocoa_Window_Driver(w);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Fl_Image_Surface_Driver *Fl_Image_Surface_Driver::newImageSurfaceDriver(int w, int h, int high_res, Fl_Offscreen off)
|
||||||
|
{
|
||||||
|
return new Fl_Quartz_Image_Surface_Driver(w, h, high_res, off);
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
//
|
||||||
|
// Copy-to-clipboard code for the Fast Light Tool Kit (FLTK).
|
||||||
|
//
|
||||||
|
// Copyright 2022 by Bill Spitzak and others.
|
||||||
|
//
|
||||||
|
// This library is free software. Distribution and use rights are outlined in
|
||||||
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
|
// file is missing or damaged, see the license at:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/COPYING.php
|
||||||
|
//
|
||||||
|
// Please see the following page on how to report bugs and issues:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/bugs.php
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef FL_GDI_COPY_SURFACE_DRIVER_H
|
||||||
|
#define FL_GDI_COPY_SURFACE_DRIVER_H
|
||||||
|
|
||||||
|
#include <FL/Fl_Copy_Surface.H>
|
||||||
|
#include <FL/platform.H>
|
||||||
|
|
||||||
|
class Fl_GDI_Copy_Surface_Driver : public Fl_Copy_Surface_Driver {
|
||||||
|
friend class Fl_Copy_Surface_Driver;
|
||||||
|
protected:
|
||||||
|
HDC oldgc;
|
||||||
|
HDC gc;
|
||||||
|
Fl_GDI_Copy_Surface_Driver(int w, int h);
|
||||||
|
~Fl_GDI_Copy_Surface_Driver();
|
||||||
|
void set_current();
|
||||||
|
void translate(int x, int y);
|
||||||
|
void untranslate();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FL_GDI_COPY_SURFACE_DRIVER_H
|
||||||
@@ -15,31 +15,13 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <FL/Fl_Copy_Surface.H>
|
#include "Fl_GDI_Copy_Surface_Driver.H"
|
||||||
#include <FL/platform.H>
|
#include <FL/platform.H>
|
||||||
#include "Fl_GDI_Graphics_Driver.H"
|
#include "Fl_GDI_Graphics_Driver.H"
|
||||||
#include "../WinAPI/Fl_WinAPI_Screen_Driver.H"
|
#include "../WinAPI/Fl_WinAPI_Screen_Driver.H"
|
||||||
#include <FL/Fl_Image_Surface.H>
|
#include <FL/Fl_Image_Surface.H>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
class Fl_GDI_Copy_Surface_Driver : public Fl_Copy_Surface_Driver {
|
|
||||||
friend class Fl_Copy_Surface_Driver;
|
|
||||||
protected:
|
|
||||||
HDC oldgc;
|
|
||||||
HDC gc;
|
|
||||||
Fl_GDI_Copy_Surface_Driver(int w, int h);
|
|
||||||
~Fl_GDI_Copy_Surface_Driver();
|
|
||||||
void set_current();
|
|
||||||
void translate(int x, int y);
|
|
||||||
void untranslate();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
Fl_Copy_Surface_Driver *Fl_Copy_Surface_Driver::newCopySurfaceDriver(int w, int h)
|
|
||||||
{
|
|
||||||
return new Fl_GDI_Copy_Surface_Driver(w, h);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Fl_GDI_Copy_Surface_Driver::Fl_GDI_Copy_Surface_Driver(int w, int h) : Fl_Copy_Surface_Driver(w, h) {
|
Fl_GDI_Copy_Surface_Driver::Fl_GDI_Copy_Surface_Driver(int w, int h) : Fl_Copy_Surface_Driver(w, h) {
|
||||||
driver(Fl_Graphics_Driver::newMainGraphicsDriver());
|
driver(Fl_Graphics_Driver::newMainGraphicsDriver());
|
||||||
|
|||||||
@@ -177,10 +177,12 @@ public:
|
|||||||
#if USE_GDIPLUS
|
#if USE_GDIPLUS
|
||||||
|
|
||||||
class Fl_GDIplus_Graphics_Driver : public Fl_GDI_Graphics_Driver {
|
class Fl_GDIplus_Graphics_Driver : public Fl_GDI_Graphics_Driver {
|
||||||
|
friend class Fl_Graphics_Driver;
|
||||||
private:
|
private:
|
||||||
Gdiplus::Color gdiplus_color_;
|
Gdiplus::Color gdiplus_color_;
|
||||||
Gdiplus::Pen *pen_;
|
Gdiplus::Pen *pen_;
|
||||||
Gdiplus::SolidBrush *brush_;
|
Gdiplus::SolidBrush *brush_;
|
||||||
|
static ULONG_PTR gdiplusToken;
|
||||||
public:
|
public:
|
||||||
Fl_GDIplus_Graphics_Driver();
|
Fl_GDIplus_Graphics_Driver();
|
||||||
virtual ~Fl_GDIplus_Graphics_Driver();
|
virtual ~Fl_GDIplus_Graphics_Driver();
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
#include "Fl_Font.H"
|
#include "Fl_Font.H"
|
||||||
|
|
||||||
#if USE_GDIPLUS
|
#if USE_GDIPLUS
|
||||||
static ULONG_PTR gdiplusToken = 0;
|
|
||||||
|
|
||||||
Fl_GDIplus_Graphics_Driver::Fl_GDIplus_Graphics_Driver() : Fl_GDI_Graphics_Driver() {
|
Fl_GDIplus_Graphics_Driver::Fl_GDIplus_Graphics_Driver() : Fl_GDI_Graphics_Driver() {
|
||||||
if (!fl_current_xmap) color(FL_BLACK);
|
if (!fl_current_xmap) color(FL_BLACK);
|
||||||
@@ -51,27 +50,13 @@ int Fl_GDIplus_Graphics_Driver::antialias() {
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* By linking this module, the following static method will instantiate the
|
|
||||||
* Windows GDI Graphics driver as the main display driver.
|
|
||||||
*/
|
|
||||||
Fl_Graphics_Driver *Fl_Graphics_Driver::newMainGraphicsDriver()
|
|
||||||
{
|
|
||||||
#if USE_GDIPLUS
|
|
||||||
// Initialize GDI+.
|
|
||||||
static Gdiplus::GdiplusStartupInput gdiplusStartupInput;
|
|
||||||
if (gdiplusToken == 0) GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
|
|
||||||
|
|
||||||
Fl_Graphics_Driver *driver = new Fl_GDIplus_Graphics_Driver();
|
|
||||||
return driver;
|
|
||||||
#else
|
|
||||||
return new Fl_GDI_Graphics_Driver();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#if USE_GDIPLUS
|
#if USE_GDIPLUS
|
||||||
|
|
||||||
|
ULONG_PTR Fl_GDIplus_Graphics_Driver::gdiplusToken = 0;
|
||||||
|
|
||||||
void Fl_GDIplus_Graphics_Driver::shutdown() {
|
void Fl_GDIplus_Graphics_Driver::shutdown() {
|
||||||
Gdiplus::GdiplusShutdown(gdiplusToken);
|
Gdiplus::GdiplusShutdown(Fl_GDIplus_Graphics_Driver::gdiplusToken);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
//
|
||||||
|
// Draw-to-image code for the Fast Light Tool Kit (FLTK).
|
||||||
|
//
|
||||||
|
// Copyright 2022 by Bill Spitzak and others.
|
||||||
|
//
|
||||||
|
// This library is free software. Distribution and use rights are outlined in
|
||||||
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
|
// file is missing or damaged, see the license at:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/COPYING.php
|
||||||
|
//
|
||||||
|
// Please see the following page on how to report bugs and issues:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/bugs.php
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef FL_GDI_IMAGE_SURFACE_DRIVER_H
|
||||||
|
#define FL_GDI_IMAGE_SURFACE_DRIVER_H
|
||||||
|
|
||||||
|
#include <FL/Fl_Image_Surface.H>
|
||||||
|
#include <FL/Fl_RGB_Image.H>
|
||||||
|
#include <FL/platform.H>
|
||||||
|
|
||||||
|
class Fl_GDI_Image_Surface_Driver : public Fl_Image_Surface_Driver {
|
||||||
|
virtual void end_current();
|
||||||
|
public:
|
||||||
|
Window pre_window;
|
||||||
|
int _savedc;
|
||||||
|
Fl_GDI_Image_Surface_Driver(int w, int h, int high_res, Fl_Offscreen off);
|
||||||
|
~Fl_GDI_Image_Surface_Driver();
|
||||||
|
void set_current();
|
||||||
|
void translate(int x, int y);
|
||||||
|
void untranslate();
|
||||||
|
Fl_RGB_Image *image();
|
||||||
|
POINT origin;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FL_GDI_IMAGE_SURFACE_DRIVER_H
|
||||||
@@ -17,30 +17,10 @@
|
|||||||
|
|
||||||
#include "Fl_GDI_Graphics_Driver.H"
|
#include "Fl_GDI_Graphics_Driver.H"
|
||||||
#include "../WinAPI/Fl_WinAPI_Screen_Driver.H"
|
#include "../WinAPI/Fl_WinAPI_Screen_Driver.H"
|
||||||
#include <FL/Fl_Image_Surface.H>
|
#include "Fl_GDI_Image_Surface_Driver.H"
|
||||||
#include <FL/platform.H>
|
#include <FL/platform.H>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
class Fl_GDI_Image_Surface_Driver : public Fl_Image_Surface_Driver {
|
|
||||||
virtual void end_current();
|
|
||||||
public:
|
|
||||||
Window pre_window;
|
|
||||||
int _savedc;
|
|
||||||
Fl_GDI_Image_Surface_Driver(int w, int h, int high_res, Fl_Offscreen off);
|
|
||||||
~Fl_GDI_Image_Surface_Driver();
|
|
||||||
void set_current();
|
|
||||||
void translate(int x, int y);
|
|
||||||
void untranslate();
|
|
||||||
Fl_RGB_Image *image();
|
|
||||||
POINT origin;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
Fl_Image_Surface_Driver *Fl_Image_Surface_Driver::newImageSurfaceDriver(int w, int h, int high_res, Fl_Offscreen off)
|
|
||||||
{
|
|
||||||
return new Fl_GDI_Image_Surface_Driver(w, h, high_res, off);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Fl_GDI_Image_Surface_Driver::Fl_GDI_Image_Surface_Driver(int w, int h, int high_res, Fl_Offscreen off) : Fl_Image_Surface_Driver(w, h, high_res, off) {
|
Fl_GDI_Image_Surface_Driver::Fl_GDI_Image_Surface_Driver(int w, int h, int high_res, Fl_Offscreen off) : Fl_Image_Surface_Driver(w, h, high_res, off) {
|
||||||
float d = fl_graphics_driver->scale();
|
float d = fl_graphics_driver->scale();
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#define Fl_Quartz_Copy_Surface_Driver_H
|
#define Fl_Quartz_Copy_Surface_Driver_H
|
||||||
|
|
||||||
#include <FL/Fl_Copy_Surface.H>
|
#include <FL/Fl_Copy_Surface.H>
|
||||||
|
#include <FL/platform.H>
|
||||||
|
|
||||||
class Fl_Quartz_Copy_Surface_Driver : public Fl_Copy_Surface_Driver {
|
class Fl_Quartz_Copy_Surface_Driver : public Fl_Copy_Surface_Driver {
|
||||||
friend class Fl_Copy_Surface_Driver;
|
friend class Fl_Copy_Surface_Driver;
|
||||||
|
|||||||
@@ -20,21 +20,6 @@
|
|||||||
#include "Fl_Quartz_Copy_Surface_Driver.H"
|
#include "Fl_Quartz_Copy_Surface_Driver.H"
|
||||||
#include "../Cocoa/Fl_Cocoa_Window_Driver.H"
|
#include "../Cocoa/Fl_Cocoa_Window_Driver.H"
|
||||||
|
|
||||||
/**
|
|
||||||
\cond DriverDev
|
|
||||||
\addtogroup DriverDeveloper
|
|
||||||
\{
|
|
||||||
*/
|
|
||||||
|
|
||||||
Fl_Copy_Surface_Driver *Fl_Copy_Surface_Driver::newCopySurfaceDriver(int w, int h)
|
|
||||||
{
|
|
||||||
return new Fl_Quartz_Copy_Surface_Driver(w, h);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
\}
|
|
||||||
\endcond
|
|
||||||
*/
|
|
||||||
|
|
||||||
Fl_Quartz_Copy_Surface_Driver::Fl_Quartz_Copy_Surface_Driver(int w, int h) : Fl_Copy_Surface_Driver(w, h) {
|
Fl_Quartz_Copy_Surface_Driver::Fl_Quartz_Copy_Surface_Driver(int w, int h) : Fl_Copy_Surface_Driver(w, h) {
|
||||||
driver(new Fl_Quartz_Printer_Graphics_Driver);
|
driver(new Fl_Quartz_Printer_Graphics_Driver);
|
||||||
|
|||||||
@@ -43,14 +43,6 @@ void Fl_Quartz_Graphics_Driver::init_CoreText_or_ATSU()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* By linking this module, the following static method will instantiate the
|
|
||||||
* OS X Quartz Graphics driver as the main display driver.
|
|
||||||
*/
|
|
||||||
Fl_Graphics_Driver *Fl_Graphics_Driver::newMainGraphicsDriver()
|
|
||||||
{
|
|
||||||
return new Fl_Quartz_Graphics_Driver();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Fl_Quartz_Graphics_Driver::antialias(int state) {
|
void Fl_Quartz_Graphics_Driver::antialias(int state) {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
//
|
||||||
|
// Draw-to-image code for the Fast Light Tool Kit (FLTK).
|
||||||
|
//
|
||||||
|
// Copyright 1998-2021 by Bill Spitzak and others.
|
||||||
|
//
|
||||||
|
// This library is free software. Distribution and use rights are outlined in
|
||||||
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
|
// file is missing or damaged, see the license at:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/COPYING.php
|
||||||
|
//
|
||||||
|
// Please see the following page on how to report bugs and issues:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/bugs.php
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef FL_QUARTZ_IMAGE_SURFACE_DRIVER_H
|
||||||
|
#define FL_QUARTZ_IMAGE_SURFACE_DRIVER_H
|
||||||
|
|
||||||
|
#include <FL/Fl_Image_Surface.H>
|
||||||
|
#include <FL/platform.H>
|
||||||
|
|
||||||
|
class Fl_Quartz_Image_Surface_Driver : public Fl_Image_Surface_Driver {
|
||||||
|
virtual void end_current();
|
||||||
|
public:
|
||||||
|
Window pre_window;
|
||||||
|
Fl_Quartz_Image_Surface_Driver(int w, int h, int high_res, Fl_Offscreen off);
|
||||||
|
~Fl_Quartz_Image_Surface_Driver();
|
||||||
|
void set_current();
|
||||||
|
void translate(int x, int y);
|
||||||
|
void untranslate();
|
||||||
|
Fl_RGB_Image *image();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FL_QUARTZ_IMAGE_SURFACE_DRIVER_H
|
||||||
@@ -16,41 +16,11 @@
|
|||||||
|
|
||||||
#include <FL/platform.H>
|
#include <FL/platform.H>
|
||||||
#include <FL/fl_draw.H>
|
#include <FL/fl_draw.H>
|
||||||
#include <FL/Fl_Image_Surface.H>
|
#include "Fl_Quartz_Image_Surface_Driver.H"
|
||||||
#include "Fl_Quartz_Graphics_Driver.H"
|
#include "Fl_Quartz_Graphics_Driver.H"
|
||||||
#include "../Cocoa/Fl_Cocoa_Window_Driver.H"
|
#include "../Cocoa/Fl_Cocoa_Window_Driver.H"
|
||||||
#include <ApplicationServices/ApplicationServices.h>
|
#include <ApplicationServices/ApplicationServices.h>
|
||||||
|
|
||||||
class Fl_Quartz_Image_Surface_Driver : public Fl_Image_Surface_Driver {
|
|
||||||
virtual void end_current();
|
|
||||||
public:
|
|
||||||
Window pre_window;
|
|
||||||
Fl_Quartz_Image_Surface_Driver(int w, int h, int high_res, Fl_Offscreen off);
|
|
||||||
~Fl_Quartz_Image_Surface_Driver();
|
|
||||||
void set_current();
|
|
||||||
void translate(int x, int y);
|
|
||||||
void untranslate();
|
|
||||||
Fl_RGB_Image *image();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\cond DriverDev
|
|
||||||
\addtogroup DriverDeveloper
|
|
||||||
\{
|
|
||||||
*/
|
|
||||||
|
|
||||||
Fl_Image_Surface_Driver *Fl_Image_Surface_Driver::newImageSurfaceDriver(int w, int h, int high_res, Fl_Offscreen off)
|
|
||||||
{
|
|
||||||
return new Fl_Quartz_Image_Surface_Driver(w, h, high_res, off);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
\}
|
|
||||||
\endcond
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Fl_Quartz_Image_Surface_Driver::Fl_Quartz_Image_Surface_Driver(int w, int h, int high_res, Fl_Offscreen off) : Fl_Image_Surface_Driver(w, h, high_res, off) {
|
Fl_Quartz_Image_Surface_Driver::Fl_Quartz_Image_Surface_Driver(int w, int h, int high_res, Fl_Offscreen off) : Fl_Image_Surface_Driver(w, h, high_res, off) {
|
||||||
int W = w, H = h;
|
int W = w, H = h;
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
//
|
||||||
|
// Copy-to-clipboard code for the Fast Light Tool Kit (FLTK).
|
||||||
|
//
|
||||||
|
// Copyright 2022 by Bill Spitzak and others.
|
||||||
|
//
|
||||||
|
// This library is free software. Distribution and use rights are outlined in
|
||||||
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
|
// file is missing or damaged, see the license at:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/COPYING.php
|
||||||
|
//
|
||||||
|
// Please see the following page on how to report bugs and issues:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/bugs.php
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef FL_WAYLAND_COPY_SURFACE_DRIVER_H
|
||||||
|
#define FL_WAYLAND_COPY_SURFACE_DRIVER_H
|
||||||
|
|
||||||
|
#include <FL/Fl_Copy_Surface.H>
|
||||||
|
#include <FL/Fl_Image_Surface.H>
|
||||||
|
|
||||||
|
class Fl_Wayland_Copy_Surface_Driver : public Fl_Copy_Surface_Driver {
|
||||||
|
friend class Fl_Copy_Surface_Driver;
|
||||||
|
Fl_Image_Surface *img_surf;
|
||||||
|
protected:
|
||||||
|
Fl_Wayland_Copy_Surface_Driver(int w, int h);
|
||||||
|
~Fl_Wayland_Copy_Surface_Driver();
|
||||||
|
void set_current();
|
||||||
|
void translate(int x, int y);
|
||||||
|
void untranslate();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FL_WAYLAND_COPY_SURFACE_DRIVER_H
|
||||||
@@ -15,30 +15,13 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <FL/Fl_Copy_Surface.H>
|
#include "Fl_Wayland_Copy_Surface_Driver.H"
|
||||||
#include <FL/Fl_Image_Surface.H>
|
#include <FL/Fl_Image_Surface.H>
|
||||||
#include "Fl_Wayland_Graphics_Driver.H"
|
#include "Fl_Wayland_Graphics_Driver.H"
|
||||||
#include "Fl_Wayland_Screen_Driver.H"
|
#include "Fl_Wayland_Screen_Driver.H"
|
||||||
#include "Fl_Wayland_Window_Driver.H"
|
#include "Fl_Wayland_Window_Driver.H"
|
||||||
#include <FL/platform.H>
|
#include <FL/platform.H>
|
||||||
|
|
||||||
class Fl_Wayland_Copy_Surface_Driver : public Fl_Copy_Surface_Driver {
|
|
||||||
friend class Fl_Copy_Surface_Driver;
|
|
||||||
Fl_Image_Surface *img_surf;
|
|
||||||
protected:
|
|
||||||
Fl_Wayland_Copy_Surface_Driver(int w, int h);
|
|
||||||
~Fl_Wayland_Copy_Surface_Driver();
|
|
||||||
void set_current();
|
|
||||||
void translate(int x, int y);
|
|
||||||
void untranslate();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
Fl_Copy_Surface_Driver *Fl_Copy_Surface_Driver::newCopySurfaceDriver(int w, int h)
|
|
||||||
{
|
|
||||||
return new Fl_Wayland_Copy_Surface_Driver(w, h);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Fl_Wayland_Copy_Surface_Driver::Fl_Wayland_Copy_Surface_Driver(int w, int h) : Fl_Copy_Surface_Driver(w, h) {
|
Fl_Wayland_Copy_Surface_Driver::Fl_Wayland_Copy_Surface_Driver(int w, int h) : Fl_Copy_Surface_Driver(w, h) {
|
||||||
int os_scale = (fl_window ? fl_window->scale : 1);
|
int os_scale = (fl_window ? fl_window->scale : 1);
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
//
|
||||||
|
// Class Fl_Wayland_Gl_Window_Driver for the Fast Light Tool Kit (FLTK).
|
||||||
|
//
|
||||||
|
// Copyright 2021-2022 by Bill Spitzak and others.
|
||||||
|
//
|
||||||
|
// This library is free software. Distribution and use rights are outlined in
|
||||||
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
|
// file is missing or damaged, see the license at:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/COPYING.php
|
||||||
|
//
|
||||||
|
// Please see the following page on how to report bugs and issues:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/bugs.php
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef FL_WAYLAND_GL_WINDOW_DRIVER_H
|
||||||
|
#define FL_WAYLAND_GL_WINDOW_DRIVER_H
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
#if HAVE_GL
|
||||||
|
#include <FL/platform.H>
|
||||||
|
#include "../../Fl_Gl_Window_Driver.H"
|
||||||
|
#include <wayland-egl.h>
|
||||||
|
#include <EGL/egl.h>
|
||||||
|
#include <FL/gl.h>
|
||||||
|
|
||||||
|
/* Implementation note about OpenGL drawing on the Wayland platform
|
||||||
|
|
||||||
|
After eglCreateWindowSurface() with attributes {EGL_RENDER_BUFFER, EGL_SINGLE_BUFFER, EGL_NONE},
|
||||||
|
eglQueryContext() reports that EGL_RENDER_BUFFER equals EGL_BACK_BUFFER.
|
||||||
|
This experiment suggests that the platform only supports double-buffer drawing.
|
||||||
|
Consequently, FL_DOUBLE is enforced in all Fl_Gl_Window::mode_ values under Wayland.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Fl_Wayland_Gl_Window_Driver : public Fl_Gl_Window_Driver {
|
||||||
|
friend class Fl_Gl_Window_Driver;
|
||||||
|
bool egl_resize_in_progress;
|
||||||
|
protected:
|
||||||
|
Fl_Wayland_Gl_Window_Driver(Fl_Gl_Window *win);
|
||||||
|
virtual float pixels_per_unit();
|
||||||
|
virtual void make_current_before();
|
||||||
|
virtual int mode_(int m, const int *a);
|
||||||
|
virtual void swap_buffers();
|
||||||
|
virtual void resize(int is_a_resize, int w, int h);
|
||||||
|
virtual char swap_type();
|
||||||
|
virtual Fl_Gl_Choice *find(int m, const int *alistp);
|
||||||
|
virtual GLContext create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int layer = 0);
|
||||||
|
virtual void set_gl_context(Fl_Window* w, GLContext context);
|
||||||
|
virtual void delete_gl_context(GLContext);
|
||||||
|
virtual void make_overlay_current();
|
||||||
|
virtual void redraw_overlay();
|
||||||
|
virtual void waitGL();
|
||||||
|
virtual void gl_start();
|
||||||
|
virtual Fl_RGB_Image* capture_gl_rectangle(int x, int y, int w, int h);
|
||||||
|
char *alpha_mask_for_string(const char *str, int n, int w, int h, Fl_Fontsize fs);
|
||||||
|
public:
|
||||||
|
static EGLDisplay egl_display;
|
||||||
|
static EGLint configs_count;
|
||||||
|
static struct wl_event_queue *gl_event_queue;
|
||||||
|
void init();
|
||||||
|
struct wl_egl_window *egl_window;
|
||||||
|
EGLSurface egl_surface;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // HAVE_GL
|
||||||
|
#endif // FL_WAYLAND_GL_WINDOW_DRIVER_H
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
#include "../../Fl_Screen_Driver.H"
|
#include "../../Fl_Screen_Driver.H"
|
||||||
#include "Fl_Wayland_Window_Driver.H"
|
#include "Fl_Wayland_Window_Driver.H"
|
||||||
#include "Fl_Wayland_Graphics_Driver.H"
|
#include "Fl_Wayland_Graphics_Driver.H"
|
||||||
#include "../../Fl_Gl_Window_Driver.H"
|
#include "Fl_Wayland_Gl_Window_Driver.H"
|
||||||
#include <wayland-egl.h>
|
#include <wayland-egl.h>
|
||||||
#include <EGL/egl.h>
|
#include <EGL/egl.h>
|
||||||
#include <FL/gl.h>
|
#include <FL/gl.h>
|
||||||
@@ -35,36 +35,6 @@ This experiment suggests that the platform only supports double-buffer drawing.
|
|||||||
Consequently, FL_DOUBLE is enforced in all Fl_Gl_Window::mode_ values under Wayland.
|
Consequently, FL_DOUBLE is enforced in all Fl_Gl_Window::mode_ values under Wayland.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Fl_Wayland_Gl_Window_Driver : public Fl_Gl_Window_Driver {
|
|
||||||
friend class Fl_Gl_Window_Driver;
|
|
||||||
bool egl_resize_in_progress;
|
|
||||||
protected:
|
|
||||||
Fl_Wayland_Gl_Window_Driver(Fl_Gl_Window *win);
|
|
||||||
virtual float pixels_per_unit();
|
|
||||||
virtual void make_current_before();
|
|
||||||
virtual int mode_(int m, const int *a);
|
|
||||||
virtual void swap_buffers();
|
|
||||||
virtual void resize(int is_a_resize, int w, int h);
|
|
||||||
virtual char swap_type();
|
|
||||||
virtual Fl_Gl_Choice *find(int m, const int *alistp);
|
|
||||||
virtual GLContext create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int layer = 0);
|
|
||||||
virtual void set_gl_context(Fl_Window* w, GLContext context);
|
|
||||||
virtual void delete_gl_context(GLContext);
|
|
||||||
virtual void make_overlay_current();
|
|
||||||
virtual void redraw_overlay();
|
|
||||||
virtual void waitGL();
|
|
||||||
virtual void gl_start();
|
|
||||||
virtual Fl_RGB_Image* capture_gl_rectangle(int x, int y, int w, int h);
|
|
||||||
char *alpha_mask_for_string(const char *str, int n, int w, int h, Fl_Fontsize fs);
|
|
||||||
public:
|
|
||||||
static EGLDisplay egl_display;
|
|
||||||
static EGLint configs_count;
|
|
||||||
static struct wl_event_queue *gl_event_queue;
|
|
||||||
void init();
|
|
||||||
struct wl_egl_window *egl_window;
|
|
||||||
EGLSurface egl_surface;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Describes crap needed to create a GLContext.
|
// Describes crap needed to create a GLContext.
|
||||||
class Fl_Wayland_Gl_Choice : public Fl_Gl_Choice {
|
class Fl_Wayland_Gl_Choice : public Fl_Gl_Choice {
|
||||||
friend class Fl_Wayland_Gl_Window_Driver;
|
friend class Fl_Wayland_Gl_Window_Driver;
|
||||||
@@ -247,12 +217,6 @@ void Fl_Wayland_Gl_Window_Driver::redraw_overlay() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Fl_Gl_Window_Driver *Fl_Gl_Window_Driver::newGlWindowDriver(Fl_Gl_Window *w)
|
|
||||||
{
|
|
||||||
return new Fl_Wayland_Gl_Window_Driver(w);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void gl_frame_ready(void *data, struct wl_callback *cb, uint32_t time) {
|
static void gl_frame_ready(void *data, struct wl_callback *cb, uint32_t time) {
|
||||||
*(bool*)data = true;
|
*(bool*)data = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,13 +152,6 @@ Fl_Wayland_Graphics_Driver::Fl_Wayland_Graphics_Driver () : Fl_Cairo_Graphics_Dr
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Fl_Graphics_Driver *Fl_Graphics_Driver::newMainGraphicsDriver()
|
|
||||||
{
|
|
||||||
fl_graphics_driver = new Fl_Wayland_Graphics_Driver();
|
|
||||||
return fl_graphics_driver;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Fl_Wayland_Graphics_Driver::activate(struct fl_wld_buffer *buffer, float scale) {
|
void Fl_Wayland_Graphics_Driver::activate(struct fl_wld_buffer *buffer, float scale) {
|
||||||
if (dummy_pango_layout_) {
|
if (dummy_pango_layout_) {
|
||||||
cairo_surface_t *surf = cairo_get_target(cairo_);
|
cairo_surface_t *surf = cairo_get_target(cairo_);
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
//
|
||||||
|
// Draw-to-image code for the Fast Light Tool Kit (FLTK).
|
||||||
|
//
|
||||||
|
// Copyright 1998-2021 by Bill Spitzak and others.
|
||||||
|
//
|
||||||
|
// This library is free software. Distribution and use rights are outlined in
|
||||||
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
|
// file is missing or damaged, see the license at:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/COPYING.php
|
||||||
|
//
|
||||||
|
// Please see the following page on how to report bugs and issues:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/bugs.php
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef FL_WAYLAND_IMAGE_SURFACE_DRIVER_H
|
||||||
|
#define FL_WAYLAND_IMAGE_SURFACE_DRIVER_H
|
||||||
|
|
||||||
|
#include <FL/Fl_Image_Surface.H>
|
||||||
|
|
||||||
|
class Fl_Wayland_Image_Surface_Driver : public Fl_Image_Surface_Driver {
|
||||||
|
virtual void end_current();
|
||||||
|
public:
|
||||||
|
Fl_Wayland_Image_Surface_Driver(int w, int h, int high_res, Fl_Offscreen off);
|
||||||
|
~Fl_Wayland_Image_Surface_Driver();
|
||||||
|
void set_current();
|
||||||
|
void translate(int x, int y);
|
||||||
|
void untranslate();
|
||||||
|
Fl_RGB_Image *image();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FL_WAYLAND_IMAGE_SURFACE_DRIVER_H
|
||||||
@@ -18,23 +18,8 @@
|
|||||||
#include <FL/platform.H>
|
#include <FL/platform.H>
|
||||||
#include "Fl_Wayland_Graphics_Driver.H"
|
#include "Fl_Wayland_Graphics_Driver.H"
|
||||||
#include "Fl_Wayland_Window_Driver.H"
|
#include "Fl_Wayland_Window_Driver.H"
|
||||||
#include <FL/Fl_Image_Surface.H>
|
#include "Fl_Wayland_Image_Surface_Driver.H"
|
||||||
|
|
||||||
class Fl_Wayland_Image_Surface_Driver : public Fl_Image_Surface_Driver {
|
|
||||||
virtual void end_current();
|
|
||||||
public:
|
|
||||||
Fl_Wayland_Image_Surface_Driver(int w, int h, int high_res, Fl_Offscreen off);
|
|
||||||
~Fl_Wayland_Image_Surface_Driver();
|
|
||||||
void set_current();
|
|
||||||
void translate(int x, int y);
|
|
||||||
void untranslate();
|
|
||||||
Fl_RGB_Image *image();
|
|
||||||
};
|
|
||||||
|
|
||||||
Fl_Image_Surface_Driver *Fl_Image_Surface_Driver::newImageSurfaceDriver(int w, int h, int high_res, Fl_Offscreen off)
|
|
||||||
{
|
|
||||||
return new Fl_Wayland_Image_Surface_Driver(w, h, high_res, off);
|
|
||||||
}
|
|
||||||
|
|
||||||
Fl_Wayland_Image_Surface_Driver::Fl_Wayland_Image_Surface_Driver(int w, int h, int high_res, Fl_Offscreen off) : Fl_Image_Surface_Driver(w, h, high_res, off) {
|
Fl_Wayland_Image_Surface_Driver::Fl_Wayland_Image_Surface_Driver(int w, int h, int high_res, Fl_Offscreen off) : Fl_Image_Surface_Driver(w, h, high_res, off) {
|
||||||
float d = 1;
|
float d = 1;
|
||||||
|
|||||||
@@ -157,16 +157,6 @@ extern const char *fl_bg2;
|
|||||||
// end of extern additions workaround
|
// end of extern additions workaround
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a driver that manages all screen and display related calls.
|
|
||||||
|
|
||||||
This function must be implemented once for every platform.
|
|
||||||
*/
|
|
||||||
Fl_Screen_Driver *Fl_Screen_Driver::newScreenDriver()
|
|
||||||
{
|
|
||||||
return new Fl_Wayland_Screen_Driver();
|
|
||||||
}
|
|
||||||
|
|
||||||
FL_EXPORT struct wl_display *fl_display = NULL;
|
FL_EXPORT struct wl_display *fl_display = NULL;
|
||||||
|
|
||||||
static bool has_xrgb = false;
|
static bool has_xrgb = false;
|
||||||
|
|||||||
@@ -21,16 +21,6 @@
|
|||||||
#include <FL/platform.H>
|
#include <FL/platform.H>
|
||||||
#include "../../../libdecor/src/libdecor.h"
|
#include "../../../libdecor/src/libdecor.h"
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a driver that manages all system related calls.
|
|
||||||
|
|
||||||
This function must be implemented once for every platform.
|
|
||||||
*/
|
|
||||||
Fl_System_Driver *Fl_System_Driver::newSystemDriver()
|
|
||||||
{
|
|
||||||
return new Fl_Wayland_System_Driver();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int Fl_Wayland_System_Driver::event_key(int k) {
|
int Fl_Wayland_System_Driver::event_key(int k) {
|
||||||
if (k > FL_Button && k <= FL_Button+8)
|
if (k > FL_Button && k <= FL_Button+8)
|
||||||
|
|||||||
@@ -60,12 +60,6 @@ void Fl_Wayland_Window_Driver::destroy_double_buffer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Fl_Window_Driver *Fl_Window_Driver::newWindowDriver(Fl_Window *w)
|
|
||||||
{
|
|
||||||
return new Fl_Wayland_Window_Driver(w);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Fl_Wayland_Window_Driver::Fl_Wayland_Window_Driver(Fl_Window *win) : Fl_Window_Driver(win)
|
Fl_Wayland_Window_Driver::Fl_Wayland_Window_Driver(Fl_Window *win) : Fl_Window_Driver(win)
|
||||||
{
|
{
|
||||||
icon_ = new icon_data;
|
icon_ = new icon_data;
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
//
|
||||||
|
// Wayland-specific code to initialize wayland support.
|
||||||
|
//
|
||||||
|
// Copyright 2022 by Bill Spitzak and others.
|
||||||
|
//
|
||||||
|
// This library is free software. Distribution and use rights are outlined in
|
||||||
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
|
// file is missing or damaged, see the license at:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/COPYING.php
|
||||||
|
//
|
||||||
|
// Please see the following page on how to report bugs and issues:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/bugs.php
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#include "Fl_Wayland_Gl_Window_Driver.H"
|
||||||
|
|
||||||
|
|
||||||
|
Fl_Gl_Window_Driver *Fl_Gl_Window_Driver::newGlWindowDriver(Fl_Gl_Window *w)
|
||||||
|
{
|
||||||
|
return new Fl_Wayland_Gl_Window_Driver(w);
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
//
|
||||||
|
// Wayland-specific code to initialize wayland support.
|
||||||
|
//
|
||||||
|
// Copyright 2022 by Bill Spitzak and others.
|
||||||
|
//
|
||||||
|
// This library is free software. Distribution and use rights are outlined in
|
||||||
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
|
// file is missing or damaged, see the license at:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/COPYING.php
|
||||||
|
//
|
||||||
|
// Please see the following page on how to report bugs and issues:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/bugs.php
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#include "Fl_Wayland_Copy_Surface_Driver.H"
|
||||||
|
#include "Fl_Wayland_Graphics_Driver.H"
|
||||||
|
#include "Fl_Wayland_Screen_Driver.H"
|
||||||
|
#include "Fl_Wayland_System_Driver.H"
|
||||||
|
#include "Fl_Wayland_Window_Driver.H"
|
||||||
|
#include "Fl_Wayland_Image_Surface_Driver.H"
|
||||||
|
|
||||||
|
|
||||||
|
Fl_Copy_Surface_Driver *Fl_Copy_Surface_Driver::newCopySurfaceDriver(int w, int h)
|
||||||
|
{
|
||||||
|
return new Fl_Wayland_Copy_Surface_Driver(w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Fl_Graphics_Driver *Fl_Graphics_Driver::newMainGraphicsDriver()
|
||||||
|
{
|
||||||
|
fl_graphics_driver = new Fl_Wayland_Graphics_Driver();
|
||||||
|
return fl_graphics_driver;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Fl_Screen_Driver *Fl_Screen_Driver::newScreenDriver()
|
||||||
|
{
|
||||||
|
return new Fl_Wayland_Screen_Driver();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Fl_System_Driver *Fl_System_Driver::newSystemDriver()
|
||||||
|
{
|
||||||
|
return new Fl_Wayland_System_Driver();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Fl_Window_Driver *Fl_Window_Driver::newWindowDriver(Fl_Window *w)
|
||||||
|
{
|
||||||
|
return new Fl_Wayland_Window_Driver(w);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Fl_Image_Surface_Driver *Fl_Image_Surface_Driver::newImageSurfaceDriver(int w, int h, int high_res, Fl_Offscreen off)
|
||||||
|
{
|
||||||
|
return new Fl_Wayland_Image_Surface_Driver(w, h, high_res, off);
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
//
|
||||||
|
// Class Fl_Wayland_Gl_Window_Driver for the Fast Light Tool Kit (FLTK).
|
||||||
|
//
|
||||||
|
// Copyright 2021-2022 by Bill Spitzak and others.
|
||||||
|
//
|
||||||
|
// This library is free software. Distribution and use rights are outlined in
|
||||||
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
|
// file is missing or damaged, see the license at:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/COPYING.php
|
||||||
|
//
|
||||||
|
// Please see the following page on how to report bugs and issues:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/bugs.php
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef FL_WINAPI_GL_WINDOW_DRIVER_H
|
||||||
|
#define FL_WINAPI_GL_WINDOW_DRIVER_H
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
#if HAVE_GL
|
||||||
|
#include <FL/platform.H>
|
||||||
|
#include "../../Fl_Gl_Window_Driver.H"
|
||||||
|
#include <FL/gl.h>
|
||||||
|
|
||||||
|
/* Implementation note about OpenGL drawing on the Wayland platform
|
||||||
|
|
||||||
|
After eglCreateWindowSurface() with attributes {EGL_RENDER_BUFFER, EGL_SINGLE_BUFFER, EGL_NONE},
|
||||||
|
eglQueryContext() reports that EGL_RENDER_BUFFER equals EGL_BACK_BUFFER.
|
||||||
|
This experiment suggests that the platform only supports double-buffer drawing.
|
||||||
|
Consequently, FL_DOUBLE is enforced in all Fl_Gl_Window::mode_ values under Wayland.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Fl_WinAPI_Gl_Window_Driver : public Fl_Gl_Window_Driver {
|
||||||
|
friend class Fl_Gl_Window_Driver;
|
||||||
|
Fl_WinAPI_Gl_Window_Driver(Fl_Gl_Window *win) : Fl_Gl_Window_Driver(win) {}
|
||||||
|
virtual float pixels_per_unit();
|
||||||
|
virtual int mode_(int m, const int *a);
|
||||||
|
virtual void make_current_after();
|
||||||
|
virtual void swap_buffers();
|
||||||
|
virtual void invalidate() {}
|
||||||
|
virtual int flush_begin(char& valid_f);
|
||||||
|
virtual Fl_Gl_Choice *find(int m, const int *alistp);
|
||||||
|
virtual GLContext create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int layer = 0);
|
||||||
|
virtual void set_gl_context(Fl_Window* w, GLContext context);
|
||||||
|
virtual void delete_gl_context(GLContext);
|
||||||
|
virtual void make_overlay_current();
|
||||||
|
virtual void redraw_overlay();
|
||||||
|
virtual void* GetProcAddress(const char *procName);
|
||||||
|
virtual void draw_string_legacy(const char* str, int n);
|
||||||
|
virtual void gl_bitmap_font(Fl_Font_Descriptor *fl_fontsize);
|
||||||
|
virtual void get_list(Fl_Font_Descriptor *fd, int r);
|
||||||
|
virtual int genlistsize();
|
||||||
|
#if HAVE_GL_OVERLAY
|
||||||
|
virtual void gl_hide_before(void *& overlay);
|
||||||
|
virtual int can_do_overlay();
|
||||||
|
virtual int overlay_color(Fl_Color i);
|
||||||
|
void make_overlay(void*&overlay);
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // HAVE_GL
|
||||||
|
|
||||||
|
#endif // FL_WINAPI_GL_WINDOW_DRIVER_H
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
#include <FL/platform.H>
|
#include <FL/platform.H>
|
||||||
#include "../../Fl_Screen_Driver.H"
|
#include "../../Fl_Screen_Driver.H"
|
||||||
#include <FL/gl.h>
|
#include <FL/gl.h>
|
||||||
#include "../../Fl_Gl_Window_Driver.H"
|
#include "Fl_WinAPI_Gl_Window_Driver.H"
|
||||||
#include "../../Fl_Gl_Choice.H"
|
#include "../../Fl_Gl_Choice.H"
|
||||||
#include "Fl_WinAPI_Window_Driver.H"
|
#include "Fl_WinAPI_Window_Driver.H"
|
||||||
#include "../GDI/Fl_Font.H"
|
#include "../GDI/Fl_Font.H"
|
||||||
@@ -36,34 +36,6 @@ extern void fl_save_dc(HWND, HDC);
|
|||||||
#define DEBUG_PFD (0) // 1 = PFD selection debug output, 0 = no debug output
|
#define DEBUG_PFD (0) // 1 = PFD selection debug output, 0 = no debug output
|
||||||
|
|
||||||
|
|
||||||
class Fl_WinAPI_Gl_Window_Driver : public Fl_Gl_Window_Driver {
|
|
||||||
friend class Fl_Gl_Window_Driver;
|
|
||||||
Fl_WinAPI_Gl_Window_Driver(Fl_Gl_Window *win) : Fl_Gl_Window_Driver(win) {}
|
|
||||||
virtual float pixels_per_unit();
|
|
||||||
virtual int mode_(int m, const int *a);
|
|
||||||
virtual void make_current_after();
|
|
||||||
virtual void swap_buffers();
|
|
||||||
virtual void invalidate() {}
|
|
||||||
virtual int flush_begin(char& valid_f);
|
|
||||||
virtual Fl_Gl_Choice *find(int m, const int *alistp);
|
|
||||||
virtual GLContext create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int layer = 0);
|
|
||||||
virtual void set_gl_context(Fl_Window* w, GLContext context);
|
|
||||||
virtual void delete_gl_context(GLContext);
|
|
||||||
virtual void make_overlay_current();
|
|
||||||
virtual void redraw_overlay();
|
|
||||||
virtual void* GetProcAddress(const char *procName);
|
|
||||||
virtual void draw_string_legacy(const char* str, int n);
|
|
||||||
virtual void gl_bitmap_font(Fl_Font_Descriptor *fl_fontsize);
|
|
||||||
virtual void get_list(Fl_Font_Descriptor *fd, int r);
|
|
||||||
virtual int genlistsize();
|
|
||||||
#if HAVE_GL_OVERLAY
|
|
||||||
virtual void gl_hide_before(void *& overlay);
|
|
||||||
virtual int can_do_overlay();
|
|
||||||
virtual int overlay_color(Fl_Color i);
|
|
||||||
void make_overlay(void*&overlay);
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
// Describes crap needed to create a GLContext.
|
// Describes crap needed to create a GLContext.
|
||||||
class Fl_WinAPI_Gl_Choice : public Fl_Gl_Choice {
|
class Fl_WinAPI_Gl_Choice : public Fl_Gl_Choice {
|
||||||
friend class Fl_WinAPI_Gl_Window_Driver;
|
friend class Fl_WinAPI_Gl_Window_Driver;
|
||||||
@@ -292,11 +264,6 @@ int Fl_WinAPI_Gl_Window_Driver::overlay_color(Fl_Color i) {
|
|||||||
#endif // HAVE_GL_OVERLAY
|
#endif // HAVE_GL_OVERLAY
|
||||||
|
|
||||||
|
|
||||||
Fl_Gl_Window_Driver *Fl_Gl_Window_Driver::newGlWindowDriver(Fl_Gl_Window *w)
|
|
||||||
{
|
|
||||||
return new Fl_WinAPI_Gl_Window_Driver(w);
|
|
||||||
}
|
|
||||||
|
|
||||||
float Fl_WinAPI_Gl_Window_Driver::pixels_per_unit()
|
float Fl_WinAPI_Gl_Window_Driver::pixels_per_unit()
|
||||||
{
|
{
|
||||||
int ns = Fl_Window_Driver::driver(pWindow)->screen_num();
|
int ns = Fl_Window_Driver::driver(pWindow)->screen_num();
|
||||||
|
|||||||
@@ -39,17 +39,6 @@ extern const char *fl_bg2;
|
|||||||
#endif // !HMONITOR_DECLARED && _WIN32_WINNT < 0x0500
|
#endif // !HMONITOR_DECLARED && _WIN32_WINNT < 0x0500
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
Creates a driver that manages all screen and display related calls.
|
|
||||||
|
|
||||||
This function must be implemented once for every platform.
|
|
||||||
*/
|
|
||||||
Fl_Screen_Driver *Fl_Screen_Driver::newScreenDriver()
|
|
||||||
{
|
|
||||||
return new Fl_WinAPI_Screen_Driver();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int Fl_WinAPI_Screen_Driver::visual(int flags)
|
int Fl_WinAPI_Screen_Driver::visual(int flags)
|
||||||
{
|
{
|
||||||
fl_GetDC(0);
|
fl_GetDC(0);
|
||||||
|
|||||||
@@ -144,15 +144,6 @@ static char *wchar_to_utf8(const wchar_t *wstr, char *&utf8) {
|
|||||||
return utf8;
|
return utf8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Creates a driver that manages all system related calls.
|
|
||||||
|
|
||||||
This function must be implemented once for every platform.
|
|
||||||
*/
|
|
||||||
Fl_System_Driver *Fl_System_Driver::newSystemDriver() {
|
|
||||||
return new Fl_WinAPI_System_Driver();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Fl_WinAPI_System_Driver::warning(const char *format, va_list args) {
|
void Fl_WinAPI_System_Driver::warning(const char *format, va_list args) {
|
||||||
// Show nothing for warnings under Windows...
|
// Show nothing for warnings under Windows...
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,12 +35,6 @@ extern HPALETTE fl_select_palette(void); // in fl_color_win32.cxx
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
Fl_Window_Driver *Fl_Window_Driver::newWindowDriver(Fl_Window *w)
|
|
||||||
{
|
|
||||||
return new Fl_WinAPI_Window_Driver(w);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Fl_WinAPI_Window_Driver::Fl_WinAPI_Window_Driver(Fl_Window *win)
|
Fl_WinAPI_Window_Driver::Fl_WinAPI_Window_Driver(Fl_Window *win)
|
||||||
: Fl_Window_Driver(win)
|
: Fl_Window_Driver(win)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
//
|
||||||
|
// Wayland-specific code to initialize wayland support.
|
||||||
|
//
|
||||||
|
// Copyright 2022 by Bill Spitzak and others.
|
||||||
|
//
|
||||||
|
// This library is free software. Distribution and use rights are outlined in
|
||||||
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
|
// file is missing or damaged, see the license at:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/COPYING.php
|
||||||
|
//
|
||||||
|
// Please see the following page on how to report bugs and issues:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/bugs.php
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#include "Fl_WinAPI_Gl_Window_Driver.H"
|
||||||
|
|
||||||
|
|
||||||
|
Fl_Gl_Window_Driver *Fl_Gl_Window_Driver::newGlWindowDriver(Fl_Gl_Window *w)
|
||||||
|
{
|
||||||
|
return new Fl_WinAPI_Gl_Window_Driver(w);
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
//
|
||||||
|
// Windows-specific code to initialize Windows support.
|
||||||
|
//
|
||||||
|
// Copyright 2022 by Bill Spitzak and others.
|
||||||
|
//
|
||||||
|
// This library is free software. Distribution and use rights are outlined in
|
||||||
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
|
// file is missing or damaged, see the license at:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/COPYING.php
|
||||||
|
//
|
||||||
|
// Please see the following page on how to report bugs and issues:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/bugs.php
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#include "../GDI/Fl_GDI_Copy_Surface_Driver.H"
|
||||||
|
#include "../GDI/Fl_GDI_Graphics_Driver.H"
|
||||||
|
#include "Fl_WinAPI_Screen_Driver.H"
|
||||||
|
#include "Fl_WinAPI_System_Driver.H"
|
||||||
|
#include "Fl_WinAPI_Window_Driver.H"
|
||||||
|
#include "../GDI/Fl_GDI_Image_Surface_Driver.H"
|
||||||
|
|
||||||
|
|
||||||
|
Fl_Copy_Surface_Driver *Fl_Copy_Surface_Driver::newCopySurfaceDriver(int w, int h)
|
||||||
|
{
|
||||||
|
return new Fl_GDI_Copy_Surface_Driver(w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Fl_Graphics_Driver *Fl_Graphics_Driver::newMainGraphicsDriver()
|
||||||
|
{
|
||||||
|
#if USE_GDIPLUS
|
||||||
|
// Initialize GDI+.
|
||||||
|
static Gdiplus::GdiplusStartupInput gdiplusStartupInput;
|
||||||
|
if (Fl_GDIplus_Graphics_Driver::gdiplusToken == 0) {
|
||||||
|
GdiplusStartup(&Fl_GDIplus_Graphics_Driver::gdiplusToken, &gdiplusStartupInput, NULL);
|
||||||
|
}
|
||||||
|
Fl_Graphics_Driver *driver = new Fl_GDIplus_Graphics_Driver();
|
||||||
|
return driver;
|
||||||
|
#else
|
||||||
|
return new Fl_GDI_Graphics_Driver();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Fl_Screen_Driver *Fl_Screen_Driver::newScreenDriver()
|
||||||
|
{
|
||||||
|
return new Fl_WinAPI_Screen_Driver();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Fl_System_Driver *Fl_System_Driver::newSystemDriver()
|
||||||
|
{
|
||||||
|
return new Fl_WinAPI_System_Driver();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Fl_Window_Driver *Fl_Window_Driver::newWindowDriver(Fl_Window *w)
|
||||||
|
{
|
||||||
|
return new Fl_WinAPI_Window_Driver(w);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Fl_Image_Surface_Driver *Fl_Image_Surface_Driver::newImageSurfaceDriver(int w, int h, int high_res, Fl_Offscreen off)
|
||||||
|
{
|
||||||
|
return new Fl_GDI_Image_Surface_Driver(w, h, high_res, off);
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
//
|
||||||
|
// Class Fl_X11_Gl_Window_Driver for the Fast Light Tool Kit (FLTK).
|
||||||
|
//
|
||||||
|
// Copyright 2022 by Bill Spitzak and others.
|
||||||
|
//
|
||||||
|
// This library is free software. Distribution and use rights are outlined in
|
||||||
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
|
// file is missing or damaged, see the license at:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/COPYING.php
|
||||||
|
//
|
||||||
|
// Please see the following page on how to report bugs and issues:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/bugs.php
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef FL_X11_GL_WINDOW_DRIVER_H
|
||||||
|
#define FL_X11_GL_WINDOW_DRIVER_H
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
#if HAVE_GL
|
||||||
|
#include <FL/platform.H>
|
||||||
|
#include "../../Fl_Gl_Choice.H"
|
||||||
|
#include "../../Fl_Gl_Window_Driver.H"
|
||||||
|
|
||||||
|
|
||||||
|
class Fl_X11_Gl_Window_Driver : public Fl_Gl_Window_Driver {
|
||||||
|
friend class Fl_Gl_Window_Driver;
|
||||||
|
Fl_X11_Gl_Window_Driver(Fl_Gl_Window *win) : Fl_Gl_Window_Driver(win) {}
|
||||||
|
virtual float pixels_per_unit();
|
||||||
|
virtual void before_show(int& need_after);
|
||||||
|
virtual int mode_(int m, const int *a);
|
||||||
|
virtual void swap_buffers();
|
||||||
|
virtual char swap_type();
|
||||||
|
virtual Fl_Gl_Choice *find(int m, const int *alistp);
|
||||||
|
virtual GLContext create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int layer = 0);
|
||||||
|
virtual void set_gl_context(Fl_Window* w, GLContext context);
|
||||||
|
virtual void delete_gl_context(GLContext);
|
||||||
|
virtual void make_overlay_current();
|
||||||
|
virtual void redraw_overlay();
|
||||||
|
virtual void waitGL();
|
||||||
|
virtual void gl_visual(Fl_Gl_Choice*); // support for Fl::gl_visual()
|
||||||
|
virtual void gl_start();
|
||||||
|
virtual void draw_string_legacy(const char* str, int n);
|
||||||
|
virtual void gl_bitmap_font(Fl_Font_Descriptor *fl_fontsize);
|
||||||
|
virtual void get_list(Fl_Font_Descriptor *fd, int r);
|
||||||
|
virtual int genlistsize();
|
||||||
|
#if !USE_XFT
|
||||||
|
virtual Fl_Font_Descriptor** fontnum_to_fontdescriptor(int fnum);
|
||||||
|
#endif
|
||||||
|
public:
|
||||||
|
static GLContext create_gl_context(XVisualInfo* vis);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // HAVE_GL
|
||||||
|
|
||||||
|
#endif // FL_X11_GL_WINDOW_DRIVER_H
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
#include "../../Fl_Gl_Choice.H"
|
#include "../../Fl_Gl_Choice.H"
|
||||||
#include "../../Fl_Screen_Driver.H"
|
#include "../../Fl_Screen_Driver.H"
|
||||||
#include "../../Fl_Window_Driver.H"
|
#include "../../Fl_Window_Driver.H"
|
||||||
#include "../../Fl_Gl_Window_Driver.H"
|
#include "Fl_X11_Gl_Window_Driver.H"
|
||||||
#include "../Xlib/Fl_Font.H"
|
#include "../Xlib/Fl_Font.H"
|
||||||
#include "../Xlib/Fl_Xlib_Graphics_Driver.H"
|
#include "../Xlib/Fl_Xlib_Graphics_Driver.H"
|
||||||
# include <GL/glx.h>
|
# include <GL/glx.h>
|
||||||
@@ -28,33 +28,6 @@
|
|||||||
# typedef void *GLXFBConfig;
|
# typedef void *GLXFBConfig;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
class Fl_X11_Gl_Window_Driver : public Fl_Gl_Window_Driver {
|
|
||||||
friend class Fl_Gl_Window_Driver;
|
|
||||||
Fl_X11_Gl_Window_Driver(Fl_Gl_Window *win) : Fl_Gl_Window_Driver(win) {}
|
|
||||||
virtual float pixels_per_unit();
|
|
||||||
virtual void before_show(int& need_after);
|
|
||||||
virtual int mode_(int m, const int *a);
|
|
||||||
virtual void swap_buffers();
|
|
||||||
virtual char swap_type();
|
|
||||||
virtual Fl_Gl_Choice *find(int m, const int *alistp);
|
|
||||||
virtual GLContext create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int layer = 0);
|
|
||||||
virtual void set_gl_context(Fl_Window* w, GLContext context);
|
|
||||||
virtual void delete_gl_context(GLContext);
|
|
||||||
virtual void make_overlay_current();
|
|
||||||
virtual void redraw_overlay();
|
|
||||||
virtual void waitGL();
|
|
||||||
virtual void gl_visual(Fl_Gl_Choice*); // support for Fl::gl_visual()
|
|
||||||
virtual void gl_start();
|
|
||||||
virtual void draw_string_legacy(const char* str, int n);
|
|
||||||
virtual void gl_bitmap_font(Fl_Font_Descriptor *fl_fontsize);
|
|
||||||
virtual void get_list(Fl_Font_Descriptor *fd, int r);
|
|
||||||
virtual int genlistsize();
|
|
||||||
#if !USE_XFT
|
|
||||||
virtual Fl_Font_Descriptor** fontnum_to_fontdescriptor(int fnum);
|
|
||||||
#endif
|
|
||||||
public:
|
|
||||||
static GLContext create_gl_context(XVisualInfo* vis);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Describes crap needed to create a GLContext.
|
// Describes crap needed to create a GLContext.
|
||||||
class Fl_X11_Gl_Choice : public Fl_Gl_Choice {
|
class Fl_X11_Gl_Choice : public Fl_Gl_Choice {
|
||||||
@@ -360,11 +333,6 @@ void Fl_X11_Gl_Window_Driver::redraw_overlay() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Fl_Gl_Window_Driver *Fl_Gl_Window_Driver::newGlWindowDriver(Fl_Gl_Window *w)
|
|
||||||
{
|
|
||||||
return new Fl_X11_Gl_Window_Driver(w);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Fl_X11_Gl_Window_Driver::before_show(int&) {
|
void Fl_X11_Gl_Window_Driver::before_show(int&) {
|
||||||
Fl_X11_Gl_Choice *g = (Fl_X11_Gl_Choice*)this->g();
|
Fl_X11_Gl_Choice *g = (Fl_X11_Gl_Choice*)this->g();
|
||||||
Fl_X::make_xid(pWindow, g->vis, g->colormap);
|
Fl_X::make_xid(pWindow, g->vis, g->colormap);
|
||||||
|
|||||||
@@ -58,24 +58,6 @@ extern const char *fl_bg2;
|
|||||||
// end of extern additions workaround
|
// end of extern additions workaround
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a driver that manages all screen and display related calls.
|
|
||||||
|
|
||||||
This function must be implemented once for every platform.
|
|
||||||
*/
|
|
||||||
Fl_Screen_Driver *Fl_Screen_Driver::newScreenDriver()
|
|
||||||
{
|
|
||||||
Fl_X11_Screen_Driver *d = new Fl_X11_Screen_Driver();
|
|
||||||
#if USE_XFT
|
|
||||||
for (int i = 0; i < MAX_SCREENS; i++) d->screens[i].scale = 1;
|
|
||||||
d->current_xft_dpi = 0.; // means the value of the Xft.dpi resource is still unknown
|
|
||||||
#else
|
|
||||||
secret_input_character = '*';
|
|
||||||
#endif
|
|
||||||
return d;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Fl_X11_Screen_Driver::display(const char *d)
|
void Fl_X11_Screen_Driver::display(const char *d)
|
||||||
{
|
{
|
||||||
if (d) setenv("DISPLAY", d, 1);
|
if (d) setenv("DISPLAY", d, 1);
|
||||||
|
|||||||
@@ -70,17 +70,6 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a driver that manages all system related calls.
|
|
||||||
|
|
||||||
This function must be implemented once for every platform.
|
|
||||||
*/
|
|
||||||
Fl_System_Driver *Fl_System_Driver::newSystemDriver()
|
|
||||||
{
|
|
||||||
return new Fl_X11_System_Driver();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Find a program in the path...
|
// Find a program in the path...
|
||||||
static char *path_find(const char *program, char *filename, int filesize) {
|
static char *path_find(const char *program, char *filename, int filesize) {
|
||||||
const char *path; // Search path
|
const char *path; // Search path
|
||||||
|
|||||||
@@ -43,11 +43,6 @@ void Fl_X11_Window_Driver::destroy_double_buffer() {
|
|||||||
other_xid = 0;
|
other_xid = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Fl_Window_Driver *Fl_Window_Driver::newWindowDriver(Fl_Window *w)
|
|
||||||
{
|
|
||||||
return new Fl_X11_Window_Driver(w);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Fl_X11_Window_Driver::Fl_X11_Window_Driver(Fl_Window *win)
|
Fl_X11_Window_Driver::Fl_X11_Window_Driver(Fl_Window *win)
|
||||||
: Fl_Window_Driver(win)
|
: Fl_Window_Driver(win)
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
//
|
||||||
|
// X11-specific code to initialize wayland support.
|
||||||
|
//
|
||||||
|
// Copyright 2022 by Bill Spitzak and others.
|
||||||
|
//
|
||||||
|
// This library is free software. Distribution and use rights are outlined in
|
||||||
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
|
// file is missing or damaged, see the license at:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/COPYING.php
|
||||||
|
//
|
||||||
|
// Please see the following page on how to report bugs and issues:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/bugs.php
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#include "Fl_X11_Gl_Window_Driver.H"
|
||||||
|
|
||||||
|
|
||||||
|
Fl_Gl_Window_Driver *Fl_Gl_Window_Driver::newGlWindowDriver(Fl_Gl_Window *w)
|
||||||
|
{
|
||||||
|
return new Fl_X11_Gl_Window_Driver(w);
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
//
|
||||||
|
// X11-specific code to initialize wayland support.
|
||||||
|
//
|
||||||
|
// Copyright 2022 by Bill Spitzak and others.
|
||||||
|
//
|
||||||
|
// This library is free software. Distribution and use rights are outlined in
|
||||||
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
|
// file is missing or damaged, see the license at:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/COPYING.php
|
||||||
|
//
|
||||||
|
// Please see the following page on how to report bugs and issues:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/bugs.php
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#include "../Xlib/Fl_Xlib_Copy_Surface_Driver.H"
|
||||||
|
#include "../Xlib/Fl_Xlib_Graphics_Driver.H"
|
||||||
|
#include "Fl_X11_Screen_Driver.H"
|
||||||
|
#include "Fl_X11_System_Driver.H"
|
||||||
|
#include "Fl_X11_Window_Driver.H"
|
||||||
|
#include "../Xlib/Fl_Xlib_Image_Surface_Driver.H"
|
||||||
|
|
||||||
|
|
||||||
|
Fl_Copy_Surface_Driver *Fl_Copy_Surface_Driver::newCopySurfaceDriver(int w, int h)
|
||||||
|
{
|
||||||
|
return new Fl_Xlib_Copy_Surface_Driver(w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Fl_Graphics_Driver *Fl_Graphics_Driver::newMainGraphicsDriver()
|
||||||
|
{
|
||||||
|
return new Fl_Xlib_Graphics_Driver();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Fl_Screen_Driver *Fl_Screen_Driver::newScreenDriver()
|
||||||
|
{
|
||||||
|
Fl_X11_Screen_Driver *d = new Fl_X11_Screen_Driver();
|
||||||
|
#if USE_XFT
|
||||||
|
for (int i = 0; i < MAX_SCREENS; i++) d->screens[i].scale = 1;
|
||||||
|
d->current_xft_dpi = 0.; // means the value of the Xft.dpi resource is still unknown
|
||||||
|
#else
|
||||||
|
secret_input_character = '*';
|
||||||
|
#endif
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Fl_System_Driver *Fl_System_Driver::newSystemDriver()
|
||||||
|
{
|
||||||
|
return new Fl_X11_System_Driver();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Fl_Window_Driver *Fl_Window_Driver::newWindowDriver(Fl_Window *w)
|
||||||
|
{
|
||||||
|
return new Fl_X11_Window_Driver(w);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Fl_Image_Surface_Driver *Fl_Image_Surface_Driver::newImageSurfaceDriver(int w, int h, int high_res, Fl_Offscreen off)
|
||||||
|
{
|
||||||
|
return new Fl_Xlib_Image_Surface_Driver(w, h, high_res, off);
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
//
|
||||||
|
// Copy-to-clipboard code for the Fast Light Tool Kit (FLTK).
|
||||||
|
//
|
||||||
|
// Copyright 2022 by Bill Spitzak and others.
|
||||||
|
//
|
||||||
|
// This library is free software. Distribution and use rights are outlined in
|
||||||
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
|
// file is missing or damaged, see the license at:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/COPYING.php
|
||||||
|
//
|
||||||
|
// Please see the following page on how to report bugs and issues:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/bugs.php
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef FL_XLIB_COPY_SURFACE_DRIVER_H
|
||||||
|
#define FL_XLIB_COPY_SURFACE_DRIVER_H
|
||||||
|
|
||||||
|
#include <FL/Fl_Copy_Surface.H>
|
||||||
|
#include <FL/platform.H>
|
||||||
|
|
||||||
|
class Fl_Xlib_Copy_Surface_Driver : public Fl_Copy_Surface_Driver {
|
||||||
|
friend class Fl_Copy_Surface_Driver;
|
||||||
|
virtual void end_current();
|
||||||
|
protected:
|
||||||
|
Fl_Offscreen xid;
|
||||||
|
Window oldwindow;
|
||||||
|
Fl_Xlib_Copy_Surface_Driver(int w, int h);
|
||||||
|
~Fl_Xlib_Copy_Surface_Driver();
|
||||||
|
void set_current();
|
||||||
|
void translate(int x, int y);
|
||||||
|
void untranslate();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FL_XLIB_COPY_SURFACE_DRIVER_H
|
||||||
@@ -15,32 +15,13 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <FL/Fl_Copy_Surface.H>
|
#include "Fl_Xlib_Copy_Surface_Driver.H"
|
||||||
#include <FL/Fl.H>
|
#include <FL/Fl.H>
|
||||||
#include <FL/platform.H>
|
#include <FL/platform.H>
|
||||||
#include <FL/fl_draw.H>
|
#include <FL/fl_draw.H>
|
||||||
#include "Fl_Xlib_Graphics_Driver.H"
|
#include "Fl_Xlib_Graphics_Driver.H"
|
||||||
#include "../X11/Fl_X11_Screen_Driver.H"
|
#include "../X11/Fl_X11_Screen_Driver.H"
|
||||||
|
|
||||||
class Fl_Xlib_Copy_Surface_Driver : public Fl_Copy_Surface_Driver {
|
|
||||||
friend class Fl_Copy_Surface_Driver;
|
|
||||||
virtual void end_current();
|
|
||||||
protected:
|
|
||||||
Fl_Offscreen xid;
|
|
||||||
Window oldwindow;
|
|
||||||
Fl_Xlib_Copy_Surface_Driver(int w, int h);
|
|
||||||
~Fl_Xlib_Copy_Surface_Driver();
|
|
||||||
void set_current();
|
|
||||||
void translate(int x, int y);
|
|
||||||
void untranslate();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
Fl_Copy_Surface_Driver *Fl_Copy_Surface_Driver::newCopySurfaceDriver(int w, int h)
|
|
||||||
{
|
|
||||||
return new Fl_Xlib_Copy_Surface_Driver(w, h);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Fl_Xlib_Copy_Surface_Driver::Fl_Xlib_Copy_Surface_Driver(int w, int h) : Fl_Copy_Surface_Driver(w, h) {
|
Fl_Xlib_Copy_Surface_Driver::Fl_Xlib_Copy_Surface_Driver(int w, int h) : Fl_Copy_Surface_Driver(w, h) {
|
||||||
driver(new Fl_Xlib_Graphics_Driver());
|
driver(new Fl_Xlib_Graphics_Driver());
|
||||||
|
|||||||
@@ -30,14 +30,6 @@ extern char fl_is_over_the_spot;
|
|||||||
extern char *fl_get_font_xfld(int fnum, int size);
|
extern char *fl_get_font_xfld(int fnum, int size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* By linking this module, the following static method will instantiate the
|
|
||||||
* X11 Xlib Graphics driver as the main display driver.
|
|
||||||
*/
|
|
||||||
Fl_Graphics_Driver *Fl_Graphics_Driver::newMainGraphicsDriver()
|
|
||||||
{
|
|
||||||
return new Fl_Xlib_Graphics_Driver();
|
|
||||||
}
|
|
||||||
|
|
||||||
GC Fl_Xlib_Graphics_Driver::gc_ = NULL;
|
GC Fl_Xlib_Graphics_Driver::gc_ = NULL;
|
||||||
int Fl_Xlib_Graphics_Driver::fl_overlay = 0;
|
int Fl_Xlib_Graphics_Driver::fl_overlay = 0;
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
//
|
||||||
|
// Draw-to-image code for the Fast Light Tool Kit (FLTK).
|
||||||
|
//
|
||||||
|
// Copyright 2022 by Bill Spitzak and others.
|
||||||
|
//
|
||||||
|
// This library is free software. Distribution and use rights are outlined in
|
||||||
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
|
// file is missing or damaged, see the license at:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/COPYING.php
|
||||||
|
//
|
||||||
|
// Please see the following page on how to report bugs and issues:
|
||||||
|
//
|
||||||
|
// https://www.fltk.org/bugs.php
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef FL_XLIB_IMAGE_SURFACE_DRIVER_H
|
||||||
|
#define FL_XLIB_IMAGE_SURFACE_DRIVER_H
|
||||||
|
|
||||||
|
#include <FL/Fl_Image_Surface.H>
|
||||||
|
|
||||||
|
class Fl_Xlib_Image_Surface_Driver : public Fl_Image_Surface_Driver {
|
||||||
|
virtual void end_current();
|
||||||
|
public:
|
||||||
|
Window pre_window;
|
||||||
|
Fl_Xlib_Image_Surface_Driver(int w, int h, int high_res, Fl_Offscreen off);
|
||||||
|
~Fl_Xlib_Image_Surface_Driver();
|
||||||
|
void set_current();
|
||||||
|
void translate(int x, int y);
|
||||||
|
void untranslate();
|
||||||
|
Fl_RGB_Image *image();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FL_XLIB_IMAGE_SURFACE_DRIVER_H
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user