aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorest31 <est31@users.noreply.github.com>2016-08-20 21:26:44 +0200
committerGitHub <noreply@github.com>2016-08-20 21:26:44 +0200
commitf092dac9793b80c29a669b0d676ee3e4f55f682e (patch)
tree75bb3a5c4f9d82fc6c18f4481f3b8a662ea481c3
parent6590140260d0338ab5a0fd2bbcd4c72f07dd963d (diff)
downloadminetest-f092dac9793b80c29a669b0d676ee3e4f55f682e.tar.gz
minetest-f092dac9793b80c29a669b0d676ee3e4f55f682e.tar.bz2
minetest-f092dac9793b80c29a669b0d676ee3e4f55f682e.zip
Also support X11 icon for minetest copies installed via make install (#4407)
Fixes #4323.
-rw-r--r--CMakeLists.txt3
-rw-r--r--src/client/clientlauncher.cpp3
-rw-r--r--src/cmake_config.h.in1
-rw-r--r--src/porting.cpp19
-rw-r--r--src/porting.h4
5 files changed, 26 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 592feb997..fbf6bb7fa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -175,6 +175,9 @@ if(UNIX AND NOT APPLE)
install(FILES "misc/minetest.desktop" DESTINATION "${XDG_APPS_DIR}")
install(FILES "misc/minetest.appdata.xml" DESTINATION "${APPDATADIR}")
install(FILES "misc/minetest.svg" DESTINATION "${ICONDIR}/hicolor/scalable/apps")
+ install(FILES "misc/minetest-xorg-icon-128.png"
+ DESTINATION "${ICONDIR}/hicolor/128x128/apps"
+ RENAME "minetest.png")
endif()
if(APPLE)
diff --git a/src/client/clientlauncher.cpp b/src/client/clientlauncher.cpp
index aa3c2d548..6145e3dde 100644
--- a/src/client/clientlauncher.cpp
+++ b/src/client/clientlauncher.cpp
@@ -114,8 +114,7 @@ bool ClientLauncher::run(GameParams &game_params, const Settings &cmd_args)
porting::setXorgClassHint(video_driver->getExposedVideoData(), PROJECT_NAME_C);
- porting::setXorgWindowIcon(device,
- porting::path_share + "/misc/minetest-xorg-icon-128.png");
+ porting::setXorgWindowIcon(device);
/*
This changes the minimum allowed number of vertices in a VBO.
diff --git a/src/cmake_config.h.in b/src/cmake_config.h.in
index 50f34a0b8..4b731020a 100644
--- a/src/cmake_config.h.in
+++ b/src/cmake_config.h.in
@@ -14,6 +14,7 @@
#define STATIC_SHAREDIR "@SHAREDIR@"
#define STATIC_LOCALEDIR "@LOCALEDIR@"
#define BUILD_TYPE "@CMAKE_BUILD_TYPE@"
+#define ICON_DIR "@ICONDIR@"
#cmakedefine01 RUN_IN_PLACE
#cmakedefine01 USE_GETTEXT
#cmakedefine01 USE_CURL
diff --git a/src/porting.cpp b/src/porting.cpp
index acd047232..ae9114ac8 100644
--- a/src/porting.cpp
+++ b/src/porting.cpp
@@ -611,7 +611,24 @@ void setXorgClassHint(const video::SExposedVideoData &video_data,
#endif
}
-bool setXorgWindowIcon(IrrlichtDevice *device,
+bool setXorgWindowIcon(IrrlichtDevice *device)
+{
+#if RUN_IN_PLACE
+ return setXorgWindowIconFromPath(device,
+ path_share + "/misc/" PROJECT_NAME "-xorg-icon-128.png");
+#else
+ // We have semi-support for reading in-place data if we are
+ // compiled with RUN_IN_PLACE. Don't break with this and
+ // also try the path_share location.
+ return
+ setXorgWindowIconFromPath(device,
+ ICON_DIR "/hicolor/128x128/apps/" PROJECT_NAME ".png") ||
+ setXorgWindowIconFromPath(device,
+ path_share + "/misc/" PROJECT_NAME "-xorg-icon-128.png");
+#endif
+}
+
+bool setXorgWindowIconFromPath(IrrlichtDevice *device,
const std::string &icon_file)
{
#ifdef XORG_USED
diff --git a/src/porting.h b/src/porting.h
index 40f6b4dc3..f5c7efcb2 100644
--- a/src/porting.h
+++ b/src/porting.h
@@ -367,7 +367,9 @@ inline const char *getPlatformName()
void setXorgClassHint(const video::SExposedVideoData &video_data,
const std::string &name);
-bool setXorgWindowIcon(IrrlichtDevice *device,
+bool setXorgWindowIcon(IrrlichtDevice *device);
+
+bool setXorgWindowIconFromPath(IrrlichtDevice *device,
const std::string &icon_file);
// This only needs to be called at the start of execution, since all future