diff --git a/application/CMakeLists.txt b/application/CMakeLists.txt index 99ee7f46..1ba19bc2 100644 --- a/application/CMakeLists.txt +++ b/application/CMakeLists.txt @@ -318,15 +318,6 @@ if(WIN32) set(MULTIMC_RCS resources/multimc.rc) endif() -####### X11 Stuff ####### -if(UNIX AND NOT APPLE) - find_package(Qt5X11Extras REQUIRED) - set(MultiMC_LINK_ADDITIONAL_LIBS ${MultiMC_LINK_ADDITIONAL_LIBS} xcb Qt5::X11Extras) - list(APPEND MULTIMC_SOURCES Platform_X11.cpp) -else() - list(APPEND MULTIMC_SOURCES Platform_Other.cpp) -endif() - # Link additional libraries if(WIN32) set(MultiMC_LINK_ADDITIONAL_LIBS ${MultiMC_LINK_ADDITIONAL_LIBS} Qt5::WinMain) diff --git a/application/ConsoleWindow.cpp b/application/ConsoleWindow.cpp index 8f3f20bd..9de0ec5d 100644 --- a/application/ConsoleWindow.cpp +++ b/application/ConsoleWindow.cpp @@ -24,7 +24,6 @@ #include #include -#include #include #include #include "widgets/PageContainer.h" @@ -56,7 +55,6 @@ private: ConsoleWindow::ConsoleWindow(std::shared_ptr proc, QWidget *parent) : QMainWindow(parent), m_proc(proc) { - MultiMCPlatform::fixWM_CLASS(this); setAttribute(Qt::WA_DeleteOnClose); auto instance = m_proc->instance(); diff --git a/application/MainWindow.cpp b/application/MainWindow.cpp index 72db197c..891842b5 100644 --- a/application/MainWindow.cpp +++ b/application/MainWindow.cpp @@ -332,8 +332,6 @@ namespace Ui { #include "groupview/InstanceDelegate.h" #include "InstanceProxyModel.h" -#include "Platform.h" - #include "widgets/LabeledToolButton.h" #include "widgets/ServerStatus.h" @@ -385,7 +383,6 @@ namespace Ui { MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { - MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); // initialize the news checker diff --git a/application/Platform.h b/application/Platform.h deleted file mode 100644 index 349e5ecc..00000000 --- a/application/Platform.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright 2013-2015 MultiMC Contributors - * - * Authors: Orochimarufan - * - * 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. - */ - -#pragma once - -/** - * @file Platform.h - * This file contains platform-specific functions, tweaks and fixes. - */ - -#include - -class MultiMCPlatform -{ -public: - // X11 WM_CLASS - static void fixWM_CLASS(QWidget *widget); -}; diff --git a/application/Platform_Other.cpp b/application/Platform_Other.cpp deleted file mode 100644 index 7eaf91d4..00000000 --- a/application/Platform_Other.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright 2013-2015 MultiMC Contributors - * - * Authors: Orochimarufan - * - * 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 -/** - * Stub for non-X11 platforms - * @brief MultiMCPlatform::fixWM_CLASS - * @param widget - */ -void MultiMCPlatform::fixWM_CLASS(QWidget *widget) -{ - Q_UNUSED(widget); -} diff --git a/application/Platform_X11.cpp b/application/Platform_X11.cpp deleted file mode 100644 index baca15dd..00000000 --- a/application/Platform_X11.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* Copyright 2013-2015 MultiMC Contributors - * - * Authors: Orochimarufan - * - * 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 -#include -#include - -static QByteArray WM_CLASS = "MultiMC5\0MultiMC5"; - -template -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/application/dialogs/AboutDialog.cpp b/application/dialogs/AboutDialog.cpp index abcc76f2..fd61adde 100644 --- a/application/dialogs/AboutDialog.cpp +++ b/application/dialogs/AboutDialog.cpp @@ -17,7 +17,6 @@ #include "ui_AboutDialog.h" #include #include "MultiMC.h" -#include "Platform.h" #include "BuildConfig.h" #include @@ -73,7 +72,6 @@ QString getCreditsHtml(QStringList patrons) AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AboutDialog) { - MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); QString chtml = getCreditsHtml(QStringList()); diff --git a/application/dialogs/CopyInstanceDialog.cpp b/application/dialogs/CopyInstanceDialog.cpp index 5b8e3096..0e94540c 100644 --- a/application/dialogs/CopyInstanceDialog.cpp +++ b/application/dialogs/CopyInstanceDialog.cpp @@ -20,7 +20,6 @@ #include "CopyInstanceDialog.h" #include "ui_CopyInstanceDialog.h" -#include "Platform.h" #include "dialogs/IconPickerDialog.h" #include "BaseVersion.h" @@ -32,7 +31,6 @@ CopyInstanceDialog::CopyInstanceDialog(InstancePtr original, QWidget *parent) :QDialog(parent), ui(new Ui::CopyInstanceDialog), m_original(original) { - MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); resize(minimumSizeHint()); layout()->setSizeConstraint(QLayout::SetFixedSize); diff --git a/application/dialogs/IconPickerDialog.cpp b/application/dialogs/IconPickerDialog.cpp index cafd47b7..7bde6fd0 100644 --- a/application/dialogs/IconPickerDialog.cpp +++ b/application/dialogs/IconPickerDialog.cpp @@ -22,7 +22,6 @@ #include "IconPickerDialog.h" #include "ui_IconPickerDialog.h" -#include "Platform.h" #include "groupview/InstanceDelegate.h" #include "icons/IconList.h" @@ -30,7 +29,6 @@ IconPickerDialog::IconPickerDialog(QWidget *parent) : QDialog(parent), ui(new Ui::IconPickerDialog) { - MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); setWindowModality(Qt::WindowModal); diff --git a/application/dialogs/NewInstanceDialog.cpp b/application/dialogs/NewInstanceDialog.cpp index 661f5c53..658302a8 100644 --- a/application/dialogs/NewInstanceDialog.cpp +++ b/application/dialogs/NewInstanceDialog.cpp @@ -23,7 +23,6 @@ #include #include -#include "Platform.h" #include "VersionSelectDialog.h" #include "ProgressDialog.h" #include "IconPickerDialog.h" @@ -59,7 +58,6 @@ public: 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/application/dialogs/ProgressDialog.cpp b/application/dialogs/ProgressDialog.cpp index 939c5870..83f82d33 100644 --- a/application/dialogs/ProgressDialog.cpp +++ b/application/dialogs/ProgressDialog.cpp @@ -19,11 +19,9 @@ #include #include "tasks/Task.h" -#include "Platform.h" ProgressDialog::ProgressDialog(QWidget *parent) : QDialog(parent), ui(new Ui::ProgressDialog) { - MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint); setSkipButton(false); diff --git a/application/dialogs/UpdateDialog.cpp b/application/dialogs/UpdateDialog.cpp index 4240e3d5..4661bcb5 100644 --- a/application/dialogs/UpdateDialog.cpp +++ b/application/dialogs/UpdateDialog.cpp @@ -1,6 +1,5 @@ #include "UpdateDialog.h" #include "ui_UpdateDialog.h" -#include "Platform.h" #include #include "MultiMC.h" #include @@ -10,7 +9,6 @@ UpdateDialog::UpdateDialog(bool hasUpdate, QWidget *parent) : QDialog(parent), ui(new Ui::UpdateDialog) { - MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); auto channel = MMC->settings()->get("UpdateChannel").toString(); if(hasUpdate) diff --git a/application/dialogs/VersionSelectDialog.cpp b/application/dialogs/VersionSelectDialog.cpp index 57514fe7..df72189b 100644 --- a/application/dialogs/VersionSelectDialog.cpp +++ b/application/dialogs/VersionSelectDialog.cpp @@ -20,7 +20,6 @@ #include #include "CustomMessageBox.h" -#include "Platform.h" #include #include @@ -34,7 +33,6 @@ VersionSelectDialog::VersionSelectDialog(BaseVersionList *vlist, QString title, bool cancelable) : QDialog(parent), ui(new Ui::VersionSelectDialog) { - MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); setWindowModality(Qt::WindowModal); setWindowTitle(title); diff --git a/application/pagedialog/PageDialog.cpp b/application/pagedialog/PageDialog.cpp index c2b480cf..7665ddf7 100644 --- a/application/pagedialog/PageDialog.cpp +++ b/application/pagedialog/PageDialog.cpp @@ -22,14 +22,12 @@ #include "MultiMC.h" #include "settings/SettingsObject.h" -#include "Platform.h" #include "widgets/IconLabel.h" #include "widgets/PageContainer.h" PageDialog::PageDialog(BasePageProviderPtr pageProvider, QString defaultId, QWidget *parent) : QDialog(parent) { - MultiMCPlatform::fixWM_CLASS(this); setWindowTitle(pageProvider->dialogTitle()); m_container = new PageContainer(pageProvider, defaultId, this); diff --git a/application/pages/VersionPage.cpp b/application/pages/VersionPage.cpp index 81da0180..d56bbd28 100644 --- a/application/pages/VersionPage.cpp +++ b/application/pages/VersionPage.cpp @@ -23,7 +23,6 @@ #include "VersionPage.h" #include "ui_VersionPage.h" -#include "Platform.h" #include "dialogs/CustomMessageBox.h" #include "dialogs/VersionSelectDialog.h" #include "dialogs/ModEditDialogCommon.h" diff --git a/application/pages/global/MinecraftPage.cpp b/application/pages/global/MinecraftPage.cpp index 57f40ae6..3e05924e 100644 --- a/application/pages/global/MinecraftPage.cpp +++ b/application/pages/global/MinecraftPage.cpp @@ -21,8 +21,6 @@ #include -#include "Platform.h" - #include "settings/SettingsObject.h" #include "MultiMC.h" diff --git a/application/widgets/PageContainer.cpp b/application/widgets/PageContainer.cpp index 0fe4ea25..66d94e6c 100644 --- a/application/widgets/PageContainer.cpp +++ b/application/widgets/PageContainer.cpp @@ -30,7 +30,6 @@ #include "MultiMC.h" #include "settings/SettingsObject.h" #include "widgets/IconLabel.h" -#include "Platform.h" #include "PageContainer_p.h" #include