summaryrefslogtreecommitdiffstats
path: root/x11vnc/selection.c
diff options
context:
space:
mode:
authorrunge <runge>2009-01-10 23:03:24 +0000
committerrunge <runge>2009-01-10 23:03:24 +0000
commit198382dcf3c9b86919b7b69b9cedff7a162ba9cf (patch)
treea06b4a4d410e28439da2b63b4848bc142f918292 /x11vnc/selection.c
parent91174efbb8e2fb09520477af6593f99b865777b0 (diff)
downloadlibtdevnc-198382dcf3c9b86919b7b69b9cedff7a162ba9cf.tar.gz
libtdevnc-198382dcf3c9b86919b7b69b9cedff7a162ba9cf.zip
x11vnc: fix failure of -8to24 on default depth 24 due to
nonstandard indexed color support changes. Fix small window for failure after XSendEvent selection call; add env var. X11VNC_SENDEVENT_SYNC=1 to take even more care.
Diffstat (limited to 'x11vnc/selection.c')
-rw-r--r--x11vnc/selection.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/x11vnc/selection.c b/x11vnc/selection.c
index ae0075e..621a492 100644
--- a/x11vnc/selection.c
+++ b/x11vnc/selection.c
@@ -63,6 +63,7 @@ void selection_request(XEvent *ev, char *type) {
unsigned int length;
unsigned char *data;
static Atom xa_targets = None;
+ static int sync_it = -1;
# ifndef XA_LENGTH
unsigned long XA_LENGTH;
# endif
@@ -72,6 +73,14 @@ void selection_request(XEvent *ev, char *type) {
XA_LENGTH = XInternAtom(dpy, "LENGTH", True);
# endif
+ if (sync_it < 0) {
+ if (getenv("X11VNC_SENDEVENT_SYNC")) {
+ sync_it = 1;
+ } else {
+ sync_it = 0;
+ }
+ }
+
req_event = &(ev->xselectionrequest);
notify_event.type = SelectionNotify;
notify_event.display = req_event->display;
@@ -170,10 +179,16 @@ void selection_request(XEvent *ev, char *type) {
rfbLog("selection_request: ignored XError while sending "
"%s selection to 0x%x.\n", type, req_event->requestor);
}
+
+ XFlush_wr(dpy);
+ if (sync_it) {
+ usleep(5 * 1000);
+ XSync(dpy, False);
+ }
+
XSetErrorHandler(old_handler);
trapped_xerror = 0;
- XFlush_wr(dpy);
#endif /* NO_X11 */
}