main: Only set window icon on Linux
OSX carries high-resolution icons in its bundles, and windows uses windres to embed .ico files, so don't interfere with those.
This commit is contained in:
parent
c4dd3ffaf6
commit
6349146e01
40
src/main.cpp
40
src/main.cpp
|
@ -166,6 +166,24 @@ static void showInitError(const std::string &msg)
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "mkxp", msg.c_str(), 0);
|
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "mkxp", msg.c_str(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void setupWindowIcon(const Config &conf, SDL_Window *win)
|
||||||
|
{
|
||||||
|
SDL_RWops *iconSrc;
|
||||||
|
|
||||||
|
if (conf.iconPath.empty())
|
||||||
|
iconSrc = SDL_RWFromConstMem(assets_icon_png, assets_icon_png_len);
|
||||||
|
else
|
||||||
|
iconSrc = SDL_RWFromFile(conf.iconPath.c_str(), "rb");
|
||||||
|
|
||||||
|
SDL_Surface *iconImg = IMG_Load_RW(iconSrc, SDL_TRUE);
|
||||||
|
|
||||||
|
if (iconImg)
|
||||||
|
{
|
||||||
|
SDL_SetWindowIcon(win, iconImg);
|
||||||
|
SDL_FreeSurface(iconImg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
|
SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
|
||||||
|
@ -239,16 +257,6 @@ int main(int argc, char *argv[])
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup application icon */
|
|
||||||
SDL_RWops *iconSrc;
|
|
||||||
|
|
||||||
if (conf.iconPath.empty())
|
|
||||||
iconSrc = SDL_RWFromConstMem(assets_icon_png, assets_icon_png_len);
|
|
||||||
else
|
|
||||||
iconSrc = SDL_RWFromFile(conf.iconPath.c_str(), "rb");
|
|
||||||
|
|
||||||
SDL_Surface *iconImg = IMG_Load_RW(iconSrc, SDL_TRUE);
|
|
||||||
|
|
||||||
SDL_Window *win;
|
SDL_Window *win;
|
||||||
Uint32 winFlags = SDL_WINDOW_OPENGL | SDL_WINDOW_INPUT_FOCUS;
|
Uint32 winFlags = SDL_WINDOW_OPENGL | SDL_WINDOW_INPUT_FOCUS;
|
||||||
|
|
||||||
|
@ -267,11 +275,13 @@ int main(int argc, char *argv[])
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iconImg)
|
/* OSX and Windows have their own native ways of
|
||||||
{
|
* dealing with icons; don't interfere with them */
|
||||||
SDL_SetWindowIcon(win, iconImg);
|
#ifdef __LINUX__
|
||||||
SDL_FreeSurface(iconImg);
|
setupWindowIcon(conf, win);
|
||||||
}
|
#else
|
||||||
|
(void) setupWindowIcon;
|
||||||
|
#endif
|
||||||
|
|
||||||
ALCdevice *alcDev = alcOpenDevice(0);
|
ALCdevice *alcDev = alcOpenDevice(0);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue