76 |
private EventDispatchThread dispatchThread = new EventDispatchThread(this); |
private EventDispatchThread dispatchThread = new EventDispatchThread(this); |
77 |
private boolean shutdown = false; |
private boolean shutdown = false; |
78 |
|
|
79 |
|
private long lastNativeQueueAccess = 0; |
80 |
|
private long humanLatencyThreshold = 100; |
81 |
|
|
82 |
synchronized void setShutdown (boolean b) |
synchronized void setShutdown (boolean b) |
83 |
{ |
{ |
84 |
shutdown = b; |
shutdown = b; |
125 |
{ |
{ |
126 |
if (next != null) |
if (next != null) |
127 |
return next.getNextEvent(); |
return next.getNextEvent(); |
128 |
|
|
129 |
|
ClasspathToolkit tk = ((ClasspathToolkit) Toolkit.getDefaultToolkit()); |
130 |
|
long curr = System.currentTimeMillis(); |
131 |
|
|
132 |
|
if (! tk.nativeQueueEmpty() && |
133 |
|
(curr - lastNativeQueueAccess > humanLatencyThreshold)) |
134 |
|
{ |
135 |
|
tk.iterateNativeQueue(this, false); |
136 |
|
lastNativeQueueAccess = curr; |
137 |
|
} |
138 |
|
|
139 |
while (next_in == next_out) |
while (next_in == next_out) |
140 |
{ |
{ |
156 |
if (isShutdown()) |
if (isShutdown()) |
157 |
throw new InterruptedException(); |
throw new InterruptedException(); |
158 |
|
|
159 |
((ClasspathToolkit) Toolkit.getDefaultToolkit()).iterateNativeQueue(this); |
tk.iterateNativeQueue(this, true); |
160 |
|
lastNativeQueueAccess = System.currentTimeMillis(); |
161 |
} |
} |
162 |
else |
else |
163 |
{ |
{ |