Hi (again),
here is the patches the libX11 issue for x11/fvwm3. I will also send a
merge request upstreams.
ok ?
Index: Makefile
===================================================================
RCS file: /cvs/OpenBSD/ports/x11/fvwm3/Makefile,v
retrieving revision 1.3
diff -u -p -u -r1.3 Makefile
--- Makefile 29 Jul 2022 07:45:05 -0000 1.3
+++ Makefile 8 Aug 2022 19:55:35 -0000
@@ -1,6 +1,7 @@
COMMENT= multiple virtual desktop window manager
VERSION= 1.0.4
+REVISION= 0
DISTNAME= fvwm3-${VERSION}
CATEGORIES= x11
Index: patches/patch-fvwm_events_c
===================================================================
RCS file: patches/patch-fvwm_events_c
diff -N patches/patch-fvwm_events_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-fvwm_events_c 8 Aug 2022 19:54:58 -0000
@@ -0,0 +1,28 @@
+Fix for XCheckIfEvent() callback lock recursion
+
+Index: fvwm/events.c
+--- fvwm/events.c.orig
++++ fvwm/events.c
+@@ -257,6 +257,12 @@ static int _pred_weed_accumulate_expose(
+ return 1;
+ }
+
++static int _pred_weed_is_expose(
++ Display *display, XEvent *event, XPointer arg)
++{
++ return (event->type == Expose);
++}
++
+ static int _pred_weed_handle_expose(
+ Display *display, XEvent *event, XPointer arg)
+ {
+@@ -4526,7 +4532,8 @@ void handle_all_expose(void)
+
+ saved_event = fev_save_event();
+ FPending(dpy);
+- FWeedIfEvents(dpy, _pred_weed_handle_expose, NULL);
++ FWeedAndHandleIfEvents(dpy, _pred_weed_is_expose,
++ _pred_weed_handle_expose, NULL);
+ fev_restore_event(saved_event);
+
+ return;
Index: patches/patch-libs_FEvent_c
===================================================================
RCS file: patches/patch-libs_FEvent_c
diff -N patches/patch-libs_FEvent_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-libs_FEvent_c 8 Aug 2022 19:54:58 -0000
@@ -0,0 +1,34 @@
+Fix for XCheckIfEvent() callback lock recursion
+
+Index: libs/FEvent.c
+--- libs/FEvent.c.orig
++++ libs/FEvent.c
+@@ -534,6 +534,28 @@ int FWeedIfEvents(
+ return weed_args.count;
+ }
+
++int FWeedAndHandleIfEvents(
++ Display *display,
++ int (*weed_predicate) (Display *display, XEvent *event, XPointer arg),
++ int (*handler) (Display *display, XEvent *event, XPointer arg),
++ XPointer arg)
++{
++ _fev_weed_args weed_args;
++ XEvent e;
++
++ assert(fev_is_invalid_event_type_set);
++ memset(&weed_args, 0, sizeof(weed_args));
++ weed_args.weed_predicate = weed_predicate;
++ weed_args.arg = arg;
++ if (FCheckPeekIfEvent(display, &e, _fev_pred_weed_if,
++ (XPointer)&weed_args)) {
++ handler(display, &e, arg);
++ }
++ _fev_pred_weed_if_finish(&weed_args);
++
++ return weed_args.count;
++}
++
+ int FWeedIfWindowEvents(
+ Display *display, Window window,
+ int (*weed_predicate) (
Index: patches/patch-libs_FEvent_h
===================================================================
RCS file: patches/patch-libs_FEvent_h
diff -N patches/patch-libs_FEvent_h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-libs_FEvent_h 8 Aug 2022 19:55:01 -0000
@@ -0,0 +1,20 @@
+Fix for XCheckIfEvent() callback lock recursion
+
+Index: libs/FEvent.h
+--- libs/FEvent.h.orig
++++ libs/FEvent.h
+@@ -114,6 +114,14 @@ int FWeedIfEvents(
+ Display *display, XEvent *current_event, XPointer arg),
+ XPointer arg);
+
++/* Same as FWeedIfEvents but with a second callback out of XLockDisplay()
++ * to handle events in a lock-safe manner */
++int FWeedAndHandleIfEvents(
++ Display *display,
++ int (*weed_predicate) (Display *display, XEvent *event, XPointer arg),
++ int (*handler) (Display *display, XEvent *event, XPointer arg),
++ XPointer arg);
++
+ /* Same as FWeedIfEvents but weeds only events for the given window. The
+ * weed_predicate is only called for events with a matching window. */
+ int FWeedIfWindowEvents(
--
Matthieu Herrb