diff options
| author | Po Lu | 2022-08-03 20:17:18 +0800 |
|---|---|---|
| committer | Po Lu | 2022-08-03 20:17:31 +0800 |
| commit | 6fb206329f9c3f14154bd425e08b2e72e7f31855 (patch) | |
| tree | c5efc58894853eecbea71ca141c00c197ea53168 /src/xterm.c | |
| parent | bb56cc4cad3a5680e30dc29723690708bcff08f2 (diff) | |
| download | emacs-6fb206329f9c3f14154bd425e08b2e72e7f31855.tar.gz emacs-6fb206329f9c3f14154bd425e08b2e72e7f31855.zip | |
; * src/xterm.c (x_if_event): Minor speed improvements.
Diffstat (limited to 'src/xterm.c')
| -rw-r--r-- | src/xterm.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/xterm.c b/src/xterm.c index eb1a557e883..f82340958e5 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -6605,12 +6605,17 @@ x_if_event (Display *dpy, XEvent *event_return, | |||
| 6605 | current_time = current_timespec (); | 6605 | current_time = current_timespec (); |
| 6606 | target = timespec_add (current_time, timeout); | 6606 | target = timespec_add (current_time, timeout); |
| 6607 | 6607 | ||
| 6608 | /* Check if an event is already in the queue. If it is, avoid | ||
| 6609 | syncing. */ | ||
| 6610 | if (XCheckIfEvent (dpy, event_return, predicate, arg)) | ||
| 6611 | return 0; | ||
| 6612 | |||
| 6608 | while (true) | 6613 | while (true) |
| 6609 | { | 6614 | { |
| 6610 | /* Get events into the queue. */ | 6615 | /* Get events into the queue. */ |
| 6611 | XSync (dpy, False); | 6616 | XSync (dpy, False); |
| 6612 | 6617 | ||
| 6613 | /* Check if an event is now in the queue. */ | 6618 | /* Look for an event again. */ |
| 6614 | if (XCheckIfEvent (dpy, event_return, predicate, arg)) | 6619 | if (XCheckIfEvent (dpy, event_return, predicate, arg)) |
| 6615 | return 0; | 6620 | return 0; |
| 6616 | 6621 | ||