aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorTarek Soliman2011-07-19 23:56:16 -0500
committerTarek Soliman2011-09-22 22:07:45 -0500
commite04a8fdc3a0cf0c562242344717fc6b67903829d (patch)
tree915d2275768a1bf69751685eed90cc2200fe81d1 /backends
parent5bb506fcff258ec95753cc2001da0a14970961c3 (diff)
downloadscummvm-rg350-e04a8fdc3a0cf0c562242344717fc6b67903829d.tar.gz
scummvm-rg350-e04a8fdc3a0cf0c562242344717fc6b67903829d.tar.bz2
scummvm-rg350-e04a8fdc3a0cf0c562242344717fc6b67903829d.zip
MAEMO: fix task switcher window title
Diffstat (limited to 'backends')
-rw-r--r--backends/platform/maemo/maemo.cpp40
-rw-r--r--backends/platform/maemo/maemo.h6
2 files changed, 45 insertions, 1 deletions
diff --git a/backends/platform/maemo/maemo.cpp b/backends/platform/maemo/maemo.cpp
index 81a7ebb1b7..8362c0785e 100644
--- a/backends/platform/maemo/maemo.cpp
+++ b/backends/platform/maemo/maemo.cpp
@@ -28,6 +28,9 @@
#include "backends/events/maemosdl/maemosdl-events.h"
#include "common/textconsole.h"
+#include <SDL/SDL_syswm.h>
+#include <X11/Xutil.h>
+
OSystem_SDL_Maemo::OSystem_SDL_Maemo()
:
OSystem_POSIX() {
@@ -50,4 +53,41 @@ void OSystem_SDL_Maemo::fatalError() {
delete this;
}
+void OSystem_SDL_Maemo::setXWindowName(const char *caption) {
+ SDL_SysWMinfo info;
+ SDL_VERSION(&info.version);
+ if (SDL_GetWMInfo(&info)) {
+ Display *dpy = info.info.x11.display;
+ Window win;
+ win = info.info.x11.fswindow;
+ if (win) XStoreName(dpy, win, caption);
+ win = info.info.x11.wmwindow;
+ if (win) XStoreName(dpy, win, caption);
+ }
+}
+
+void OSystem_SDL_Maemo::setWindowCaption(const char *caption) {
+ Common::String cap;
+ byte c;
+
+ // The string caption is supposed to be in LATIN-1 encoding.
+ // SDL expects UTF-8. So we perform the conversion here.
+ while ((c = *(const byte *)caption++)) {
+ if (c < 0x80)
+ cap += c;
+ else {
+ cap += 0xC0 | (c >> 6);
+ cap += 0x80 | (c & 0x3F);
+ }
+ }
+
+ SDL_WM_SetCaption(cap.c_str(), cap.c_str());
+
+ Common::String cap2("ScummVM - "); // 2 lines in OS2008 task switcher, set first line
+ cap = cap2 + cap;
+ setXWindowName(cap.c_str());
+}
+
+
+
#endif
diff --git a/backends/platform/maemo/maemo.h b/backends/platform/maemo/maemo.h
index dd8ba325ab..a7f2ec35bb 100644
--- a/backends/platform/maemo/maemo.h
+++ b/backends/platform/maemo/maemo.h
@@ -34,8 +34,12 @@ public:
virtual void initBackend();
virtual void quit();
virtual void fatalError();
-};
+ virtual void setWindowCaption(const char *caption);
+
+private:
+ virtual void setXWindowName(const char *caption);
+};
#endif
#endif