aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/views/unix
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-01-02 22:21:47 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-01-02 22:21:47 +0000
commit04018f37af9d1b231111dc557fa281689b8a4616 (patch)
tree8016588cc36fd8e39b0eb6d0e7f3c2692990df20 /src/views/unix
parent07adb6359fd137ccb633b2c64ee2287c8edfd701 (diff)
An SkOSWindow for Unix may experience stuttering, with missed events or long delays before events are processed when using SkEvent.postDelay().
The issue is with the use of a select loop to watch for events coming into the x11 file descriptor for the display. It turns out there may be XEvents queued in memory but not yet processed that need to be handled before entering the select loop. See: http://developerweb.net/viewtopic.php?id=3184 BUG=1960 R=reed@google.com Author: jcgregorio@google.com Review URL: https://codereview.chromium.org/123303004 git-svn-id: http://skia.googlecode.com/svn/trunk@12874 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/views/unix')
-rw-r--r--src/views/unix/SkOSWindow_Unix.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/views/unix/SkOSWindow_Unix.cpp b/src/views/unix/SkOSWindow_Unix.cpp
index 374dbccc34..078a9f9d56 100644
--- a/src/views/unix/SkOSWindow_Unix.cpp
+++ b/src/views/unix/SkOSWindow_Unix.cpp
@@ -172,6 +172,13 @@ static unsigned getModi(const XEvent& evt) {
static SkMSec gTimerDelay;
static bool MyXNextEventWithDelay(Display* dsp, XEvent* evt) {
+ // Check for pending events before entering the select loop. There might
+ // be events in the in-memory queue but not processed yet.
+ if (XPending(dsp)) {
+ XNextEvent(dsp, evt);
+ return true;
+ }
+
SkMSec ms = gTimerDelay;
if (ms > 0) {
int x11_fd = ConnectionNumber(dsp);