Create struct wld_window *Fl_Wayland_Window_Driver::wld_window to replace eventually fl_window.
This commit is contained in:
parent
2d71a95b5d
commit
54ecae9bda
@ -24,7 +24,7 @@
|
||||
|
||||
|
||||
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_Wayland_Window_Driver::wld_window ? Fl_Wayland_Window_Driver::wld_window->scale : 1);
|
||||
img_surf = new Fl_Image_Surface(w * os_scale, h * os_scale);
|
||||
driver(img_surf->driver());
|
||||
driver()->scale(os_scale);
|
||||
|
@ -84,10 +84,10 @@ void Fl_Wayland_Gl_Window_Driver::init() {
|
||||
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
|
||||
Window save_win = fl_window;
|
||||
fl_window = NULL;
|
||||
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_window = save_win;
|
||||
fl_window = Fl_Wayland_Window_Driver::wld_window = save_win;
|
||||
Fl_Font f=fl_font();
|
||||
Fl_Surface_Device::push_current(surf);
|
||||
fl_color(FL_BLACK);
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
class Fl_Wayland_Image_Surface_Driver : public Fl_Image_Surface_Driver {
|
||||
virtual void end_current();
|
||||
Window pre_window;
|
||||
struct wld_window *pre_window;
|
||||
public:
|
||||
Fl_Wayland_Image_Surface_Driver(int w, int h, int high_res, Fl_Offscreen off);
|
||||
~Fl_Wayland_Image_Surface_Driver();
|
||||
|
@ -25,8 +25,8 @@ Fl_Wayland_Image_Surface_Driver::Fl_Wayland_Image_Surface_Driver(int w, int h, i
|
||||
float d = 1;
|
||||
if (!off) {
|
||||
fl_open_display();
|
||||
if (fl_window) {
|
||||
d = fl_window->scale;
|
||||
if (Fl_Wayland_Window_Driver::wld_window) {
|
||||
d = Fl_Wayland_Window_Driver::wld_window->scale;
|
||||
}
|
||||
d *= fl_graphics_driver->scale();
|
||||
if (d != 1 && high_res) {
|
||||
@ -56,14 +56,14 @@ Fl_Wayland_Image_Surface_Driver::~Fl_Wayland_Image_Surface_Driver() {
|
||||
void Fl_Wayland_Image_Surface_Driver::set_current() {
|
||||
Fl_Surface_Device::set_current();
|
||||
((Fl_Wayland_Graphics_Driver*)fl_graphics_driver)->activate(offscreen, driver()->scale());
|
||||
pre_window = fl_window;
|
||||
fl_window = NULL;
|
||||
pre_window = Fl_Wayland_Window_Driver::wld_window;
|
||||
fl_window = Fl_Wayland_Window_Driver::wld_window = NULL;
|
||||
}
|
||||
|
||||
void Fl_Wayland_Image_Surface_Driver::end_current() {
|
||||
cairo_surface_t *surf = cairo_get_target(offscreen->cairo_);
|
||||
cairo_surface_flush(surf);
|
||||
fl_window = pre_window;
|
||||
fl_window = Fl_Wayland_Window_Driver::wld_window = pre_window;
|
||||
}
|
||||
|
||||
void Fl_Wayland_Image_Surface_Driver::translate(int x, int y) {
|
||||
|
@ -88,6 +88,7 @@ public:
|
||||
struct xdg_toplevel *xdg_toplevel();
|
||||
Fl_Wayland_Window_Driver(Fl_Window*);
|
||||
virtual ~Fl_Wayland_Window_Driver();
|
||||
static struct wld_window *wld_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);}
|
||||
|
@ -52,6 +52,7 @@ extern "C" {
|
||||
#define fl_max(a,b) ((a) > (b) ? (a) : (b))
|
||||
|
||||
Window fl_window;
|
||||
struct wld_window *Fl_Wayland_Window_Driver::wld_window = NULL;
|
||||
|
||||
|
||||
void Fl_Wayland_Window_Driver::destroy_double_buffer() {
|
||||
@ -405,7 +406,7 @@ void Fl_Wayland_Window_Driver::make_current() {
|
||||
}
|
||||
|
||||
fl_graphics_driver->clip_region(0);
|
||||
fl_window = window;
|
||||
fl_window = Fl_Wayland_Window_Driver::wld_window = window;
|
||||
if (!window->buffer) {
|
||||
window->buffer = Fl_Wayland_Graphics_Driver::create_shm_buffer(
|
||||
pWindow->w() * scale, pWindow->h() * scale);
|
||||
|
Loading…
Reference in New Issue
Block a user