Commit 58156740 authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

winex11: Use a table of available OEM virtual key codes.

Restore availability of vkeys prior to VK_OEM_8. That's safe now that OEM vkeys are assigned in a separate loop after standard OEM vkey assignments have been made.
parent f6a6712a
...@@ -1683,11 +1683,21 @@ void X11DRV_InitKeyboard( Display *display ) ...@@ -1683,11 +1683,21 @@ void X11DRV_InitKeyboard( Display *display )
KeySym keysym; KeySym keysym;
KeyCode *kcp; KeyCode *kcp;
XKeyEvent e2; XKeyEvent e2;
WORD scan, vkey, OEMvkey; WORD scan, vkey;
int keyc, i, keyn, syms; int keyc, i, keyn, syms;
char ckey[4]={0,0,0,0}; char ckey[4]={0,0,0,0};
const char (*lkey)[MAIN_LEN][4]; const char (*lkey)[MAIN_LEN][4];
char vkey_used[256] = { 0 }; char vkey_used[256] = { 0 };
static const struct {
WORD first, last;
} vkey_ranges[] = {
{ VK_OEM_1, VK_OEM_3 },
{ VK_OEM_4, VK_ICO_00 },
{ 0xe6, 0xe6 },
{ 0xe9, 0xf5 },
{ 0, 0 }
};
int vkey_range;
set_kbd_layout_preload_key(); set_kbd_layout_preload_key();
...@@ -1861,8 +1871,9 @@ void X11DRV_InitKeyboard( Display *display ) ...@@ -1861,8 +1871,9 @@ void X11DRV_InitKeyboard( Display *display )
} /* for */ } /* for */
/* Others keys: let's assign OEM virtual key codes in the allowed range, /* Others keys: let's assign OEM virtual key codes in the allowed range,
* that is ([0xba,0xc0], [0xdb,0xe4], 0xe6 (given up) et [0xe9,0xf5]) */ * that is ([0xba,0xc0], [0xdb,0xe4], 0xe6, and [0xe9,0xf5]) */
OEMvkey = VK_OEM_8; /* next is available. */ vkey_range = 0;
vkey = vkey_ranges[vkey_range].first;
for (keyc = min_keycode; keyc <= max_keycode; keyc++) for (keyc = min_keycode; keyc <= max_keycode; keyc++)
{ {
if (keyc2vkey[keyc] & 0xff) if (keyc2vkey[keyc] & 0xff)
...@@ -1873,22 +1884,27 @@ void X11DRV_InitKeyboard( Display *display ) ...@@ -1873,22 +1884,27 @@ void X11DRV_InitKeyboard( Display *display )
if (!keysym) if (!keysym)
continue; continue;
do while (vkey && vkey_used[vkey])
{ {
switch (++OEMvkey) if (vkey == vkey_ranges[vkey_range].last)
{ {
case 0xc1 : OEMvkey=0xdb; break; vkey_range++;
case 0xe5 : OEMvkey=0xe9; break; vkey = vkey_ranges[vkey_range].first;
case 0xf6 : OEMvkey=0xf5; WARN("No more OEM vkey available!\n"); }
else
vkey++;
} }
} while (OEMvkey < 0xf5 && vkey_used[OEMvkey]);
vkey = VKEY_IF_NOT_USED(OEMvkey); if (!vkey)
{
WARN("No more vkeys available!\n");
break;
}
if (TRACE_ON(keyboard)) if (TRACE_ON(keyboard))
{ {
TRACE("OEM specific virtual key %X assigned to keycode %X:\n", TRACE("OEM specific virtual key %X assigned to keycode %X:\n",
OEMvkey, e2.keycode); vkey, e2.keycode);
TRACE("("); TRACE("(");
for (i = 0; i < keysyms_per_keycode; i += 1) for (i = 0; i < keysyms_per_keycode; i += 1)
{ {
...@@ -1903,11 +1919,9 @@ void X11DRV_InitKeyboard( Display *display ) ...@@ -1903,11 +1919,9 @@ void X11DRV_InitKeyboard( Display *display )
TRACE(")\n"); TRACE(")\n");
} }
if (vkey)
{
TRACE("keycode %04x => vkey %04x\n", e2.keycode, vkey); TRACE("keycode %04x => vkey %04x\n", e2.keycode, vkey);
keyc2vkey[e2.keycode] = vkey; keyc2vkey[e2.keycode] = vkey;
} vkey_used[vkey] = 1;
} /* for */ } /* for */
#undef VKEY_IF_NOT_USED #undef VKEY_IF_NOT_USED
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment