MAEMO: Fix zoom key capture on N900 (fixes bug#3443037)

This was semi-intentionally skipped in the intial port revival
because the focus was on N810 at the time.

This is mostly copied from the old 1.2.1 port and then cleaned up.
This commit is contained in:
Tarek Soliman 2011-11-29 14:01:20 -06:00
parent 29c0386f2c
commit fda6e1534b
2 changed files with 29 additions and 0 deletions

View file

@ -21,6 +21,8 @@
*/
#if defined(MAEMO)
#include "SDL_syswm.h"
#include "common/scummsys.h"
#include "backends/platform/maemo/maemo.h"
@ -31,4 +33,28 @@ MaemoSdlGraphicsManager::MaemoSdlGraphicsManager(SdlEventSource *sdlEventSource)
: SurfaceSdlGraphicsManager(sdlEventSource) {
}
bool MaemoSdlGraphicsManager::loadGFXMode() {
bool success = SurfaceSdlGraphicsManager::loadGFXMode();
// fix the problematic zoom key capture in Maemo5/N900
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)
XChangeProperty(dpy, win, atom_zoom, XA_INTEGER, 32, PropModeReplace, (unsigned char *) &val, 1); // grab zoom keys
win = info.info.x11.wmwindow;
if (win)
XChangeProperty(dpy, win, atom_zoom, XA_INTEGER, 32, PropModeReplace, (unsigned char *) &val, 1); // grab zoom keys
info.info.x11.unlock_func();
}
return success;
}
#endif

View file

@ -30,6 +30,9 @@
class MaemoSdlGraphicsManager : public SurfaceSdlGraphicsManager {
public:
MaemoSdlGraphicsManager(SdlEventSource *sdlEventSource);
protected:
virtual bool loadGFXMode();
};
#endif