Fixed the 'window title' problem for the SDL and X11 ports. Other 'porters' should fix their front-ends (sorry :-) ).

svn-id: r3776
This commit is contained in:
Lionel Ulmer 2002-03-17 13:00:11 +00:00
parent 932973f8fa
commit 80c5753141
4 changed files with 36 additions and 13 deletions

View File

@ -2327,5 +2327,6 @@ void playSfxSound(void *sound, uint32 size, uint rate);
bool isSfxFinished();
void waitForTimer(Scumm *s, int msec_delay);
void setShakePos(Scumm *s, int shake_pos);
void setWindowName(Scumm *s);
uint16 newTag2Old(uint32 oldTag);
void cd_playtrack(int track, int offset, int delay);

View File

@ -211,29 +211,30 @@ void Scumm::scummMain(int argc, char **argv) {
#endif
parseCommandLine(argc, argv);
#ifdef __MORPHOS__
// I need to know the game name in initGraphics()
if (!detectGame()) {
warning("Game detection failed. Using default settings");
_features = GF_DEFAULT;
}
#endif
if (_exe_name != NULL) {
/* No game selection menu */
if (!detectGame()) {
warning("Game detection failed. Using default settings");
_features = GF_DEFAULT;
}
} else {
_gameText = "Please choose a game";
}
/* Init graphics and create a primary virtual screen */
initGraphics(this, _fullScreen, _scale);
allocResTypeData(rtBuffer, MKID('NONE'),10,"buffer", 0);
initVirtScreen(0, 0, 200, false, false);
#if !defined(__MORPHOS__) && !defined(__APPLE__CW)
if (_exe_name==NULL)
//error("Specify the name of the game to start on the command line");
launcherLoop();
if (_exe_name==NULL) {
launcherLoop();
setWindowName(this);
}
if (!detectGame()) {
warning("Game detection failed. Using default settings");
_features = GF_DEFAULT;
}
#endif
if (!_gameDataPath) {
warning("No path was provided. Assuming that data file are in the current directory");

View File

@ -844,6 +844,13 @@ void initGraphics(Scumm *s, bool fullScreen, unsigned int scaleFactor) {
);
}
void setWindowName(Scumm *s) {
char buf[512], *gameName;
sprintf(buf, "ScummVM - %s", gameName = s->getGameName());
free(gameName);
SDL_WM_SetCaption(buf,buf);
}
#if !defined(__APPLE__)
#undef main

16
x11.cpp
View File

@ -208,7 +208,7 @@ void initGraphics(Scumm *s, bool fullScreen, unsigned int scaleFactor) {
XTextProperty window_name;
char *name = (char *) &buf;
scale = scaleFactor; // not implemented yet! ignored.
scale = scaleFactor; // not implemented yet! ignored.
/* For the window title */
sprintf(buf, "ScummVM - %s", gameName = s->getGameName());
@ -278,6 +278,20 @@ void initGraphics(Scumm *s, bool fullScreen, unsigned int scaleFactor) {
local_fb = (unsigned char *) malloc(320 * 200 * sizeof(unsigned char));
}
void setWindowName(Scumm *s) {
char buf[512], *gameName;
XTextProperty window_name;
char *name = (char *) &buf;
/* For the window title */
sprintf(buf, "ScummVM - %s", gameName = s->getGameName());
free(gameName);
XStringListToTextProperty( &name, 1, &window_name );
XSetWMProperties(display, window, &window_name, &window_name,
NULL /* argv */, 0 /* argc */, NULL /* size hints */, NULL /* WM hints */, NULL /* class hints */ );
}
void setShakePos(Scumm *s, int shake_pos) {
warning("Unimplemented shaking !");
}