From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Thu, 21 Jul 2005 22:25:11 +0400 From: Alexey Tourbin To: devel@altlinux.ru Message-ID: <20050721182511.GO24898@solemn.turbinal.org> Mail-Followup-To: devel@altlinux.ru References: <20050618163636.GF2751@solemn.turbinal.org> <20050618221026.GH2751@solemn.turbinal.org> <20050618225813.GI2751@solemn.turbinal.org> <20050713040654.GB10741@solemn.turbinal.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="By57YlnFViWR/M0S" Content-Disposition: inline In-Reply-To: <20050713040654.GB10741@solemn.turbinal.org> Subject: [devel] Xvfb keyboard X-BeenThere: devel@altlinux.ru X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ALT Devel discussion list List-Id: ALT Devel discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jul 2005 18:26:11 -0000 Archived-At: List-Archive: List-Post: --By57YlnFViWR/M0S Content-Type: multipart/mixed; boundary="movZSYdJ761vCHaE" Content-Disposition: inline --movZSYdJ761vCHaE Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 13, 2005 at 08:06:54AM +0400, Alexey Tourbin wrote: > > > =F0=CF=C4 Xvfb =CE=C5 =D2=C1=C2=CF=D4=C1=C5=D4 XKeysymToKeycode() -- = =D7=CF=DA=D7=D2=C1=DD=C1=C5=D4 0. > > > =FC=D4=CF =D7 =D0=D2=CF=C3=C5=D3=D3=C5 =DA=C1=D0=D2=CF=D3=C1 =CE=C1 = =CE=C1=D6=C1=D4=C9=C5 Alt (keysym=3D65513). [...] > =F0=D2=CF=C2=CC=C5=CD=C1 =D2=C5=DB=C9=CC=C1=D3=D8 =D4=C1=CB: >=20 > --- X11-GUITest-0.20/GUITest.xs- 2004-01-16 23:41:42 +0000 > +++ X11-GUITest-0.20/GUITest.xs 2005-07-13 01:35:14 +0000 > @@ -213,6 +213,15 @@ > return( GetKeySym(key, sym) ); > } > =20 > +/* Xvfb lacks XK_Alt_L; fall back to XK_Meta_L */ > +#define XKeysymToKeycode(display, sym) \ > +({ Display *d =3D (display); KeySym s =3D (sym); \ > + KeyCode kc =3D (XKeysymToKeycode)(d, s); \ > + if (kc =3D=3D 0 && s =3D=3D XK_Alt_L) \ > + kc =3D (XKeysymToKeycode)(d, XK_Meta_L); \ > + kc; \ > +}) > + > /* Function: PressKeyImp > * Description: Presses the key for the specified keysym. Lower-level > * implementation. =F0=CF =D0=CF=D7=CF=C4=D5 =CB=CC=C1=D7=C9=C1=D4=D5=D2=D9 =D5 Xvfb =CD=C5=CE= =D1 =CF=C4=CF=CC=C5=D7=C1=C5=D4 =CE=C5=C8=CF=D2=CF=DB=C5=C5 =D0=D2=C5=C4=DE= =D5=D7=D3=D4=D7=C9=C5: XK_Meta_L =CF=CE =D4=CF=D6=C5 =D0=CC=CF=C8=CF =D0=CF=CE=C9=CD=C1=C5=D4. = =F7=D3=A3 =DE=D5=C4=C5=D3=C1=D4=C5=C5 =C9 =DE=D5=C4=C5=D3=C1=D4=C5=C5. =F7=CF=D4 =D0=CF=CB=C1 =D0=D2=CF=C7=D2=C1=CD=CD=CB=C1, =CB=CF=D4=CF=D2=C1= =D1 =D7=D9=C4=C1=C5=D4 =CE=C1 stderr =CB=CC=C1=D7=C9=C1=D4=D5=D2=CE=D9=C5 = =D3=CF=C2=D9=D4=C9=D1. --movZSYdJ761vCHaE Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="xkev.c" // gcc -o xkev -Wall xkev.c -L/usr/X11R6/lib -lX11 #include #include #include #include int main(int argc, char **argv) { Display *d = XOpenDisplay(NULL); assert(d); int s = XDefaultScreen(d); Window w = XCreateSimpleWindow(d, XRootWindow(d, s), 0, 0, 320, 240, 0, XBlackPixel(d, s), XWhitePixel(d, s)); assert(w); XTextProperty title; XStringListToTextProperty(argv, 1, &title); XSetWMName(d, w, &title); XSetWMIconName(d, w, &title); XFree(title.value); XSelectInput(d, w, KeyPressMask | KeyReleaseMask); XMapWindow(d, w); while (1) { XEvent ev; XNextEvent(d, &ev); XKeyEvent *evp = &ev.xkey; assert(evp->type == KeyPress || evp->type == KeyRelease); char *what = (evp->type == KeyPress) ? "press" : "release"; unsigned int kc = evp->keycode; KeySym ks = XKeycodeToKeysym(d, kc, 0); char *str = XKeysymToString(ks); fprintf(stderr, "%s %s (kc=%u ks=%lu)\n", what, str, kc, ks); } return 0; } --movZSYdJ761vCHaE-- --By57YlnFViWR/M0S Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) iD8DBQFC3+iHfBKgtDjnu0YRAoY9AKDEyNDxevcJVhvfvWmuVlUZzgq+agCZATNg bLvOw8+m75UAbRSdjJkY1O4= =SRbA -----END PGP SIGNATURE----- --By57YlnFViWR/M0S--