From fda6e1534bc1dfad7f1f32ccf0bb51f3eb34974d Mon Sep 17 00:00:00 2001 From: Tarek Soliman Date: Tue, 29 Nov 2011 14:01:20 -0600 Subject: [PATCH] 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. --- .../graphics/maemosdl/maemosdl-graphics.cpp | 26 +++++++++++++++++++ .../graphics/maemosdl/maemosdl-graphics.h | 3 +++ 2 files changed, 29 insertions(+) diff --git a/backends/graphics/maemosdl/maemosdl-graphics.cpp b/backends/graphics/maemosdl/maemosdl-graphics.cpp index 3309d91228b..527ef82b9d1 100644 --- a/backends/graphics/maemosdl/maemosdl-graphics.cpp +++ b/backends/graphics/maemosdl/maemosdl-graphics.cpp @@ -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 diff --git a/backends/graphics/maemosdl/maemosdl-graphics.h b/backends/graphics/maemosdl/maemosdl-graphics.h index 4a675b61597..81064d2d5fe 100644 --- a/backends/graphics/maemosdl/maemosdl-graphics.h +++ b/backends/graphics/maemosdl/maemosdl-graphics.h @@ -30,6 +30,9 @@ class MaemoSdlGraphicsManager : public SurfaceSdlGraphicsManager { public: MaemoSdlGraphicsManager(SdlEventSource *sdlEventSource); + +protected: + virtual bool loadGFXMode(); }; #endif