|
![]() |
#1 |
PosChengband Maintainer
Join Date: Jan 2008
Posts: 702
![]() |
Scandinavian Keyboard Layouts
Well, I'm trying to debug a problem with regard to alternative keyboard layouts and Hengband. I'm not sure if this has been fixed in Angband or not.
Take a look at: http://freepages.genealogy.rootsweb....ers/index.html Especially the pictures at the bottom. To press the '@' key on the Icelandic layout, for example, one presses the right alt key and the Q key simultaneously. Windows generates the following messages in a normal app: Code:
WM_KEYDOWN : 0-17 1900545 //17 is 0x11 CONTROL WM_KEYDOWN : 0-18 557318145 //18 is 0x12 ALT WM_KEYDOWN : 0-81 537919489 //81 is 0x51 Q WM_CHAR : 0-64 537919489 //Bingo ... 64 is ASCII speak for '@' I'm just starting to debug this, and am in over my head. I'm wondering if this rings any bells with anybody. I need to get Angband (well, Hengband) to not think it likes that Ctl+Alt+Q on the WM_KEYDOWN so that Windows will oblige me with a WM_CHAR for the '@' key, which is correct for this keyboard layout. Any thoughts? Thanks in advance, --Chris |
![]() |
![]() |
![]() |
#2 |
PosChengband Maintainer
Join Date: Jan 2008
Posts: 702
![]() |
Vanilla code looks fine. Hengband has extra code, probably to support Japanese Keyboard layouts. Essentially, any time the Alt key is pressed, they send keys to the Angband Terminal. So while Vanilla has:
Code:
case WM_KEYDOWN: { bool mc = FALSE; bool ms = FALSE; bool ma = FALSE; /* Extract the modifiers */ if (GetKeyState(VK_CONTROL) & 0x8000) mc = TRUE; if (GetKeyState(VK_SHIFT) & 0x8000) ms = TRUE; if (GetKeyState(VK_MENU) & 0x8000) ma = TRUE; /* Handle "special" keys */ if (special_key[(byte)(wParam)]) { /* blah */ } } Code:
if (special_key[(byte)(wParam)] || (ma && !ignore_key[(byte)(wParam)]) ) I just added some conditional compilation and now my Icelandic layout seems to work just fine. Sorry for the premature bother. I did the whole "Hey, I'm stuck! Let me post on a forum hoping for a quick answer!" thing rather than just grunting it out. ![]() |
![]() |
![]() |
![]() |
#3 |
Prophet
Join Date: Dec 2009
Posts: 9,022
![]() |
No worries, now if someone else runs into this problem they can search and find your post with a solution.
![]() |
![]() |
![]() |
![]() |
#4 |
PosChengband Maintainer
Join Date: Jan 2008
Posts: 702
![]() |
Good Point. Here's a patch that should work on Hengband. To be truly useful, I should at least give that
![]() Code:
diff -r 4db84295fa31 src/main-win.c --- a/src/main-win.c Thu Nov 11 14:05:23 2010 -0700 +++ b/src/main-win.c Thu Nov 11 19:02:51 2010 -0700 @@ -4248,10 +4248,14 @@ if (GetKeyState(VK_SHIFT) & 0x8000) ms = TRUE; if (GetKeyState(VK_MENU) & 0x8000) ma = TRUE; + /* Handle "special" keys */ +#if defined JP Term_no_press = (ma) ? TRUE : FALSE; - - /* Handle "special" keys */ if (special_key[(byte)(wParam)] || (ma && !ignore_key[(byte)(wParam)]) ) +#else + Term_no_press = FALSE; + if (special_key[(byte)(wParam)]) +#endif { bool ext_key = (lParam & 0x1000000L) ? TRUE : FALSE; bool numpad = FALSE; |
![]() |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[All] Keyboard interface and keymaps | Remuz | Vanilla | 12 | April 17, 2008 23:24 |