Subject: Auto-repeat in X11R5 server? (arrow keys etc.)
To: None <port-pmax@NetBSD.ORG>
From: Steven Winikoff <smw@alcor.concordia.ca>
List: port-pmax
Date: 05/30/1997 17:31:17
Okay, I give up! This really ought to be a simple question, perhaps
even a FAQ, but I can't seem to find the answer myself. :-(
Here's the problem description:
- the platform:
a DECstation 2100 with an LK-201 keyboard, running the March 16th
snapshot, with the X server and clients from ftp.netbsd.org
(directory /pub/NetBSD/arch/pmax/ported-software); the system has a
colour frame buffer, so we're using the Xcfbpmax server
- the goal:
I'm trying to enable auto-repeat on all four arrow keys.
- what's wrong:
For some reason, nothing I do is able to influence the up and
down arrows...
Details:
- My first attempt was to use xset. The four arrow keys are reported
by xkeycaps as having the following keycodes:
left == 0xA7 == 167
right == 0xA8 == 168
down == 0xA9 == 169
up == 0xAA == 170
Thus, I tried
# xset r 167
# xset r 168
# xset r 169
# xset r 170
This accomplished nothing at all; in particular, none of the arrows
repeated.
The next step, after a bit of research, was to write a program which
calls XChangeKeyboardControl() directly. (I'll append the source in
case anyone cares. :-)
This managed to get the left and right arrows to repeat, but not the
up and down arrows.
I then expanded my program to attempt to enable auto-repeat on
*every* keycode from 0 to 4999 decimal. Overkill, I know, but by
then I was (more than) a bit frustrated... :-)
The result? Well, after running the expanded version, auto-repeat
was enabled on all keys on the keyboard *except* for the following:
- the up and down arrows(!)
- *all* of the top row function keys (ie F1 - F20)
- the "Find", "Insert Here", "Remove", "Select", "Previous
Screen" and "Next Screen" keys
The plea for help:
At this point I'm completely mystified. Why does the right thing
happen for some keys but not others?
For what it might be worth, by using XChangeKeyboardControl() to
turn auto-repeat off and back on again, I was able to prove that my
program really did affect the left and right arrows, but not the up
and down arrows... Help, please!
Thanks,
- Steven
P.S.
Here's the program I used to enable auto-repeat for all keycodes from
0 to 4999. It's basically drawn from the source for xset, but
specialized for this task:
8<---------------------------- cut here -------------------------->8
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
Display *dpy;
XKeyboardControl values;
int i;
/** connect to the server: **/
if ((dpy = XOpenDisplay("")) == NULL)
{
fprintf(stderr, "rep: can't connect to X display server\n");
perror("rep");
exit(-1);
}
/** we want auto-repeat *on*! **/
values.auto_repeat_mode = AutoRepeatModeOn;
/** enable each key: **/
for (i=0; i<5000; i++)
{
values.key = i;
XChangeKeyboardControl(dpy, KBAutoRepeatMode, &values);
}
/** exit: **/
XCloseDisplay(dpy);
exit(0);
} /* main() */
8<---------------------------- cut here -------------------------->8
________________________________________________________________________
Steven Winikoff | smw@ | "I don't want to run the
Sr. Systems Manager | alcor.concordia.ca | world; I merely want to own
Computing Services | | a substantial portion of the
Concordia University | (514) 848-7619 | preferred stock" - Alan Dean
Montreal, QC, Canada | (10:00-18:00 EST) | Foster, Cat-A-Lyst