![]() |
SDL apps do not accept Fn key combos on N810
My tested SDL apps do not accept Fn key combos on N810
This pretty much cripples dosbox and any game requiring numeric input. Have I overlooked something? If anyone has a clue how to fix, please post here. If/when I find a solution i'll do the same. Cheers. ------------------------ edit; incorrect. some sdl apps do accept fn key - gemrb works - when it accepts keyboard input at all. |
Re: SDL apps do not accept Fn key combos on N810
Did you ever figure out why some do and some do not?
One I am trying to port now needs the number keys and does not accept fn keys. If there is something simple I can do to make it work with the fn key I would rather that than say remap the responses from numbers to q w e r t y and try to remember that q = 1 and w = 2 and such... Thanks! -John |
Re: SDL apps do not accept Fn key combos on N810
You need to call SDL_EnableUNICODE(1) at runtime. Both keys (fn+key) need to be pressed though.
|
Re: SDL apps do not accept Fn key combos on N810
Quote:
Is there some example code I can peek though that uses this call to give me an idea where it should be put? My own thought was right here... Code:
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, Thanks again -John "Strugglin' through it just because it's fun" Tobias |
Re: SDL apps do not accept Fn key combos on N810
sorry for confusion, what i meant is that it is method call not some compile time value to #define. The gotcha is probably that you are reading keycodes from keysym.sym field, the translated value is in keysym.unicode field.
here is some random example Code:
#include <stdio.h> Press:- Scancode: 0x1C, Name: t keysym 0074 t , Unicode: 5 (0x0035) |
Re: SDL apps do not accept Fn key combos on N810
It is a bit confusing but it makes sense. SDL is too low level. Since you really press fn and t keys you always get keycodes for fn and t. The enable unicode part enables additional calls inside SDL to translate those raw keys according to current keyboard mapping. it is same like shift + a, you get keycodes for shift and a and this translates into upppercase A
|
Re: SDL apps do not accept Fn key combos on N810
That does make sense and in looking at the code it is:
Code:
switch (event.key.keysym.sym) { so, it isnt, of course, checking unicode. That means a bit more tweaking in order to get it working. Thanks for all the information you explained it perfectly. Course while testing this I also came to the conclusion that the mouse isnt working either. I mean, there is a pointer, and it moves to where you click, however it doesnt 'read' the click and do anything with it. I am going to leave that until I get everything else working because you CAN play the game completely without using the mouse if you remember all the shortcut keys (t = talk, a = attack etc.) So if I can get all the keys working then the mouse is far less important. (well except for N800 users..) but I will fix that eventually (well I hope I will, this crash course on SDL has been enlightening. to say the least.) Thanks again, -John |
Re: SDL apps do not accept Fn key combos on N810
Quote:
I can not thank you enough for your patient instruction and help. Thanks, -John |
Re: SDL apps do not accept Fn key combos on N810
fanoush,
I have this working pretty good, however I think I need to change something else. I think, while I am catching the fn+ keys properly, I am now loosing normal keys in some instances. is there a check I need to preform or a different way to identify normal keys (the arrow keys for example up, down left right) while using keysym.unicode instead of keysym.sym? When in the gui now (where I am actually using the unicode) I can use fn+ but I can not use the arrow keys to select a different toon for leader. While it isnt a huge deal, you can use the keyboard shortcut L for this, I would rather have it working correctly you know? Anyway I didnt change anything else, just added unicode on keysym. Thanks, -John |
Re: SDL apps do not accept Fn key combos on N810
you may try to fallback to use keysym.sym if keysym.unicode value is zero
|
Re: SDL apps do not accept Fn key combos on N810
Quote:
Code:
if (!event.key.keysym.unicode < 0x80 && !event.key.keysym.unicode > 0 ){ right after and if it wasnt a valid unicode code I diable unicode. Now you can select the leader using the arrow keys like you are supposed to be able to.. Thanks again, -John |
Re: SDL apps do not accept Fn key combos on N810
hmmm strange artifact now, if you press any directional arrow to move the toon more than about 3 steps without changing directions or letting off the key and pressing it again it suddenly sends you to the left and no matter what button you press you keep going left until you press left and release it.
I am going to remove the code I just added and see if it goes away. if not then I dont know what caused it. It wasnt doing it yesterday... -John Edit: Yes, this code is what is breaking it. so that isnt (obviously) the best way to handle it. It seems to break on the repeated keys. I have to study how repeated keys are handled in SDL and look for a better way to do this. Edit 2: if I simply do not increment lotr_keybufferpos by removing the ++ everything goes back to normal as if the entire line was not there. no leader select but you can walk without suddenly deciding you really meant to go left... Wonder what the keyboard buffer should be set to. I think it is 16 in the code.. |
Re: SDL apps do not accept Fn key combos on N810
Ignore the last few messages please. Thats what I get for trying to code in the middle of the night.
when I diffused the logic bomb that was my code and made it actually make sense it worked SO much better. It is now functioning properly and as it should have all along. -John |
All times are GMT. The time now is 15:18. |
vBulletin® Version 3.8.8