mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-19 13:29:54 +00:00
Add MATE support
This commit is contained in:
parent
50079e637c
commit
ac05c06551
2 changed files with 29 additions and 11 deletions
|
|
@ -33,7 +33,7 @@
|
||||||
static std::string desktop = "uninitialized";
|
static std::string desktop = "uninitialized";
|
||||||
// GNOME settings
|
// GNOME settings
|
||||||
static Glib::RefPtr<Gio::Settings> bgsetting;
|
static Glib::RefPtr<Gio::Settings> bgsetting;
|
||||||
static std::string defPictureURI, defPictureOptions, defPrimaryColor;
|
static std::string defPictureURI, defPictureOptions, defPrimaryColor, defColorShading;
|
||||||
// XFCE settings
|
// XFCE settings
|
||||||
static XfconfChannel* bgchannel;
|
static XfconfChannel* bgchannel;
|
||||||
static int defPictureStyle;
|
static int defPictureStyle;
|
||||||
|
|
@ -51,11 +51,17 @@ void desktopEnvironmentInit()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
desktop = shState->oneshot().desktopEnv;
|
desktop = shState->oneshot().desktopEnv;
|
||||||
|
if (desktop == "gnome" || desktop == "mate") {
|
||||||
if (desktop == "gnome") {
|
if (desktop == "gnome") {
|
||||||
bgsetting = Gio::Settings::create("org.gnome.desktop.background");
|
bgsetting = Gio::Settings::create("org.gnome.desktop.background");
|
||||||
defPictureURI = bgsetting->get_string("picture-uri");
|
defPictureURI = bgsetting->get_string("picture-uri");
|
||||||
|
} else {
|
||||||
|
bgsetting = Gio::Settings::create("org.mate.background");
|
||||||
|
defPictureURI = bgsetting->get_string("picture-filename");
|
||||||
|
}
|
||||||
defPictureOptions = bgsetting->get_string("picture-options");
|
defPictureOptions = bgsetting->get_string("picture-options");
|
||||||
defPrimaryColor = bgsetting->get_string("primary-color");
|
defPrimaryColor = bgsetting->get_string("primary-color");
|
||||||
|
defColorShading = bgsetting->get_string("color-shading-type");
|
||||||
} else if (desktop == "xfce") {
|
} else if (desktop == "xfce") {
|
||||||
GError *xferror = NULL;
|
GError *xferror = NULL;
|
||||||
if (xfconf_init(&xferror)) {
|
if (xfconf_init(&xferror)) {
|
||||||
|
|
@ -177,12 +183,17 @@ end:
|
||||||
}
|
}
|
||||||
std::string gameDirStr(gameDir);
|
std::string gameDirStr(gameDir);
|
||||||
desktopEnvironmentInit();
|
desktopEnvironmentInit();
|
||||||
if (desktop == "gnome") {
|
if (desktop == "gnome" || desktop == "mate") {
|
||||||
std::stringstream hexColor;
|
std::stringstream hexColor;
|
||||||
hexColor << "#" << std::hex << color;
|
hexColor << "#" << std::hex << color;
|
||||||
|
if (desktop == "gnome") {
|
||||||
bgsetting->set_string("picture-uri", "file://" + gameDirStr + path);
|
bgsetting->set_string("picture-uri", "file://" + gameDirStr + path);
|
||||||
|
} else {
|
||||||
|
bgsetting->set_string("picture-filename", gameDirStr + path);
|
||||||
|
}
|
||||||
bgsetting->set_string("picture-options", "scaled");
|
bgsetting->set_string("picture-options", "scaled");
|
||||||
bgsetting->set_string("primary-color", hexColor.str());
|
bgsetting->set_string("primary-color", hexColor.str());
|
||||||
|
bgsetting->set_string("color-shading-type", "solid");
|
||||||
} else if (desktop == "xfce") {
|
} else if (desktop == "xfce") {
|
||||||
int r = (color >> 16) & 0xFF;
|
int r = (color >> 16) & 0xFF;
|
||||||
int g = (color >> 8) & 0xFF;
|
int g = (color >> 8) & 0xFF;
|
||||||
|
|
@ -270,10 +281,15 @@ RB_METHOD(wallpaperReset)
|
||||||
MacDesktop::ResetBackground();
|
MacDesktop::ResetBackground();
|
||||||
#else
|
#else
|
||||||
desktopEnvironmentInit();
|
desktopEnvironmentInit();
|
||||||
|
if (desktop == "gnome" || desktop == "mate") {
|
||||||
if (desktop == "gnome") {
|
if (desktop == "gnome") {
|
||||||
bgsetting->set_string("picture-uri", defPictureURI);
|
bgsetting->set_string("picture-uri", defPictureURI);
|
||||||
|
} else {
|
||||||
|
bgsetting->set_string("picture-filename", defPictureURI);
|
||||||
|
}
|
||||||
bgsetting->set_string("picture-options", defPictureOptions);
|
bgsetting->set_string("picture-options", defPictureOptions);
|
||||||
bgsetting->set_string("primary-color", defPrimaryColor);
|
bgsetting->set_string("primary-color", defPrimaryColor);
|
||||||
|
bgsetting->set_string("color-shading-type", defColorShading);
|
||||||
} else if (desktop == "xfce") {
|
} else if (desktop == "xfce") {
|
||||||
if (defColorExists) {
|
if (defColorExists) {
|
||||||
xfconf_channel_set_property(bgchannel, optionColor.c_str(), &defColor);
|
xfconf_channel_set_property(bgchannel, optionColor.c_str(), &defColor);
|
||||||
|
|
|
||||||
|
|
@ -277,11 +277,13 @@ Oneshot::Oneshot(RGSSThreadData &threadData) :
|
||||||
if (
|
if (
|
||||||
desktop.find("cinnamon") != std::string::npos ||
|
desktop.find("cinnamon") != std::string::npos ||
|
||||||
desktop.find("gnome") != std::string::npos ||
|
desktop.find("gnome") != std::string::npos ||
|
||||||
desktop.find("unity") != std::string::npos ||
|
desktop.find("unity") != std::string::npos
|
||||||
desktop.find("mate") != std::string::npos
|
|
||||||
) {
|
) {
|
||||||
desktopEnv = "gnome";
|
desktopEnv = "gnome";
|
||||||
gtk_init(0, 0);
|
gtk_init(0, 0);
|
||||||
|
} else if (desktop.find("mate") != std::string::npos) {
|
||||||
|
desktopEnv = "mate";
|
||||||
|
gtk_init(0, 0);
|
||||||
} else if (desktop.find("xfce") != std::string::npos) {
|
} else if (desktop.find("xfce") != std::string::npos) {
|
||||||
desktopEnv = "xfce";
|
desktopEnv = "xfce";
|
||||||
}
|
}
|
||||||
|
|
@ -456,7 +458,7 @@ bool Oneshot::msgbox(int type, const char *body, const char *title)
|
||||||
if (!title)
|
if (!title)
|
||||||
title = "";
|
title = "";
|
||||||
#if defined OS_LINUX
|
#if defined OS_LINUX
|
||||||
if (desktopEnv == "gnome") {
|
if (desktopEnv == "gnome" || desktopEnv == "mate") {
|
||||||
linux_DialogData data = {type, body, title, 0};
|
linux_DialogData data = {type, body, title, 0};
|
||||||
gdk_threads_add_idle(linux_dialog, &data);
|
gdk_threads_add_idle(linux_dialog, &data);
|
||||||
gtk_main();
|
gtk_main();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue