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

svn-id: r41932
This commit is contained in:
Max Horn 2009-06-28 19:58:11 +00:00
parent a882a6f467
commit bb28ed7b7a
12 changed files with 26 additions and 40 deletions

View file

@ -115,6 +115,10 @@ void OSystem_PalmOS5::setFeatureState(Feature f, bool enable) {
}
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;

View file

@ -642,12 +642,6 @@ void OSystem_DS::quit() {
swiSoftReset();*/
}
void OSystem_DS::setWindowCaption(const char *caption) {
}
void OSystem_DS::displayMessageOnOSD(const char *msg) {
}
Common::SaveFileManager* OSystem_DS::getSavefileManager() {
bool forceSram;

View file

@ -134,10 +134,6 @@ public:
virtual void quit();
virtual void setWindowCaption(const char *caption);
virtual void displayMessageOnOSD(const char *msg);
virtual Common::SaveFileManager *getSavefileManager();
void addEvent(Common::Event& e);

View file

@ -1210,9 +1210,6 @@ void OSystem_IPHONE::getTimeAndDate(struct tm &t) const {
t = *localtime(&curTime);
}
void OSystem_IPHONE::setWindowCaption(const char *caption) {
}
Common::SaveFileManager *OSystem_IPHONE::getSavefileManager() {
assert(_savefile);
return _savefile;

View file

@ -171,8 +171,6 @@ public:
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();

View file

@ -113,8 +113,6 @@ public:
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 @@ bool OSystem_NULL::setSoundCallback(SoundProc proc, void *param) {
void OSystem_NULL::quit() {
}
void OSystem_NULL::setWindowCaption(const char *caption) {
}
Common::SaveFileManager *OSystem_NULL::getSavefileManager() {
assert(_savefile);
return _savefile;

View file

@ -635,12 +635,6 @@ void OSystem_PSP::getTimeAndDate(struct tm &t) const {
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() {

View file

@ -140,8 +140,6 @@ public:
virtual void quit();
virtual void setWindowCaption(const char *caption);
virtual void displayMessageOnOSD(const char *msg);
virtual Common::SeekableReadStream *createConfigReadStream();

View file

@ -391,13 +391,20 @@ Common::WriteStream *OSystem_SDL::createConfigWriteStream() {
}
void OSystem_SDL::setWindowCaption(const char *caption) {
Common::String cap(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);
}
}
// 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);
SDL_WM_SetCaption(cap.c_str(), cap.c_str());
}

View file

@ -472,6 +472,7 @@ bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev, Common::Event &event) {
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() {

View file

@ -916,6 +916,8 @@ void OSystem_WINCE3::setWindowCaption(const char *caption) {
compute_sample_rate();
setupMixer();
FIXME: move check_mappings() etc. calls to engineInit() & engineDone()
// handle the actual event
OSystem_SDL::setWindowCaption(caption);
}

View file

@ -886,13 +886,11 @@ public:
/**
* 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 @@ public:
* 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.
*