} else { new[0] = keysym;
int add_keysym(KeySym keysym) {	int minkey, maxkey, syms_per_keycode;	int kc, n, ret = 0;	static int first = 1;	KeySym *keymap;	if (first) {		for (n=0; n < 0x100; n++) {			added_keysyms[n] = NoSymbol;		}		first = 0;	}	if (keysym == NoSymbol) {		return 0;	}	XDisplayKeycodes(dpy, &minkey, &maxkey);	keymap = XGetKeyboardMapping(dpy, minkey, (maxkey - minkey + 1),	    &syms_per_keycode);	for (kc = minkey+1; kc <= maxkey; kc++) {		int i, is_empty = 1;		char *str;		KeySym new[8];		for (n=0; n < syms_per_keycode; n++) {			if (keymap[ (kc-minkey) * syms_per_keycode + n]			    != NoSymbol) {				is_empty = 0;				break;			}		}		if (! is_empty) {			continue;		}		for (i=0; i<8; i++) {			new[i] = NoSymbol;		}		if (add_keysyms == 2) {			for(i=0; i < syms_per_keycode; i++) {				new[i] = keysym;				if (i >= 7) break;			}		} else {			new[0] = keysym;					}		XChangeKeyboardMapping(dpy, kc, syms_per_keycode,		    new, 1);		str = XKeysymToString(keysym);		rfbLog("added missing keysym to X display: %03d 0x%x \"%s\"\n",		    kc, keysym, str ? str : "null");		XFlush(dpy);		added_keysyms[kc] = keysym;		ret = kc;		break;	}	XFree(keymap);	return ret;}