(x-display-process-events (x-display/xd display)
2)))
(if event
- (begin (process-event display event)
+ (begin (if (not (eq? #t event))
+ (process-event display event))
(loop))))))))))))
(set-x-display/previewer-registration! display registration)))
#t
'READ))
(x-display-process-events (x-display/xd display) 1)))))
- (if event
+ (if (and event (not (eq? #t event)))
(process-event display event))))
(define (discard-events display)
((x-display-process-events (x-display/xd display) 2)
=>
(lambda (event)
- (process-event display event)
+ (if (not (eq? #t event))
+ (process-event display event))
(loop))))))))
(with-thread-events-blocked loop)))
\f
(let loop ()
(let ((event (x-display-process-events x-display-data 2)))
(if event
- (begin (preview-event event x-display-events)
+ (begin (if (not (eq? #t event))
+ (preview-event event x-display-events))
(loop))))))
(register!))))
(if event
(if (and (vector? event) (predicate event))
(or (process-event event) (loop))
- (begin (preview-event event x-display-events) (loop)))
+ (begin (if (not (eq? #t event))
+ (preview-event event x-display-events))
+ (loop)))
;; Busy loop!
(and (< (real-time-clock) timeout)
(loop)))))))
((and (vector? event)
(fix:= event-type:expose (vector-ref event 0)))
(process-expose-event event))
+ ((and (vector? event)
+ (fix:= event-type:property-notify (vector-ref event 0)))
+ ;; These events are only used inside wait-for-event, in the
+ ;; previewer, with events blocked, though many more are sent
+ ;; and needn't be queued.
+ unspecific)
((and (vector? event)
(or (fix:= event-type:map (vector-ref event 0))
(fix:= event-type:unmap (vector-ref event 0))
extern int x_set_default_font (struct xdisplay * xd, const char * name);
extern int x_display_descriptor (struct xdisplay * xd);
extern long x_max_request_size (struct xdisplay * xd);
-extern struct xwindow * x_display_process_events (struct xdisplay * xd,
- XEvent * event);
+extern int x_display_process_events (struct xdisplay * xd,
+ XEvent * event,
+ struct xwindow ** xw_ret);
extern void x_select_input (struct xdisplay * xd, Window window, long mask);
extern long x_window_event_mask (struct xwindow * xw);
extern int x_window_set_event_mask (struct xwindow * xw, long mask);
x_max_request_size
(xd (* (struct xdisplay))))
-(extern (* (struct xwindow))
+(extern int
x_display_process_events
(xd (* (struct xdisplay)))
- (event (* XEvent)))
+ (event (* XEvent))
+ (xw_ret (* (* (struct xwindow)))))
(extern void
x_select_input
}
}
-static struct xwindow *
-xd_process_events (struct xdisplay * xd, XEvent * result)
+static int
+xd_process_events (struct xdisplay * xd, XEvent * result,
+ struct xwindow ** xw_ret)
{
Display * display = (XD_DISPLAY (xd));
unsigned int events_queued;
XEvent event;
- struct xwindow * retval = NULL;
+ struct xwindow * xw = NULL;
+ int done_p = 1;
+
if (x_debug > 1)
{
fprintf (stderr, "Enter xd_process_events\n");
events_queued = (XEventsQueued (display, QueuedAfterReading));
while (0 < events_queued)
{
- struct xwindow * xw;
events_queued -= 1;
XNextEvent (display, (&event));
if ((event.type) == KeymapNotify)
if (xw_process_event (xw, (&event)))
continue;
memcpy (result, &event, sizeof (XEvent));
- retval = xw;
+ *xw_ret = xw;
+ done_p = 0;
break;
}
if (x_debug > 1)
{
- fprintf (stderr, "Return from xd_process_events: 0x%lx\n",
- ((unsigned long) retval));
+ fprintf (stderr, "Return from xd_process_events: %d 0x%lx\n",
+ done_p, ((unsigned long) xw));
fflush (stderr);
}
- return (retval);
+ return (done_p);
}
\f
/* Open/Close Primitives */
return (XMaxRequestSize (display));
}
-struct xwindow *
-x_display_process_events (struct xdisplay * xd, XEvent * event)
+int
+x_display_process_events (struct xdisplay * xd, XEvent * event,
+ struct xwindow **xw_ret)
{
- return (xd_process_events (xd, event));
+ return (xd_process_events (xd, event, xw_ret));
}
void
|#
;;;; X11 interface
-;;; package: (x11)
+;;; package: (x11 base)
;;;
;;; These were once primitives created by x11base.c in umodule prx11.
(define (x-display-process-events display how)
(declare (ignore how))
(guarantee-xdisplay display 'x-display-process-events)
- (let* ((event (malloc (C-sizeof "XEvent") '|XEvent|))
- (window (C-call "x_display_process_events"
- (make-alien '(struct |xwindow|))
- display event)))
- (let ((obj (if (alien-null? window)
- #f
- (make-event-object window event))))
+ (let ((event (malloc (C-sizeof "XEvent") '|XEvent|))
+ (xw (malloc (C-sizeof "* struct xwindow") '(* (struct |xwindow|)))))
+ (let* ((done-p (C-call "x_display_process_events"
+ display event xw))
+ (window (C-> xw "* xwindow" (make-alien '(struct |xwindow|))))
+ (obj (if (= done-p 1)
+ #f
+ (or (make-event-object window event)
+ #t))))
+ (free xw)
(free event)
obj)))
(x-display-process-events (x-display/xd display)
2)))
(if event
- (begin (process-event display event)
- (loop))))))))))))
+ (begin
+ (if (not (eq? #t event))
+ (process-event display event))
+ (loop))))))))))))
(set-x-display/previewer-registration! display registration)))
(define (read-event display)
#t
'READ))
(x-display-process-events (x-display/xd display) 1)))))
- (if event
+ (if (and event (not (eq? #t event)))
(process-event display event))))
(define (discard-events display)
((x-display-process-events (x-display/xd display) 2)
=>
(lambda (event)
- (process-event display event)
+ (if (not (eq? #t event))
+ (process-event display event))
(loop))))))))
(with-thread-events-blocked loop)))
\f