| OLD | NEW | 
|---|
| 1 | 1 | 
| 2 /* | 2 /* | 
| 3  * Copyright 2011 Google Inc. | 3  * Copyright 2011 Google Inc. | 
| 4  * | 4  * | 
| 5  * Use of this source code is governed by a BSD-style license that can be | 5  * Use of this source code is governed by a BSD-style license that can be | 
| 6  * found in the LICENSE file. | 6  * found in the LICENSE file. | 
| 7  */ | 7  */ | 
| 8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> | 
| 9 #include <X11/Xatom.h> | 9 #include <X11/Xatom.h> | 
| 10 #include <X11/XKBlib.h> | 10 #include <X11/XKBlib.h> | 
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 165         if (evt.xkey.state & gModi[i].fXMask) { | 165         if (evt.xkey.state & gModi[i].fXMask) { | 
| 166             modi |= gModi[i].fSkMask; | 166             modi |= gModi[i].fSkMask; | 
| 167         } | 167         } | 
| 168     } | 168     } | 
| 169     return modi; | 169     return modi; | 
| 170 } | 170 } | 
| 171 | 171 | 
| 172 static SkMSec gTimerDelay; | 172 static SkMSec gTimerDelay; | 
| 173 | 173 | 
| 174 static bool MyXNextEventWithDelay(Display* dsp, XEvent* evt) { | 174 static bool MyXNextEventWithDelay(Display* dsp, XEvent* evt) { | 
|  | 175     // Check for pending events before entering the select loop. There might | 
|  | 176     // be events in the in-memory queue but not processed yet. | 
|  | 177     if (XPending(dsp)) { | 
|  | 178         XNextEvent(dsp, evt); | 
|  | 179         return true; | 
|  | 180     } | 
|  | 181 | 
| 175     SkMSec ms = gTimerDelay; | 182     SkMSec ms = gTimerDelay; | 
| 176     if (ms > 0) { | 183     if (ms > 0) { | 
| 177         int x11_fd = ConnectionNumber(dsp); | 184         int x11_fd = ConnectionNumber(dsp); | 
| 178         fd_set input_fds; | 185         fd_set input_fds; | 
| 179         FD_ZERO(&input_fds); | 186         FD_ZERO(&input_fds); | 
| 180         FD_SET(x11_fd, &input_fds); | 187         FD_SET(x11_fd, &input_fds); | 
| 181 | 188 | 
| 182         timeval tv; | 189         timeval tv; | 
| 183         tv.tv_sec = ms / 1000;              // seconds | 190         tv.tv_sec = ms / 1000;              // seconds | 
| 184         tv.tv_usec = (ms % 1000) * 1000;    // microseconds | 191         tv.tv_usec = (ms % 1000) * 1000;    // microseconds | 
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 414 | 421 | 
| 415 void SkEvent::SignalNonEmptyQueue() { | 422 void SkEvent::SignalNonEmptyQueue() { | 
| 416     // nothing to do, since we spin on our event-queue, polling for XPending | 423     // nothing to do, since we spin on our event-queue, polling for XPending | 
| 417 } | 424 } | 
| 418 | 425 | 
| 419 void SkEvent::SignalQueueTimer(SkMSec delay) { | 426 void SkEvent::SignalQueueTimer(SkMSec delay) { | 
| 420     // just need to record the delay time. We handle waking up for it in | 427     // just need to record the delay time. We handle waking up for it in | 
| 421     // MyXNextEventWithDelay() | 428     // MyXNextEventWithDelay() | 
| 422     gTimerDelay = delay; | 429     gTimerDelay = delay; | 
| 423 } | 430 } | 
| OLD | NEW | 
|---|