Commit 06af02b5 authored by runge's avatar runge

x11vnc: check all XKeysymToString() return values.

parent 93ca945a
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:
......
......@@ -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;
......
......@@ -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,
......
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment