|
|
commit c02fba6bb9af3254bc617eb090bce7820f58614a
Author: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Sat May 7 18:08:07 2022 +0200
Commit: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Sat May 7 18:08:07 2022 +0200
Slight simplification of Fl_Wayland_Graphics_Driver::create_shm_buffer().
src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
diff --git src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx
index ffc86bd..f0b4fd6 100644
--- src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx
+++ 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);
}
[ Direct Link to Message ] | |
|
| |