197 |
|
// From sys_unix.cpp |
198 |
|
extern void SysMountFirstFloppy(void); |
199 |
|
|
200 |
+ |
// From clip_unix.cpp |
201 |
+ |
extern void ClipboardSelectionClear(XSelectionClearEvent *); |
202 |
+ |
extern void ClipboardSelectionRequest(XSelectionRequestEvent *); |
203 |
+ |
|
204 |
|
|
205 |
|
/* |
206 |
|
* monitor_desc subclass for X11 display |
2047 |
|
|
2048 |
|
static void handle_events(void) |
2049 |
|
{ |
2050 |
< |
while (XPending(x_display)) { |
2050 |
> |
for (;;) { |
2051 |
|
XEvent event; |
2052 |
< |
XNextEvent(x_display, &event); |
2052 |
> |
XDisplayLock(); |
2053 |
> |
|
2054 |
> |
if (!XCheckMaskEvent(x_display, eventmask, &event)) { |
2055 |
> |
// Handle clipboard events |
2056 |
> |
if (XCheckTypedEvent(x_display, SelectionRequest, &event)) |
2057 |
> |
ClipboardSelectionRequest(&event.xselectionrequest); |
2058 |
> |
else if (XCheckTypedEvent(x_display, SelectionClear, &event)) |
2059 |
> |
ClipboardSelectionClear(&event.xselectionclear); |
2060 |
|
|
2061 |
+ |
// Window "close" widget clicked |
2062 |
+ |
else if (XCheckTypedEvent(x_display, ClientMessage, &event)) { |
2063 |
+ |
if (event.xclient.format == 32 && event.xclient.data.l[0] == WM_DELETE_WINDOW) { |
2064 |
+ |
ADBKeyDown(0x7f); // Power key |
2065 |
+ |
ADBKeyUp(0x7f); |
2066 |
+ |
} |
2067 |
+ |
} |
2068 |
+ |
XDisplayUnlock(); |
2069 |
+ |
break; |
2070 |
+ |
} |
2071 |
+ |
|
2072 |
|
switch (event.type) { |
2073 |
|
|
2074 |
|
// Mouse button |
2176 |
|
memset(the_buffer_copy, 0, mode.bytes_per_row * mode.y); |
2177 |
|
} |
2178 |
|
break; |
2157 |
– |
|
2158 |
– |
// Window "close" widget clicked |
2159 |
– |
case ClientMessage: |
2160 |
– |
if (event.xclient.format == 32 && event.xclient.data.l[0] == WM_DELETE_WINDOW) { |
2161 |
– |
ADBKeyDown(0x7f); // Power key |
2162 |
– |
ADBKeyUp(0x7f); |
2163 |
– |
} |
2164 |
– |
break; |
2179 |
|
} |
2180 |
+ |
|
2181 |
+ |
XDisplayUnlock(); |
2182 |
|
} |
2183 |
|
} |
2184 |
|
|
2223 |
|
} |
2224 |
|
} |
2225 |
|
|
2226 |
+ |
XDisplayLock(); |
2227 |
|
if ((nr_boxes <= max_box) && (nr_boxes)) { |
2228 |
|
for (y1=0; y1<16; y1++) { |
2229 |
|
for (x1=0; x1<16; x1++) { |
2277 |
|
} |
2278 |
|
nr_boxes = 0; |
2279 |
|
} |
2280 |
+ |
XDisplayUnlock(); |
2281 |
|
} |
2282 |
|
|
2283 |
|
// Static display update (fixed frame rate, but incremental) |
2387 |
|
} |
2388 |
|
|
2389 |
|
// Refresh display |
2390 |
+ |
XDisplayLock(); |
2391 |
|
if (high && wide) { |
2392 |
|
if (drv->have_shm) |
2393 |
|
XShmPutImage(x_display, drv->w, drv->gc, drv->img, x1, y1, x1, y1, wide, high, 0); |
2394 |
|
else |
2395 |
|
XPutImage(x_display, drv->w, drv->gc, drv->img, x1, y1, x1, y1, wide, high); |
2396 |
|
} |
2397 |
+ |
XDisplayUnlock(); |
2398 |
|
} |
2399 |
|
|
2400 |
|
|
2436 |
|
|
2437 |
|
if (x_palette_changed) { |
2438 |
|
x_palette_changed = false; |
2439 |
+ |
XDisplayLock(); |
2440 |
|
drv->update_palette(); |
2441 |
+ |
XDisplayUnlock(); |
2442 |
|
} |
2443 |
|
|
2444 |
|
UNLOCK_PALETTE; |