summaryrefslogtreecommitdiff
path: root/src/drivers/Wayland
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2024-03-20 15:20:31 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2024-03-20 15:20:31 +0100
commit0fa49f0ab4136262dc16c1b30bf07e3fcef36be5 (patch)
treed5ab5146b28aee9facb6544901229802024dd031 /src/drivers/Wayland
parentaf90841fbc0a7090d7f3979c4d71aeeec1fbcb4b (diff)
Use type cairo_region_t* for Fl_Region under Wayland platform
Diffstat (limited to 'src/drivers/Wayland')
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Graphics_Driver.H2
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx19
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx2
3 files changed, 13 insertions, 10 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.H b/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.H
index c3730dee4..ac8786a47 100644
--- a/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.H
+++ b/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.H
@@ -60,7 +60,7 @@ public:
static struct wld_buffer *create_wld_buffer(int width, int height, bool with_shm = true);
static void create_shm_buffer(wld_buffer *buffer);
static void buffer_release(struct wld_window *window);
- static void buffer_commit(struct wld_window *window, struct flCairoRegion *r = NULL);
+ static void buffer_commit(struct wld_window *window, cairo_region_t *r = NULL);
static void cairo_init(struct draw_buffer *buffer, int width, int height, int stride,
cairo_format_t format);
// used by class Fl_Wayland_Gl_Window_Driver
diff --git a/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx
index ce9dcaf4e..1855bc20f 100644
--- a/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx
@@ -22,7 +22,7 @@
#include <unistd.h> // for close()
#include <errno.h>
#include <string.h> // for strerror()
-
+#include <cairo/cairo.h>
extern "C" {
# include "../../../libdecor/src/os-compatibility.h" // for libdecor_os_create_anonymous_file()
@@ -139,15 +139,18 @@ const struct wl_callback_listener *Fl_Wayland_Graphics_Driver::p_surface_frame_l
// copy pixels in region r from the Cairo surface to the Wayland buffer
-static void copy_region(struct wld_window *window, struct flCairoRegion *r) {
+static void copy_region(struct wld_window *window, cairo_region_t *r) {
struct Fl_Wayland_Graphics_Driver::wld_buffer *buffer = window->buffer;
float f = Fl::screen_scale(window->fl_win->screen_num()) *
Fl_Wayland_Window_Driver::driver(window->fl_win)->wld_scale();
- for (int i = 0; i < r->count; i++) {
- int left = r->rects[i].x * f;
- int top = r->rects[i].y * f;
- int width = r->rects[i].width * f;
- int height = r->rects[i].height * f;
+ int count = cairo_region_num_rectangles(r);
+ cairo_rectangle_int_t rect;
+ for (int i = 0; i < count; i++) {
+ cairo_region_get_rectangle(r, i, &rect);
+ int left = rect.x * f;
+ int top = rect.y * f;
+ int width = rect.width * f;
+ int height = rect.height * f;
int offset = top * buffer->draw_buffer.stride + 4 * left;
int W4 = 4 * width;
for (int l = 0; l < height; l++) {
@@ -163,7 +166,7 @@ static void copy_region(struct wld_window *window, struct flCairoRegion *r) {
}
-void Fl_Wayland_Graphics_Driver::buffer_commit(struct wld_window *window, struct flCairoRegion *r)
+void Fl_Wayland_Graphics_Driver::buffer_commit(struct wld_window *window, cairo_region_t *r)
{
if (!window->buffer->wl_buffer) create_shm_buffer(window->buffer);
cairo_surface_t *surf = cairo_get_target(window->buffer->draw_buffer.cairo_);
diff --git a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
index 92e04d578..e8a0a1af9 100644
--- a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
@@ -408,7 +408,7 @@ void Fl_Wayland_Window_Driver::flush() {
if (!window || !window->configured_width) return;
Fl_X *ip = Fl_X::flx(pWindow);
- struct flCairoRegion* r = (struct flCairoRegion*)ip->region;
+ cairo_region_t* r = (cairo_region_t*)ip->region;
if (!window->buffer || pWindow->as_overlay_window()) r = NULL;
Fl_Wayland_Window_Driver::in_flush_ = true;