From 90d96b971f04b11fe1902091a94be94697738766 Mon Sep 17 00:00:00 2001 From: runge Date: Sat, 10 Feb 2007 21:52:26 +0000 Subject: x11vnc: watch textchat, etc in unixpw, implement kbdReleaseAllKeys, setSingleWindow, setServerInput. watch for OpenGL apps breaking XDAMAGE. --- x11vnc/x11vnc.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 2 deletions(-) (limited to 'x11vnc/x11vnc.c') diff --git a/x11vnc/x11vnc.c b/x11vnc/x11vnc.c index a45da20..ab44ef5 100644 --- a/x11vnc/x11vnc.c +++ b/x11vnc/x11vnc.c @@ -2345,7 +2345,7 @@ int main(int argc, char* argv[]) { } else if (!strcmp(arg, "-dpms")) { watch_dpms = 0; } else if (!strcmp(arg, "-xdamage")) { - use_xdamage = 1; + use_xdamage++; } else if (!strcmp(arg, "-noxdamage")) { use_xdamage = 0; } else if (!strcmp(arg, "-xd_area")) { @@ -3156,7 +3156,6 @@ int main(int argc, char* argv[]) { dpy = XOpenDisplay_wr(""); } - #ifdef MACOSX if (! dpy && ! raw_fb_str) { raw_fb_str = strdup("console"); @@ -3207,6 +3206,7 @@ int main(int argc, char* argv[]) { if (! quiet) rfbLog("Using default X display.\n"); } + scr = DefaultScreen(dpy); rootwin = RootWindow(dpy, scr); @@ -3646,6 +3646,68 @@ int main(int argc, char* argv[]) { if (macosx_console) { refresh_screen(1); } + if (dpy && xdmcp_insert != NULL) { +#if !NO_X11 + char c; + int n = strlen(xdmcp_insert); + KeyCode k, k2; + KeySym sym; + int i, ok = 1; + for (i = 0; i < n; i++) { + c = xdmcp_insert[i]; + sym = (KeySym) c; + if (sym < ' ' || sym > 0x7f) { + ok = 0; + break; + } + k = XKeysymToKeycode(dpy, sym); + if (k == NoSymbol) { + ok = 0; + break; + } + } + if (ok) { + XFlush_wr(dpy); + usleep(2*1000*1000); + if (!quiet) { + rfbLog("sending XDM '%s'\n", xdmcp_insert); + } + for (i = 0; i < n; i++) { + c = xdmcp_insert[i]; + sym = (KeySym) c; + k = XKeysymToKeycode(dpy, sym); + if (isupper(c)) { + k2 = XKeysymToKeycode(dpy, XK_Shift_L); + XTestFakeKeyEvent_wr(dpy, k2, True, CurrentTime); + XFlush_wr(dpy); + usleep(100*1000); + } + if (0) fprintf(stderr, "C/k %c/%x\n", c, k); + XTestFakeKeyEvent_wr(dpy, k, True, CurrentTime); + XFlush_wr(dpy); + usleep(100*1000); + XTestFakeKeyEvent_wr(dpy, k, False, CurrentTime); + XFlush_wr(dpy); + usleep(100*1000); + if (isupper(c)) { + k2 = XKeysymToKeycode(dpy, XK_Shift_L); + XTestFakeKeyEvent_wr(dpy, k2, False, CurrentTime); + XFlush_wr(dpy); + usleep(100*1000); + } + } + k2 = XKeysymToKeycode(dpy, XK_Tab); + XTestFakeKeyEvent_wr(dpy, k2, True, CurrentTime); + XFlush_wr(dpy); + usleep(100*1000); + XTestFakeKeyEvent_wr(dpy, k2, False, CurrentTime); + XFlush_wr(dpy); + usleep(100*1000); + } + free(xdmcp_insert); +#endif + } + } if (! waited_for_client) { -- cgit v1.2.1