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
This commit is contained in:
commit-bot@chromium.org 2014-01-02 22:21:47 +00:00
parent 07adb6359f
commit 04018f37af

View File

@ -172,6 +172,13 @@ static unsigned getModi(const XEvent& evt) {
static SkMSec gTimerDelay; static SkMSec gTimerDelay;
static bool MyXNextEventWithDelay(Display* dsp, XEvent* evt) { 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; SkMSec ms = gTimerDelay;
if (ms > 0) { if (ms > 0) {
int x11_fd = ConnectionNumber(dsp); int x11_fd = ConnectionNumber(dsp);