summaryrefslogtreecommitdiff
path: root/src/drivers/Wayland
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-09-11 19:45:48 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-09-11 19:45:48 +0200
commitd028f0b37d12636f1956ad59843d2dec96b12a91 (patch)
tree924b4e6a3ea7b15e6e054d534e20aef65671e2d4 /src/drivers/Wayland
parent98d8a5da0c6449eb1e976d00368e6469dea4df1d (diff)
Fix fl_read_image() under hybrid Wayland/X11 platform.
Function fl_read_image() obliges to keep a minimal use of global variable fl_window also under the Wayland platform, even if its type (Window) makes little sense for the hybrid library because it has its X11 value (given by X11/X.h) which is not meaningful for the Wayland leg of the hybrid platform. Virtual member function Fl_Surface_Device::as_image_surface() becomes useless.
Diffstat (limited to 'src/drivers/Wayland')
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Image_Surface_Driver.cxx2
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx3
2 files changed, 4 insertions, 1 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Image_Surface_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Image_Surface_Driver.cxx
index 4f64434d8..b3dcc179c 100644
--- a/src/drivers/Wayland/Fl_Wayland_Image_Surface_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Image_Surface_Driver.cxx
@@ -60,12 +60,14 @@ void Fl_Wayland_Image_Surface_Driver::set_current() {
((Fl_Wayland_Graphics_Driver*)fl_graphics_driver)->set_buffer((struct fl_wld_buffer*)offscreen);
pre_window = Fl_Wayland_Window_Driver::wld_window;
Fl_Wayland_Window_Driver::wld_window = NULL;
+ fl_window = 0;
}
void Fl_Wayland_Image_Surface_Driver::end_current() {
cairo_surface_t *surf = cairo_get_target(((struct fl_wld_buffer *)offscreen)->cairo_);
cairo_surface_flush(surf);
Fl_Wayland_Window_Driver::wld_window = pre_window;
+ fl_window = (Window)pre_window;
}
void Fl_Wayland_Image_Surface_Driver::translate(int x, int y) {
diff --git a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
index e35cfddcb..43c3d3f1b 100644
--- a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
@@ -51,7 +51,7 @@ extern "C" {
#define fl_min(a,b) ((a) < (b) ? (a) : (b))
#if !FLTK_USE_X11
-Window fl_window = 0; // temporary, until we get rid of this global for wayland
+Window fl_window = 0;
#endif
@@ -362,6 +362,7 @@ void Fl_Wayland_Window_Driver::make_current() {
}
Fl_Wayland_Window_Driver::wld_window = window;
+ fl_window = (Window)window;
float scale = Fl::screen_scale(pWindow->screen_num()) * window->scale;
if (!window->buffer) {
window->buffer = Fl_Wayland_Graphics_Driver::create_shm_buffer(