From: Alexey Tourbin <at@altlinux.ru> To: devel@altlinux.ru Subject: [devel] Xvfb keyboard Date: Thu, 21 Jul 2005 22:25:11 +0400 Message-ID: <20050721182511.GO24898@solemn.turbinal.org> (raw) In-Reply-To: <20050713040654.GB10741@solemn.turbinal.org> [-- Attachment #1.1: Type: text/plain, Size: 1077 bytes --] On Wed, Jul 13, 2005 at 08:06:54AM +0400, Alexey Tourbin wrote: > > > Под Xvfb не работает XKeysymToKeycode() -- возвращает 0. > > > Это в процессе запроса на нажатие Alt (keysym=65513). [...] > Проблема решилась так: > > --- 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) ); > } > > +/* Xvfb lacks XK_Alt_L; fall back to XK_Meta_L */ > +#define XKeysymToKeycode(display, sym) \ > +({ Display *d = (display); KeySym s = (sym); \ > + KeyCode kc = (XKeysymToKeycode)(d, s); \ > + if (kc == 0 && s == XK_Alt_L) \ > + kc = (XKeysymToKeycode)(d, XK_Meta_L); \ > + kc; \ > +}) > + > /* Function: PressKeyImp > * Description: Presses the key for the specified keysym. Lower-level > * implementation. По поводу клавиатуры у Xvfb меня одолевает нехорошее предчувствие: XK_Meta_L он тоже плохо понимает. Всё чудесатее и чудесатее. Вот пока программка, которая выдает на stderr клавиатурные события. [-- Attachment #1.2: xkev.c --] [-- Type: text/plain, Size: 992 bytes --] // gcc -o xkev -Wall xkev.c -L/usr/X11R6/lib -lX11 #include <stdio.h> #include <assert.h> #include <X11/Xlib.h> #include <X11/Xutil.h> 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; } [-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2005-07-21 18:25 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2005-06-18 16:36 [devel] RFC: test-aboutdialog (GUI) Alexey Tourbin 2005-06-18 18:26 ` [devel] " Konstantin A. Lepikhov 2005-06-18 19:02 ` Alexey Tourbin 2005-06-18 21:09 ` Konstantin A. Lepikhov 2005-06-18 22:10 ` Alexey Tourbin 2005-06-18 22:58 ` Alexey Tourbin 2005-07-13 4:06 ` Alexey Tourbin 2005-07-21 18:25 ` Alexey Tourbin [this message] 2005-06-20 7:25 ` [devel] " Sviataslau Svirydau 2005-06-20 12:14 ` [devel] " Alexey Tourbin
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20050721182511.GO24898@solemn.turbinal.org \ --to=at@altlinux.ru \ --cc=devel@altlinux.ru \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
ALT Linux Team development discussions This inbox may be cloned and mirrored by anyone: git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \ devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru public-inbox-index devel Example config snippet for mirrors. Newsgroup available over NNTP: nntp://lore.altlinux.org/org.altlinux.lists.devel AGPL code for this site: git clone https://public-inbox.org/public-inbox.git