summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-05-07 18:08:07 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-05-07 18:08:07 +0200
commitc02fba6bb9af3254bc617eb090bce7820f58614a (patch)
tree0f1ff06ded6f6aadd31fab8c6f3fca1e3e3937ee
parent1d64b785549fcfe5f329cd7b06547e7bf2687df3 (diff)
Slight simplification of Fl_Wayland_Graphics_Driver::create_shm_buffer().
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx
index ffc86bd03..f0b4fd6f7 100644
--- a/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx
@@ -36,18 +36,6 @@ extern "C" {
int os_create_anonymous_file(off_t);
}
-static int create_anonymous_file(int size, char **pshared)
-{
- int fd = os_create_anonymous_file(size);
- *pshared = (char*)mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
- if (*pshared == MAP_FAILED) {
- close(fd);
- Fl::fatal("mmap failed: %s\n", strerror(errno));
- }
-//printf("create_anonymous_file: %d\n",size);
- return fd;
-}
-
struct fl_wld_buffer *Fl_Wayland_Graphics_Driver::create_shm_buffer(int width, int height)
{
@@ -66,7 +54,12 @@ struct fl_wld_buffer *Fl_Wayland_Graphics_Driver::create_shm_buffer(int width, i
close(fd);
}
if (size > pool_size) pool_size = 2 * size;
- fd = create_anonymous_file(pool_size, &pool_memory);
+ fd = os_create_anonymous_file(pool_size);
+ pool_memory = (char*)mmap(NULL, pool_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ if (pool_memory == MAP_FAILED) {
+ close(fd);
+ Fl::fatal("mmap failed: %s\n", strerror(errno));
+ }
Fl_Wayland_Screen_Driver *scr_driver = (Fl_Wayland_Screen_Driver*)Fl::screen_driver();
pool = wl_shm_create_pool(scr_driver->wl_shm, fd, pool_size);
}