That should fix bigfoot's shift.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3245 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2009-07-07 21:32:54 +00:00
parent 699104d667
commit 6147a2dcd3
2 changed files with 23 additions and 11 deletions

View File

@ -191,16 +191,19 @@ void GLD_EndDirectRect (int x, int y, int width, int height)
{
}
static int XLateKey(XKeyEvent *ev)
static int XLateKey(XKeyEvent *ev, unsigned int *unicode)
{
int key;
char buf[64];
KeySym keysym;
KeySym keysym, shifted;
key = 0;
XLookupString(ev, buf, sizeof buf, &keysym, 0);
keysym = XLookupKeysym(ev, 0);
XLookupString(ev, buf, sizeof buf, &shifted, 0);
if (unicode)
*unicode = buf[0];
switch(keysym)
{
@ -380,6 +383,7 @@ static void GetEvent(void)
{
XEvent event;
int b;
unsigned int uc;
qboolean wantwindowed;
qboolean x11violations = true;
@ -398,9 +402,12 @@ static void GetEvent(void)
glheight = event.xconfigurerequest.height;
break;
case KeyPress:
b = XLateKey(&event.xkey, &uc);
Key_Event(b, uc, true);
break;
case KeyRelease:
b = XLateKey(&event.xkey);
Key_Event(b, b, event.type == KeyPress);
b = XLateKey(&event.xkey, NULL);
Key_Event(b, 0, false);
break;
case MotionNotify:

View File

@ -891,16 +891,19 @@ void SWVID_Shutdown (void)
// vid_dpy = NULL;
}
int XLateKey(XKeyEvent *ev)
int XLateKey(XKeyEvent *ev, unsigned int *unicode)
{
int key;
char buf[64];
KeySym keysym;
KeySym keysym, shifted;
key = 0;
XLookupString(ev, buf, sizeof buf, &keysym, 0);
keysym = XLookupKeysym(ev, 0);
XLookupString(ev, buf, sizeof buf, &shifted, 0);
if (unicode)
*unicode = buf[0];
switch(keysym)
{
@ -1026,6 +1029,7 @@ struct
{
int key;
int down;
unsigned int unicode;
} keyq[64];
int keyq_head=0;
int keyq_tail=0;
@ -1043,12 +1047,13 @@ void GetEvent(void)
XNextEvent(vid_dpy, &x_event);
switch(x_event.type) {
case KeyPress:
keyq[keyq_head].key = XLateKey(&x_event.xkey);
keyq[keyq_head].key = XLateKey(&x_event.xkey, &keyq[keyq_head].unicode);
keyq[keyq_head].down = true;
keyq_head = (keyq_head + 1) & 63;
break;
case KeyRelease:
keyq[keyq_head].key = XLateKey(&x_event.xkey);
keyq[keyq_head].key = XLateKey(&x_event.xkey, NULL);
keyq[keyq_head].unicode = 0;
keyq[keyq_head].down = false;
keyq_head = (keyq_head + 1) & 63;
break;
@ -1269,7 +1274,7 @@ void Sys_SendKeyEvents(void)
while (XPending(vid_dpy)) GetEvent();
while (keyq_head != keyq_tail)
{
Key_Event(keyq[keyq_tail].key, keyq[keyq_tail].key, keyq[keyq_tail].down);
Key_Event(keyq[keyq_tail].key, keyq[keyq_tail].unicode, keyq[keyq_tail].down);
keyq_tail = (keyq_tail + 1) & 63;
}
}