FLTK logo

[master] 8dd7ab1 - Fix for issue #450 : Fl_Counter slips into infinite loop (V2).

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[master] 8dd7ab1 - Fix for issue #450 : Fl_Counter slips into infinite loop (V2). "ManoloFLTK" Jun 27, 2022  
 
commit 8dd7ab19220d06c0181fc422ea11d17ea97aa154
Author:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Mon Jun 27 19:40:08 2022 +0200
Commit:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Mon Jun 27 19:40:08 2022 +0200

    Fix for issue #450 :  Fl_Counter slips into infinite loop (V2).
    
    Need to poll only for the file descriptor associated to the wayland display.

 src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
index dad143c..fbf27ad 100644
--- src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
+++ src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
@@ -39,6 +39,7 @@
 #include "text-input-client-protocol.h"
 #include <assert.h>
 #include <sys/mman.h>
+#include <poll.h>
 extern "C" {
   bool libdecor_get_cursor_settings(char **theme, int *size);
 }
@@ -1056,10 +1057,13 @@ static const struct wl_registry_listener registry_listener = {
 };
 
 
-static void fd_callback(int unused, struct wl_display *display) {
-  wl_display_dispatch(display);
-  static Fl_Wayland_System_Driver *sys_dr = (Fl_Wayland_System_Driver*)Fl::system_driver();
-  while (sys_dr->poll_or_select() > 0) wl_display_dispatch(display);
+static void fd_callback(int fd, struct wl_display *display) {
+  struct pollfd fds;
+  fds.fd = fd;
+  fds.events = POLLIN;
+  fds.revents = 0;
+  do wl_display_dispatch(display);
+  while (poll(&fds, 1, 0) > 0);
 }
 
 
Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.