summaryrefslogtreecommitdiff
path: root/src/drivers/Wayland
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2025-01-10 08:20:01 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2025-01-10 08:20:01 +0100
commit7bb8bdb1fa2768dc19cf428e0b013ab66191b9e9 (patch)
tree414ca8580d7dd96c6a81d3927589d7afa404d62a /src/drivers/Wayland
parentc0c2cf7d408fc6bfefd9eecbfe5aabcbc4d55ff3 (diff)
Fix Fl_{Wayland|Xlib}_{Copy|Image}_Surface_Driver::set_current()
Member function Fl_Cairo_Graphics_Driver::set_cairo() needs be called only to initialize the driver. Doing it also later undoes the effect of Fl_Widget_Surface::translate() if used when Fl_Surface_Device::pop_current() calls the overridden Fl_Surface_Device::set_current().
Diffstat (limited to 'src/drivers/Wayland')
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Copy_Surface_Driver.cxx3
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Image_Surface_Driver.cxx3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Copy_Surface_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Copy_Surface_Driver.cxx
index 0b84a037b..043114781 100644
--- a/src/drivers/Wayland/Fl_Wayland_Copy_Surface_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Copy_Surface_Driver.cxx
@@ -45,7 +45,8 @@ Fl_Wayland_Copy_Surface_Driver::~Fl_Wayland_Copy_Surface_Driver() {
void Fl_Wayland_Copy_Surface_Driver::set_current() {
Fl_Surface_Device::set_current();
- ((Fl_Wayland_Graphics_Driver*)driver())->set_cairo((cairo_t*)img_surf->offscreen());
+ Fl_Cairo_Graphics_Driver *dr = (Fl_Cairo_Graphics_Driver*)driver();
+ if (!dr->cr()) dr->set_cairo((cairo_t*)img_surf->offscreen());
}
diff --git a/src/drivers/Wayland/Fl_Wayland_Image_Surface_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Image_Surface_Driver.cxx
index a3850f6da..ec9c56cb7 100644
--- a/src/drivers/Wayland/Fl_Wayland_Image_Surface_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Image_Surface_Driver.cxx
@@ -76,7 +76,8 @@ 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)->set_cairo((cairo_t*)offscreen);
+ Fl_Cairo_Graphics_Driver *dr = (Fl_Cairo_Graphics_Driver*)driver();
+ if (!dr->cr()) dr->set_cairo((cairo_t*)offscreen);
pre_window = Fl_Wayland_Window_Driver::wld_window;
Fl_Wayland_Window_Driver::wld_window = NULL;
fl_window = 0;