diff options
| -rw-r--r-- | x11vnc/README | 2 | ||||
| -rw-r--r-- | x11vnc/keyboard.c | 35 | ||||
| -rw-r--r-- | x11vnc/pointer.c | 12 | ||||
| -rw-r--r-- | x11vnc/xwrappers.c | 8 | 
4 files changed, 36 insertions, 21 deletions
| diff --git a/x11vnc/README b/x11vnc/README index aebfc9e..2ee9df6 100644 --- a/x11vnc/README +++ b/x11vnc/README @@ -1,5 +1,5 @@ -x11vnc README file                         Date: Tue Jul  4 18:26:52 EDT 2006 +x11vnc README file                         Date: Tue Jul  4 19:28:31 EDT 2006  The following information is taken from these URLs: diff --git a/x11vnc/keyboard.c b/x11vnc/keyboard.c index a8760d1..be9b30c 100644 --- a/x11vnc/keyboard.c +++ b/x11vnc/keyboard.c @@ -104,6 +104,7 @@ void clear_modifiers(int init) {  		for (i = minkey; i <= maxkey; i++) {  		    for (j = 0; j < syms_per_keycode; j++) { +			char *str;  			keysym = keymap[ (i - minkey) * syms_per_keycode + j ];  			if (keysym == NoSymbol || ! ismodkey(keysym)) {  				continue; @@ -114,7 +115,9 @@ void clear_modifiers(int init) {  			}  			keycodes[kcount] = keycode;  			keysyms[kcount]  = keysym; -			keystrs[kcount]  = strdup(XKeysymToString(keysym)); +			str = XKeysymToString(keysym); +			if (! str) str = "null"; +			keystrs[kcount]  = strdup(str);  			kcount++;  		    }  		} @@ -920,7 +923,7 @@ void switch_to_xkb_if_better(void) {  					char *str = XKeysymToString(keysym);  					fprintf(stderr, "- high keysym mapping"  					    ": at %3d j=%d " -					    "'%s'\n", i, j, str ? str:"null"); +					    "'%s'\n", i, j, str ? str : "null");  				}  			    }  			    continue; @@ -929,7 +932,7 @@ void switch_to_xkb_if_better(void) {  				if (debug_keyboard > 1) {  					char *str = XKeysymToString(must);  					fprintf(stderr, "- at %3d j=%d found " -					    "'%s'\n", i, j, str ? str:"null"); +					    "'%s'\n", i, j, str ? str : "null");  				}  				/* n.b. do not break, see syms_gt_4 above. */  				gotit = 1; @@ -1348,14 +1351,16 @@ xkbmodifiers[]    For the KeySym bound to this (keycode,group,level) store  			}  			if (debug_keyboard > 1) { +				char *str;  				fprintf(stderr, "  %03d  G%d L%d  mod=%s ",  				    kc, grp+1, lvl+1, bitprint(ms, 8));  				fprintf(stderr, "state=%s ",  				    bitprint(xkbstate[kc][grp][lvl], 8));  				fprintf(stderr, "ignore=%s ",  				    bitprint(xkbignore[kc][grp][lvl], 8)); +				str = XKeysymToString(ks);  				fprintf(stderr, " ks=0x%08lx \"%s\"\n", -				    ks, XKeysymToString(ks)); +				    ks, str ? str : "null");  			}  		}  	    } @@ -1480,11 +1485,15 @@ static void xkb_tweak_keyboard(rfbBool down, rfbKeySym keysym,  			state = xkbstate[kc][grp][lvl];  			if (debug_keyboard > 1) { +				char *s1, *s2; +				s1 = XKeysymToString(XKeycodeToKeysym(dpy, +				    kc, 0)); +				if (! s1) s1 = "null"; +				s2 = XKeysymToString(keysym); +				if (! s2) s2 = "null";  				fprintf(stderr, "  got match kc=%03d=0x%02x G%d"  				    " L%d  ks=0x%x \"%s\"  (basesym: \"%s\")\n", -				    kc, kc, grp+1, lvl+1, keysym, -				    XKeysymToString(keysym), XKeysymToString( -				    XKeycodeToKeysym(dpy, kc, 0))); +				    kc, kc, grp+1, lvl+1, keysym, s2, s1);  				fprintf(stderr, "    need state: %s\n",  				    bitprint(state, 8));  				fprintf(stderr, "    ignorable : %s\n", @@ -2383,8 +2392,9 @@ static void modifier_tweak_keyboard(rfbBool down, rfbKeySym keysym,  	}  	if (debug_keyboard) { +		char *str = XKeysymToString(keysym);  		rfbLog("modifier_tweak_keyboard: KeySym 0x%x \"%s\" -> " -		    "KeyCode 0x%x%s\n", (int) keysym, XKeysymToString(keysym), +		    "KeyCode 0x%x%s\n", (int) keysym, str ? str : "null",  		    (int) k, k ? "" : " *ignored*");  	}  	if ( k != NoSymbol ) { @@ -2501,7 +2511,7 @@ static void pipe_keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client) {  	X_UNLOCK;  	fprintf(pipeinput_fh, "Keysym %d %d %u %s %s\n", uid, down, -	    keysym, name, down ? "KeyPress" : "KeyRelease"); +	    keysym, name ? name : "null", down ? "KeyPress" : "KeyRelease");  	fflush(pipeinput_fh);  	check_pipeinput(); @@ -2851,13 +2861,16 @@ void keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client) {  				isbutton = remap->isbutton;  				if (debug_keyboard) {  					X_LOCK; +					char *str1, *str2; +					str1 = XKeysymToString(remap->before); +					str2 = XKeysymToString(remap->after);  					rfbLog("keyboard(): remapping keysym: "  					    "0x%x \"%s\" -> 0x%x \"%s\"\n",  					    (int) remap->before, -					    XKeysymToString(remap->before), +					    str1 ? str1 : "null",  					    (int) remap->after,  					    remap->isbutton ? "button" : -					    XKeysymToString(remap->after)); +					    str2 ? str2 : "null");  					X_UNLOCK;  				}  				break; diff --git a/x11vnc/pointer.c b/x11vnc/pointer.c index 0b7cece..a5896cb 100644 --- a/x11vnc/pointer.c +++ b/x11vnc/pointer.c @@ -121,6 +121,7 @@ static void buttonparse(int from, char **s) {  				/*  				 * XXX may not work with -modtweak or -xkb  				 */ +				char *str;  				X_LOCK;  				kcode = XKeysymToKeycode(dpy, ksym); @@ -143,9 +144,10 @@ static void buttonparse(int from, char **s) {  						modisdown[kcode] = 1;  					}  				} +				str = XKeysymToString(ksym);  				rfbLog("   event %d: keysym %s (0x%x) -> "  				    "keycode 0x%x down=%d up=%d\n", n+1, -				    XKeysymToString(ksym), ksym, kcode, +				    str ? str : "null", ksym, kcode,  				    pointer_map[from][n].down,  				    pointer_map[from][n].up);  				X_UNLOCK; @@ -364,13 +366,13 @@ void do_button_mask_change(int mask, int button) {  				continue;   			}  			if (debug_pointer && dpy) { +				char *str = XKeysymToString(XKeycodeToKeysym( +                                    dpy, key, 0));  				rfbLog("pointer(): sending button %d "  				    "down as keycode 0x%x (event %d)\n",  				    i+1, key, k+1); -				rfbLog("           down=%d up=%d " -				    "keysym: %s\n", down, up, -				    XKeysymToString(XKeycodeToKeysym( -				    dpy, key, 0))); +				rfbLog("           down=%d up=%d keysym: " +				    "%s\n", down, up, str ? str : "null");  			}  			if (down) {  				XTestFakeKeyEvent_wr(dpy, key, True, diff --git a/x11vnc/xwrappers.c b/x11vnc/xwrappers.c index b70d205..63e231f 100644 --- a/x11vnc/xwrappers.c +++ b/x11vnc/xwrappers.c @@ -547,9 +547,9 @@ static void upup_downdown_warning(KeyCode key, Bool down) {  	RAWFB_RET_VOID  	if ((down ? 1:0) == keycode_state[(int) key]) { +		char *str = XKeysymToString(XKeycodeToKeysym(dpy, key, 0));  		rfbLog("XTestFakeKeyEvent: keycode=0x%x \"%s\" is *already* " -		    "%s\n", key, XKeysymToString(XKeycodeToKeysym(dpy, key, 0)), -		    down ? "down":"up"); +		    "%s\n", key, str ? str : "null", down ? "down":"up");  	}  } @@ -589,9 +589,9 @@ void XTestFakeKeyEvent_wr(Display* dpy, KeyCode key, Bool down,  	RAWFB_RET_VOID  	if (debug_keyboard) { +		char *str = XKeysymToString(XKeycodeToKeysym(dpy, key, 0));  		rfbLog("XTestFakeKeyEvent(dpy, keycode=0x%x \"%s\", %s)\n", -		    key, XKeysymToString(XKeycodeToKeysym(dpy, key, 0)), -		    down ? "down":"up"); +		    key, str ? str : "null", down ? "down":"up");  	}  	if (first) {   		init_track_keycode_state(); | 
