[Scummvm-cvs-logs] SF.net SVN: scummvm:[41932] scummvm/trunk
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Sun Jun 28 21:58:11 CEST 2009
Revision: 41932
http://scummvm.svn.sourceforge.net/scummvm/?rev=41932&view=rev
Author: fingolfin
Date: 2009-06-28 19:58:11 +0000 (Sun, 28 Jun 2009)
Log Message:
-----------
Changed OSystem::setWindowCaption to expect ISO LATIN 1 encoded input;
also intentionally broke WinCE and Symbian ports (in an obvious way that
can be undo by commenting out some text) -- hopefully this will get the
maintainers' attention during the next release cycle, unlike my emails
Modified Paths:
--------------
scummvm/trunk/backends/platform/PalmOS/Src/be_os5.cpp
scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp
scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.h
scummvm/trunk/backends/platform/iphone/osys_iphone.cpp
scummvm/trunk/backends/platform/iphone/osys_iphone.h
scummvm/trunk/backends/platform/null/null.cpp
scummvm/trunk/backends/platform/psp/osys_psp.cpp
scummvm/trunk/backends/platform/psp/osys_psp.h
scummvm/trunk/backends/platform/sdl/sdl.cpp
scummvm/trunk/backends/platform/symbian/src/SymbianOS.cpp
scummvm/trunk/backends/platform/wince/wince-sdl.cpp
scummvm/trunk/common/system.h
Modified: scummvm/trunk/backends/platform/PalmOS/Src/be_os5.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/be_os5.cpp 2009-06-28 19:57:27 UTC (rev 41931)
+++ scummvm/trunk/backends/platform/PalmOS/Src/be_os5.cpp 2009-06-28 19:58:11 UTC (rev 41932)
@@ -115,6 +115,10 @@
}
void OSystem_PalmOS5::setWindowCaption(const char *caption) {
+FIXME/TODO: Convert caption from ISO Latin 1 to "right" encoding ?
+If the output encoding is unclear or conversion impossible,
+then one could just skip over any chars > 0x7F and display the rest
+
Err e;
Char buf[64];
Coord w, y, h = FntLineHeight() + 2;
Modified: scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp 2009-06-28 19:57:27 UTC (rev 41931)
+++ scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp 2009-06-28 19:58:11 UTC (rev 41932)
@@ -642,12 +642,6 @@
swiSoftReset();*/
}
-void OSystem_DS::setWindowCaption(const char *caption) {
-}
-
-void OSystem_DS::displayMessageOnOSD(const char *msg) {
-}
-
Common::SaveFileManager* OSystem_DS::getSavefileManager() {
bool forceSram;
Modified: scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.h
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.h 2009-06-28 19:57:27 UTC (rev 41931)
+++ scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.h 2009-06-28 19:58:11 UTC (rev 41932)
@@ -134,10 +134,6 @@
virtual void quit();
- virtual void setWindowCaption(const char *caption);
-
- virtual void displayMessageOnOSD(const char *msg);
-
virtual Common::SaveFileManager *getSavefileManager();
void addEvent(Common::Event& e);
Modified: scummvm/trunk/backends/platform/iphone/osys_iphone.cpp
===================================================================
--- scummvm/trunk/backends/platform/iphone/osys_iphone.cpp 2009-06-28 19:57:27 UTC (rev 41931)
+++ scummvm/trunk/backends/platform/iphone/osys_iphone.cpp 2009-06-28 19:58:11 UTC (rev 41932)
@@ -1210,9 +1210,6 @@
t = *localtime(&curTime);
}
-void OSystem_IPHONE::setWindowCaption(const char *caption) {
-}
-
Common::SaveFileManager *OSystem_IPHONE::getSavefileManager() {
assert(_savefile);
return _savefile;
Modified: scummvm/trunk/backends/platform/iphone/osys_iphone.h
===================================================================
--- scummvm/trunk/backends/platform/iphone/osys_iphone.h 2009-06-28 19:57:27 UTC (rev 41931)
+++ scummvm/trunk/backends/platform/iphone/osys_iphone.h 2009-06-28 19:58:11 UTC (rev 41932)
@@ -171,8 +171,6 @@
virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);
virtual void getTimeAndDate(struct tm &t) const;
- virtual void setWindowCaption(const char *caption);
-
virtual Common::SaveFileManager *getSavefileManager();
virtual Audio::Mixer *getMixer();
virtual Common::TimerManager *getTimerManager();
Modified: scummvm/trunk/backends/platform/null/null.cpp
===================================================================
--- scummvm/trunk/backends/platform/null/null.cpp 2009-06-28 19:57:27 UTC (rev 41931)
+++ scummvm/trunk/backends/platform/null/null.cpp 2009-06-28 19:58:11 UTC (rev 41932)
@@ -113,8 +113,6 @@
virtual void quit();
- virtual void setWindowCaption(const char *caption);
-
virtual Common::SaveFileManager *getSavefileManager();
virtual Audio::Mixer *getMixer();
virtual void getTimeAndDate(struct tm &t) const;
@@ -308,9 +306,6 @@
void OSystem_NULL::quit() {
}
-void OSystem_NULL::setWindowCaption(const char *caption) {
-}
-
Common::SaveFileManager *OSystem_NULL::getSavefileManager() {
assert(_savefile);
return _savefile;
Modified: scummvm/trunk/backends/platform/psp/osys_psp.cpp
===================================================================
--- scummvm/trunk/backends/platform/psp/osys_psp.cpp 2009-06-28 19:57:27 UTC (rev 41931)
+++ scummvm/trunk/backends/platform/psp/osys_psp.cpp 2009-06-28 19:58:11 UTC (rev 41932)
@@ -635,12 +635,6 @@
t = *localtime(&curTime);
}
-void OSystem_PSP::setWindowCaption(const char *caption) {
-}
-
-void OSystem_PSP::displayMessageOnOSD(const char *msg) {
-}
-
#define PSP_CONFIG_FILE "ms0:/scummvm.ini"
Common::SeekableReadStream *OSystem_PSP::createConfigReadStream() {
Modified: scummvm/trunk/backends/platform/psp/osys_psp.h
===================================================================
--- scummvm/trunk/backends/platform/psp/osys_psp.h 2009-06-28 19:57:27 UTC (rev 41931)
+++ scummvm/trunk/backends/platform/psp/osys_psp.h 2009-06-28 19:58:11 UTC (rev 41932)
@@ -140,8 +140,6 @@
virtual void quit();
- virtual void setWindowCaption(const char *caption);
-
virtual void displayMessageOnOSD(const char *msg);
virtual Common::SeekableReadStream *createConfigReadStream();
Modified: scummvm/trunk/backends/platform/sdl/sdl.cpp
===================================================================
--- scummvm/trunk/backends/platform/sdl/sdl.cpp 2009-06-28 19:57:27 UTC (rev 41931)
+++ scummvm/trunk/backends/platform/sdl/sdl.cpp 2009-06-28 19:58:11 UTC (rev 41932)
@@ -391,13 +391,20 @@
}
void OSystem_SDL::setWindowCaption(const char *caption) {
- Common::String cap(caption);
+ Common::String cap;
+ byte c;
- // Filter out any non-ASCII characters, replacing them by question marks.
- // At some point, we may wish to allow LATIN 1 or UTF-8.
- for (uint i = 0; i < cap.size(); ++i)
- if ((byte)cap[i] > 0x7F)
- cap.setChar('?', i);
+ // 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());
}
Modified: scummvm/trunk/backends/platform/symbian/src/SymbianOS.cpp
===================================================================
--- scummvm/trunk/backends/platform/symbian/src/SymbianOS.cpp 2009-06-28 19:57:27 UTC (rev 41931)
+++ scummvm/trunk/backends/platform/symbian/src/SymbianOS.cpp 2009-06-28 19:58:11 UTC (rev 41932)
@@ -472,6 +472,7 @@
void OSystem_SDL_Symbian::setWindowCaption(const char *caption) {
OSystem_SDL::setWindowCaption(caption);
check_mappings();
+FIXME: move check_mappings() call to engineInit() & engineDone()
}
void OSystem_SDL_Symbian::check_mappings() {
Modified: scummvm/trunk/backends/platform/wince/wince-sdl.cpp
===================================================================
--- scummvm/trunk/backends/platform/wince/wince-sdl.cpp 2009-06-28 19:57:27 UTC (rev 41931)
+++ scummvm/trunk/backends/platform/wince/wince-sdl.cpp 2009-06-28 19:58:11 UTC (rev 41932)
@@ -916,6 +916,8 @@
compute_sample_rate();
setupMixer();
+FIXME: move check_mappings() etc. calls to engineInit() & engineDone()
+
// handle the actual event
OSystem_SDL::setWindowCaption(caption);
}
Modified: scummvm/trunk/common/system.h
===================================================================
--- scummvm/trunk/common/system.h 2009-06-28 19:57:27 UTC (rev 41931)
+++ scummvm/trunk/common/system.h 2009-06-28 19:58:11 UTC (rev 41932)
@@ -886,13 +886,11 @@
/**
* Set a window caption or any other comparable status display to the
- * given value. The caption must be a pure ASCII string. Passing a
- * non-ASCII string may lead to unexpected behavior, even crashes.
+ * given value. The caption must be a pure ISO LATIN 1 string. Passing a
+ * string with a different encoding may lead to unexpected behavior,
+ * even crashes.
*
- * In a future revision of this API, this may be changed to allowing
- * UTF-8 or UTF-16 encoded data, or maybe ISO LATIN 1.
- *
- * @param caption the window caption to use, as an ASCII string
+ * @param caption the window caption to use, as an ISO LATIN 1 string
*/
virtual void setWindowCaption(const char *caption) {}
@@ -902,6 +900,8 @@
* rectangle over the regular screen content; or in a message box beneath
* it; etc.).
*
+ * Currently, only pure ASCII messages can be expected to show correctly.
+ *
* @note There is a default implementation which uses a TimedMessageDialog
* to display the message. Hence implementing this is optional.
*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list