On second thoughts, this patch appears to be problematic for other situations, so we'll have to find another way.
The problem is that certain key combinations, such as META+L on Mac OS X, have a non-zero Unicode value (in fact, it has the Unicode of "L" ). Treating these as normal key presses in the console would break them as hot keys.
So we want the console to handle some key presses that have modifiers, but not all of them. Would it be an option to look at which modifier is present? For example key presses with META or ALT as a modifier would not be handled by the console, but key presses with SHIFT or MODE would be.
jr, do you know how other SDL apps turn of that compositing stuff?
To be able to fix stuff more easily, I made packages of today's openMSX trunk code. jr, can you test if they work as well? And if there's something different, please let me know.
http://openmsx.sf.net/temp/openmsx-data_0.8.0.svn20100206-1maemo1_all.deb
http://openmsx.sf.net/temp/openmsx_0.8.0.svn20100206-1maemo1_armel.deb
I can't see any difference in keyboard functionality. I'll try to setup the development environment in a virtual machine, anything specific I should consider? I'm not very familiar with the debian tool chain but I guess I can skip the packaging parts and play with the naked openmsx binary only.
I'll also try to see if I can get some sensible key mapping done but as the N900 has different key maps on different countries I doubt it will be very useful for non-finnish keyboard layouts
I don't know how many apps in general are actually disabling display composition. A quick google for _HILDON_NON_COMPOSITED_WINDOW reveals that for example the N900 port of scummvm (I hope you know the project) is using it and that is also using SDL. Here's a copy&paste from the scummvm's graphics.cpp:
#include "SDL_syswm.h" static void maemo5_WM_init(int fullscreen){ //static int fsdone=0; //static int wmdone=0; SDL_SysWMinfo info; SDL_VERSION(&info.version); if ( SDL_GetWMInfo(&info) ) { Display *dpy = info.info.x11.display; Window win; unsigned long val = 1; Atom atom_zoom = XInternAtom(dpy, "_HILDON_ZOOM_KEY_ATOM", 0); info.info.x11.lock_func(); win = info.info.x11.fswindow; if (win && fullscreen /* && !fsdone */ ) { XUnmapWindow(dpy,win); Atom atom_noncomposited = XInternAtom(dpy, "_HILDON_NON_COMPOSITED_WINDOW", 0); Atom atom_wmstate = XInternAtom(dpy, "_NET_WM_STATE", 0); Atom atom_wmstate_fullscreen = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", 0); XSetWindowAttributes xattr; xattr.override_redirect = False; XChangeProperty (dpy,win,atom_zoom,XA_INTEGER,32,PropModeReplace,(unsigned char *) &val,1); // grab zoom keys XChangeProperty (dpy,win,atom_noncomposited,XA_INTEGER,32,PropModeReplace,(unsigned char *) &val,1); // make window not composited //XChangeWindowAttributes(dpy, win, CWOverrideRedirect, &xattr); // XChangeProperty (dpy,win,atom_wmstate,XA_ATOM,32,PropModeReplace,(unsigned char *) &atom_wmstate_fullscreen,1); // mark as fullscreen = disable tskswitch button XMapWindow(dpy,win); //fsdone=1; } win = info.info.x11.wmwindow; if (win && !fullscreen /* && !wmdone */) { XUnmapWindow(dpy,win); XChangeProperty (dpy,win,atom_zoom,XA_INTEGER,32,PropModeReplace,(unsigned char *) &val,1); XMapWindow(dpy,win); //wmdone=1; } info.info.x11.unlock_func(); // XSync(dpy,False); } }
I downloaded the virtual machine image and dropped openmsx inside it. However:
[sbox-FREMANTLE_ARMEL: ~/openmsx] > ./configure
File "build/detectsys.py", line 24
return 'ppc64' if cpu.endswith('64') else 'ppc'
^
SyntaxError: invalid syntax
build/main.mk:118: *** No platform specified using OPENMSX_TARGET_CPU and OPENMSX_TARGET_OS and autodetection of local platform failed. Stop.
[sbox-FREMANTLE_ARMEL: ~/openmsx] >
**edit** nevermind, I noticed it was trying to use wrong python version
Yep, indeed, you need to let it use python2.5.
Those 0.8.0 packages didn't have any changed functionality for keyboard stuff or whatever, I was merely rebasing our efforts on the latest code, so that we can more easily solve the problems.
We still need to find a good way to handle that MODE key.
Thanks for looking up that code for ScummVM (of course I know the project ;-), it definitely sounds interesting.
While you're at it, I'll first try to help you to get your environment OK. Please join us on IRC so we can help you directly. I'll keep monitoring this thread as well, of course.
Got it working. Dunno if it has any unwanted side effects, but I simply added "case Keys::KM_MODE:" line above "case 0:" statement in the CommandConsole.cc handleEvent() function. That makes the mode shifted keys work as expected in the console.
Another thing was that the MODE key was mapped as a regular key in Keys.cc which made it impossible to bind mode shifted keys, instead an "Invalid keycode" error would be generated. I changed the line { "MODE", K_MODE }, in Keys.cc to { "RMODE", K_MODE }, and added a line later on after "META" modifier spec like {"MODE", KM_MODE},. With this I'm now able to enter bindings from the console and settings.xml for the mode shifted keys as well.
I haven't yet checked, but is it possible to add multiple keymatrixdown commands for a single key event? The issue I'm now facing is that I'm unable to enter the double quote (") in BASIC because it should come from MODE+N, however as on the MSX keyboard that would require pressing SHIFT and the corresponding key I was wondering how to do it...
**edit** and on the IRC, I'm unfortunately unable to get there during the day and on the evenings I'm usually otherwise preoccupied. Of course, email also works.
As an alternative to IRC and this forum, you could use the openmsx-devel mailinglist. See https://sourceforge.net/mailarchive/forum.php?forum_name=openmsx-devel
When you think you have found solutions (as you wrote), can you send a diff to that mailinglist, so we can look at it and possibly include it in the main tree?
Yes, you can bind any Tcl command or procedure to a key event and multiple single commands with semicolon separated (as is normal Tcl syntax). E.g.:
bind F6 "foo; bar"
According to the figures toggle_fps gives, it runs full frame rate (~60fps) most of the time with scale_factor 2 when running full screen and using blur 0, scanline 0, resampler fast. I also incorporated the display composition disabling and I think it gave some further speed up, for example during Aleste intro sequence without the composition patch the fps drops below 60 sometimes but with the fix it stays up better.
I'll post my finnish keymap settings here later. I'll also have a look at submitting a patch to the mailing list later when I get things pulled together.