diff options
author | Sky <git@bunnies.cc> | 2013-10-18 18:10:41 +0100 |
---|---|---|
committer | Sky <git@bunnies.cc> | 2013-10-18 18:10:41 +0100 |
commit | b2574542b1d456a46baa8e6c0d351157b9cb18b3 (patch) | |
tree | e004e0894ae40b9a63160ea237b4ef4ec9aceda3 /gui | |
parent | 709252fe9ecec3cc388966d695844f2593029c4f (diff) | |
parent | dcf58cdf12ae9370ba1bf9d6bb789649db82e520 (diff) | |
download | MultiMC-b2574542b1d456a46baa8e6c0d351157b9cb18b3.tar MultiMC-b2574542b1d456a46baa8e6c0d351157b9cb18b3.tar.gz MultiMC-b2574542b1d456a46baa8e6c0d351157b9cb18b3.tar.lz MultiMC-b2574542b1d456a46baa8e6c0d351157b9cb18b3.tar.xz MultiMC-b2574542b1d456a46baa8e6c0d351157b9cb18b3.zip |
Merge branch 'develop' of github.com:MultiMC/MultiMC5 into develop
Diffstat (limited to 'gui')
-rw-r--r-- | gui/EditNotesDialog.cpp | 2 | ||||
-rw-r--r-- | gui/IconPickerDialog.cpp | 2 | ||||
-rw-r--r-- | gui/LegacyModEditDialog.cpp | 2 | ||||
-rw-r--r-- | gui/OneSixModEditDialog.cpp | 4 | ||||
-rw-r--r-- | gui/ProgressDialog.cpp | 2 | ||||
-rw-r--r-- | gui/aboutdialog.cpp | 2 | ||||
-rw-r--r-- | gui/consolewindow.cpp | 3 | ||||
-rw-r--r-- | gui/instancesettings.cpp | 2 | ||||
-rw-r--r-- | gui/logindialog.cpp | 4 | ||||
-rw-r--r-- | gui/lwjglselectdialog.cpp | 2 | ||||
-rw-r--r-- | gui/mainwindow.cpp | 2 | ||||
-rw-r--r-- | gui/mainwindow.ui | 4 | ||||
-rw-r--r-- | gui/newinstancedialog.cpp | 2 | ||||
-rw-r--r-- | gui/platform.h | 35 | ||||
-rw-r--r-- | gui/platform_other.cpp | 27 | ||||
-rw-r--r-- | gui/platform_x11.cpp | 62 | ||||
-rw-r--r-- | gui/settingsdialog.cpp | 2 | ||||
-rw-r--r-- | gui/versionselectdialog.cpp | 2 |
18 files changed, 159 insertions, 2 deletions
diff --git a/gui/EditNotesDialog.cpp b/gui/EditNotesDialog.cpp index 5b90ef53..535ca804 100644 --- a/gui/EditNotesDialog.cpp +++ b/gui/EditNotesDialog.cpp @@ -1,5 +1,6 @@ #include "EditNotesDialog.h" #include "ui_EditNotesDialog.h" +#include "gui/platform.h" #include <QIcon> #include <QApplication> @@ -10,6 +11,7 @@ EditNotesDialog::EditNotesDialog( QString notes, QString name, QWidget* parent ) QDialog(parent), ui(new Ui::EditNotesDialog) { + MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); ui->noteEditor->setText(notes); setWindowTitle(tr("Edit notes of %1").arg(m_instance_name)); diff --git a/gui/IconPickerDialog.cpp b/gui/IconPickerDialog.cpp index 6a1ca546..ebacf87c 100644 --- a/gui/IconPickerDialog.cpp +++ b/gui/IconPickerDialog.cpp @@ -3,6 +3,7 @@ #include "instancedelegate.h" #include "ui_IconPickerDialog.h" #include "logic/lists/IconList.h" +#include "gui/platform.h" #include <QKeyEvent> #include <QPushButton> #include <QFileDialog> @@ -11,6 +12,7 @@ IconPickerDialog::IconPickerDialog(QWidget *parent) : QDialog(parent), ui(new Ui::IconPickerDialog) { + MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); setWindowModality(Qt::WindowModal); diff --git a/gui/LegacyModEditDialog.cpp b/gui/LegacyModEditDialog.cpp index 82532cfd..b230193a 100644 --- a/gui/LegacyModEditDialog.cpp +++ b/gui/LegacyModEditDialog.cpp @@ -21,6 +21,7 @@ #include "ui_LegacyModEditDialog.h" #include "logic/ModList.h" #include "logic/lists/ForgeVersionList.h" +#include "gui/platform.h" #include <pathutils.h> #include <QFileDialog> @@ -32,6 +33,7 @@ LegacyModEditDialog::LegacyModEditDialog(LegacyInstance *inst, QWidget *parent) : m_inst(inst), QDialog(parent), ui(new Ui::LegacyModEditDialog) { + MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); // Jar mods diff --git a/gui/OneSixModEditDialog.cpp b/gui/OneSixModEditDialog.cpp index e072a238..88738938 100644 --- a/gui/OneSixModEditDialog.cpp +++ b/gui/OneSixModEditDialog.cpp @@ -20,8 +20,9 @@ #include "logic/OneSixVersion.h" #include "logic/EnabledItemFilter.h" #include "logic/lists/ForgeVersionList.h" -#include <logic/ForgeInstaller.h> +#include "logic/ForgeInstaller.h" #include "gui/versionselectdialog.h" +#include "gui/platform.h" #include "ProgressDialog.h" #include <pathutils.h> @@ -35,6 +36,7 @@ OneSixModEditDialog::OneSixModEditDialog(OneSixInstance *inst, QWidget *parent) : m_inst(inst), QDialog(parent), ui(new Ui::OneSixModEditDialog) { + MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); // libraries! diff --git a/gui/ProgressDialog.cpp b/gui/ProgressDialog.cpp index 154ab1c0..2e5251a0 100644 --- a/gui/ProgressDialog.cpp +++ b/gui/ProgressDialog.cpp @@ -19,11 +19,13 @@ #include <QKeyEvent> #include "logic/tasks/Task.h" +#include "gui/platform.h" ProgressDialog::ProgressDialog(QWidget *parent) : QDialog(parent), ui(new Ui::ProgressDialog) { + MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); updateSize(); diff --git a/gui/aboutdialog.cpp b/gui/aboutdialog.cpp index 9792d4fe..7105446c 100644 --- a/gui/aboutdialog.cpp +++ b/gui/aboutdialog.cpp @@ -2,11 +2,13 @@ #include "ui_aboutdialog.h" #include <QIcon> #include <MultiMC.h> +#include "gui/platform.h" AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AboutDialog) { + MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); ui->icon->setPixmap(QIcon(":/icons/multimc/scalable/apps/multimc.svg").pixmap(64)); diff --git a/gui/consolewindow.cpp b/gui/consolewindow.cpp index 5cd332c4..deeedd65 100644 --- a/gui/consolewindow.cpp +++ b/gui/consolewindow.cpp @@ -4,12 +4,15 @@ #include <QScrollBar> #include <QMessageBox> +#include <gui/platform.h> + ConsoleWindow::ConsoleWindow(MinecraftProcess *mcproc, QWidget *parent) : QDialog(parent), ui(new Ui::ConsoleWindow), m_mayclose(true), proc(mcproc) { + MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); connect(mcproc, SIGNAL(ended()), this, SLOT(onEnded())); } diff --git a/gui/instancesettings.cpp b/gui/instancesettings.cpp index dfb04f3d..73eb6627 100644 --- a/gui/instancesettings.cpp +++ b/gui/instancesettings.cpp @@ -19,12 +19,14 @@ #include "instancesettings.h" #include "ui_instancesettings.h" +#include "gui/platform.h" InstanceSettings::InstanceSettings( SettingsObject * obj, QWidget *parent) : m_obj(obj), QDialog(parent), ui(new Ui::InstanceSettings) { + MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); loadSettings(); } diff --git a/gui/logindialog.cpp b/gui/logindialog.cpp index fdc94ac7..ed3983b7 100644 --- a/gui/logindialog.cpp +++ b/gui/logindialog.cpp @@ -16,12 +16,14 @@ #include "logindialog.h" #include "ui_logindialog.h" #include "keyring.h" +#include "gui/platform.h" #include <logger/QsLog.h> LoginDialog::LoginDialog(QWidget *parent, const QString& loginErrMsg) : QDialog(parent), ui(new Ui::LoginDialog) { + MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); //: Use offline mode one time @@ -194,4 +196,4 @@ void LoginDialog::forceOnline() { onlineForced = true; offlineButton->setEnabled(false); -}
\ No newline at end of file +} diff --git a/gui/lwjglselectdialog.cpp b/gui/lwjglselectdialog.cpp index 4518e8cd..09963ce0 100644 --- a/gui/lwjglselectdialog.cpp +++ b/gui/lwjglselectdialog.cpp @@ -16,6 +16,7 @@ #include "MultiMC.h" #include "lwjglselectdialog.h" #include "ui_lwjglselectdialog.h" +#include "gui/platform.h" #include "logic/lists/LwjglVersionList.h" @@ -23,6 +24,7 @@ LWJGLSelectDialog::LWJGLSelectDialog(QWidget *parent) : QDialog(parent), ui(new Ui::LWJGLSelectDialog) { + MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); ui->labelStatus->setVisible(false); auto lwjgllist = MMC->lwjgllist(); diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index d99210a9..0bd6f651 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -48,6 +48,7 @@ #include "gui/lwjglselectdialog.h" #include "gui/consolewindow.h" #include "gui/instancesettings.h" +#include "gui/platform.h" #include "logic/lists/InstanceList.h" #include "logic/lists/MinecraftVersionList.h" @@ -72,6 +73,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { + MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); setWindowTitle(QString("MultiMC %1").arg(MMC->version().toString())); diff --git a/gui/mainwindow.ui b/gui/mainwindow.ui index 4c288d5f..0f883d13 100644 --- a/gui/mainwindow.ui +++ b/gui/mainwindow.ui @@ -13,6 +13,10 @@ <property name="windowTitle"> <string>MultiMC 5</string> </property> + <property name="windowIcon"> + <iconset resource="../multimc.qrc"> + <normaloff>:/icons/multimc/scalable/apps/multimc.svg</normaloff>:/icons/multimc/scalable/apps/multimc.svg</iconset> + </property> <widget class="QWidget" name="centralWidget"> <layout class="QHBoxLayout" name="horizontalLayout"> <property name="spacing"> diff --git a/gui/newinstancedialog.cpp b/gui/newinstancedialog.cpp index 04b38316..c37db2ac 100644 --- a/gui/newinstancedialog.cpp +++ b/gui/newinstancedialog.cpp @@ -23,6 +23,7 @@ #include "logic/lists/MinecraftVersionList.h" #include "logic/tasks/Task.h" +#include "gui/platform.h" #include "versionselectdialog.h" #include "ProgressDialog.h" #include "IconPickerDialog.h" @@ -33,6 +34,7 @@ NewInstanceDialog::NewInstanceDialog(QWidget *parent) : QDialog(parent), ui(new Ui::NewInstanceDialog) { + MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); resize(minimumSizeHint()); layout()->setSizeConstraint(QLayout::SetFixedSize); diff --git a/gui/platform.h b/gui/platform.h new file mode 100644 index 00000000..5cf9ed80 --- /dev/null +++ b/gui/platform.h @@ -0,0 +1,35 @@ +/* Copyright 2013 MultiMC Contributors + * + * Authors: Orochimarufan <orochimarufan.x3@gmail.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PLATFORM_H +#define PLATFORM_H + +/** + * @file platform.h + * This file contains platform-specific functions, tweaks and fixes. + */ + +#include <QWidget> + +class MultiMCPlatform +{ +public: + // X11 WM_CLASS + static void fixWM_CLASS(QWidget *widget); +}; + +#endif // PLATFORM_H diff --git a/gui/platform_other.cpp b/gui/platform_other.cpp new file mode 100644 index 00000000..a41abe36 --- /dev/null +++ b/gui/platform_other.cpp @@ -0,0 +1,27 @@ +/* Copyright 2013 MultiMC Contributors + * + * Authors: Orochimarufan <orochimarufan.x3@gmail.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <gui/platform.h> +/** + * Stub for non-X11 platforms + * @brief MultiMCPlatform::fixWM_CLASS + * @param widget + */ +void MultiMCPlatform::fixWM_CLASS(QWidget *widget) +{ + Q_UNUSED(widget); +} diff --git a/gui/platform_x11.cpp b/gui/platform_x11.cpp new file mode 100644 index 00000000..0401e8bf --- /dev/null +++ b/gui/platform_x11.cpp @@ -0,0 +1,62 @@ +/* Copyright 2013 MultiMC Contributors + * + * Authors: Orochimarufan <orochimarufan.x3@gmail.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <gui/platform.h> +#include <QtX11Extras/QX11Info> +#include <xcb/xcb.h> + +static QByteArray WM_CLASS = "MultiMC5\0MultiMC5"; + +template <typename... ArgTypes, typename... ArgTypes2> +static inline unsigned int XcbCallVoid(xcb_void_cookie_t (*func)(xcb_connection_t *, ArgTypes...), ArgTypes2... args...) +{ + return func(QX11Info::connection(), args...).sequence; +} + +static void getAtoms(size_t n, xcb_atom_t *atoms, const char *const names[], bool create) +{ + xcb_connection_t *conn = QX11Info::connection(); + xcb_intern_atom_cookie_t *cookies = (xcb_intern_atom_cookie_t *)malloc(sizeof(xcb_intern_atom_cookie_t) * 2); + for (size_t i = 0; i < n; ++i) + cookies[i] = xcb_intern_atom(conn, create, strlen(names[i]), names[i]); + memset(atoms, 0, sizeof(xcb_atom_t) * n); + for (size_t i = 0; i < n; ++i) + { + xcb_intern_atom_reply_t *r = xcb_intern_atom_reply(conn, cookies[i], 0); + if (r) + { + atoms[i] = r->atom; + free(r); + } + } + free(cookies); +} + +static inline xcb_atom_t getAtom(const char *name, bool create=false) +{ + xcb_atom_t atom; + getAtoms(1, &atom, &name, create); + return atom; +} + +void MultiMCPlatform::fixWM_CLASS(QWidget *widget) +{ + static const xcb_atom_t atom = getAtom("WM_CLASS"); + XcbCallVoid(xcb_change_property, XCB_PROP_MODE_REPLACE, + widget->winId(), atom, XCB_ATOM_STRING, 8, WM_CLASS.count(), + WM_CLASS.constData()); +} diff --git a/gui/settingsdialog.cpp b/gui/settingsdialog.cpp index a3347680..14eba492 100644 --- a/gui/settingsdialog.cpp +++ b/gui/settingsdialog.cpp @@ -18,6 +18,7 @@ #include "ui_settingsdialog.h" #include "logic/JavaUtils.h" #include "gui/versionselectdialog.h" +#include "gui/platform.h" #include "logic/lists/JavaVersionList.h" #include <settingsobject.h> @@ -28,6 +29,7 @@ SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::SettingsDialog) { + MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); loadSettings(MMC->settings().get()); diff --git a/gui/versionselectdialog.cpp b/gui/versionselectdialog.cpp index 900cd092..8fa62f75 100644 --- a/gui/versionselectdialog.cpp +++ b/gui/versionselectdialog.cpp @@ -21,6 +21,7 @@ #include <QDebug> #include <gui/ProgressDialog.h> +#include "gui/platform.h" #include <logic/BaseVersion.h> #include <logic/lists/BaseVersionList.h> @@ -29,6 +30,7 @@ VersionSelectDialog::VersionSelectDialog(BaseVersionList *vlist, QString title, QWidget *parent, bool cancelable) : QDialog(parent), ui(new Ui::VersionSelectDialog) { + MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); setWindowModality(Qt::WindowModal); setWindowTitle(title); |