NOISSUE remoce the old WM_CLASS workaround

This commit is contained in:
Petr Mrázek 2015-08-23 16:05:53 +02:00
parent b6ec2ac4b0
commit 0d15247247
17 changed files with 0 additions and 155 deletions

View File

@ -318,15 +318,6 @@ if(WIN32)
set(MULTIMC_RCS resources/multimc.rc) set(MULTIMC_RCS resources/multimc.rc)
endif() 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 # Link additional libraries
if(WIN32) if(WIN32)
set(MultiMC_LINK_ADDITIONAL_LIBS ${MultiMC_LINK_ADDITIONAL_LIBS} Qt5::WinMain) set(MultiMC_LINK_ADDITIONAL_LIBS ${MultiMC_LINK_ADDITIONAL_LIBS} Qt5::WinMain)

View File

@ -24,7 +24,6 @@
#include <qlayoutitem.h> #include <qlayoutitem.h>
#include <QCloseEvent> #include <QCloseEvent>
#include <Platform.h>
#include <dialogs/CustomMessageBox.h> #include <dialogs/CustomMessageBox.h>
#include <dialogs/ProgressDialog.h> #include <dialogs/ProgressDialog.h>
#include "widgets/PageContainer.h" #include "widgets/PageContainer.h"
@ -56,7 +55,6 @@ private:
ConsoleWindow::ConsoleWindow(std::shared_ptr<LaunchTask> proc, QWidget *parent) ConsoleWindow::ConsoleWindow(std::shared_ptr<LaunchTask> proc, QWidget *parent)
: QMainWindow(parent), m_proc(proc) : QMainWindow(parent), m_proc(proc)
{ {
MultiMCPlatform::fixWM_CLASS(this);
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
auto instance = m_proc->instance(); auto instance = m_proc->instance();

View File

@ -332,8 +332,6 @@ namespace Ui {
#include "groupview/InstanceDelegate.h" #include "groupview/InstanceDelegate.h"
#include "InstanceProxyModel.h" #include "InstanceProxyModel.h"
#include "Platform.h"
#include "widgets/LabeledToolButton.h" #include "widgets/LabeledToolButton.h"
#include "widgets/ServerStatus.h" #include "widgets/ServerStatus.h"
@ -385,7 +383,6 @@ namespace Ui {
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
{ {
MultiMCPlatform::fixWM_CLASS(this);
ui->setupUi(this); ui->setupUi(this);
// initialize the news checker // initialize the news checker

View File

@ -1,32 +0,0 @@
/* Copyright 2013-2015 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.
*/
#pragma once
/**
* @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);
};

View File

@ -1,27 +0,0 @@
/* Copyright 2013-2015 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 <Platform.h>
/**
* Stub for non-X11 platforms
* @brief MultiMCPlatform::fixWM_CLASS
* @param widget
*/
void MultiMCPlatform::fixWM_CLASS(QWidget *widget)
{
Q_UNUSED(widget);
}

View File

@ -1,62 +0,0 @@
/* Copyright 2013-2015 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 <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());
}

View File

@ -17,7 +17,6 @@
#include "ui_AboutDialog.h" #include "ui_AboutDialog.h"
#include <QIcon> #include <QIcon>
#include "MultiMC.h" #include "MultiMC.h"
#include "Platform.h"
#include "BuildConfig.h" #include "BuildConfig.h"
#include <net/NetJob.h> #include <net/NetJob.h>
@ -73,7 +72,6 @@ QString getCreditsHtml(QStringList patrons)
AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AboutDialog) AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AboutDialog)
{ {
MultiMCPlatform::fixWM_CLASS(this);
ui->setupUi(this); ui->setupUi(this);
QString chtml = getCreditsHtml(QStringList()); QString chtml = getCreditsHtml(QStringList());

View File

@ -20,7 +20,6 @@
#include "CopyInstanceDialog.h" #include "CopyInstanceDialog.h"
#include "ui_CopyInstanceDialog.h" #include "ui_CopyInstanceDialog.h"
#include "Platform.h"
#include "dialogs/IconPickerDialog.h" #include "dialogs/IconPickerDialog.h"
#include "BaseVersion.h" #include "BaseVersion.h"
@ -32,7 +31,6 @@
CopyInstanceDialog::CopyInstanceDialog(InstancePtr original, QWidget *parent) CopyInstanceDialog::CopyInstanceDialog(InstancePtr original, QWidget *parent)
:QDialog(parent), ui(new Ui::CopyInstanceDialog), m_original(original) :QDialog(parent), ui(new Ui::CopyInstanceDialog), m_original(original)
{ {
MultiMCPlatform::fixWM_CLASS(this);
ui->setupUi(this); ui->setupUi(this);
resize(minimumSizeHint()); resize(minimumSizeHint());
layout()->setSizeConstraint(QLayout::SetFixedSize); layout()->setSizeConstraint(QLayout::SetFixedSize);

View File

@ -22,7 +22,6 @@
#include "IconPickerDialog.h" #include "IconPickerDialog.h"
#include "ui_IconPickerDialog.h" #include "ui_IconPickerDialog.h"
#include "Platform.h"
#include "groupview/InstanceDelegate.h" #include "groupview/InstanceDelegate.h"
#include "icons/IconList.h" #include "icons/IconList.h"
@ -30,7 +29,6 @@
IconPickerDialog::IconPickerDialog(QWidget *parent) IconPickerDialog::IconPickerDialog(QWidget *parent)
: QDialog(parent), ui(new Ui::IconPickerDialog) : QDialog(parent), ui(new Ui::IconPickerDialog)
{ {
MultiMCPlatform::fixWM_CLASS(this);
ui->setupUi(this); ui->setupUi(this);
setWindowModality(Qt::WindowModal); setWindowModality(Qt::WindowModal);

View File

@ -23,7 +23,6 @@
#include <tasks/Task.h> #include <tasks/Task.h>
#include <InstanceList.h> #include <InstanceList.h>
#include "Platform.h"
#include "VersionSelectDialog.h" #include "VersionSelectDialog.h"
#include "ProgressDialog.h" #include "ProgressDialog.h"
#include "IconPickerDialog.h" #include "IconPickerDialog.h"
@ -59,7 +58,6 @@ public:
NewInstanceDialog::NewInstanceDialog(QWidget *parent) NewInstanceDialog::NewInstanceDialog(QWidget *parent)
: QDialog(parent), ui(new Ui::NewInstanceDialog) : QDialog(parent), ui(new Ui::NewInstanceDialog)
{ {
MultiMCPlatform::fixWM_CLASS(this);
ui->setupUi(this); ui->setupUi(this);
resize(minimumSizeHint()); resize(minimumSizeHint());
layout()->setSizeConstraint(QLayout::SetFixedSize); layout()->setSizeConstraint(QLayout::SetFixedSize);

View File

@ -19,11 +19,9 @@
#include <QKeyEvent> #include <QKeyEvent>
#include "tasks/Task.h" #include "tasks/Task.h"
#include "Platform.h"
ProgressDialog::ProgressDialog(QWidget *parent) : QDialog(parent), ui(new Ui::ProgressDialog) ProgressDialog::ProgressDialog(QWidget *parent) : QDialog(parent), ui(new Ui::ProgressDialog)
{ {
MultiMCPlatform::fixWM_CLASS(this);
ui->setupUi(this); ui->setupUi(this);
this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint); this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
setSkipButton(false); setSkipButton(false);

View File

@ -1,6 +1,5 @@
#include "UpdateDialog.h" #include "UpdateDialog.h"
#include "ui_UpdateDialog.h" #include "ui_UpdateDialog.h"
#include "Platform.h"
#include <QDebug> #include <QDebug>
#include "MultiMC.h" #include "MultiMC.h"
#include <settings/SettingsObject.h> #include <settings/SettingsObject.h>
@ -10,7 +9,6 @@
UpdateDialog::UpdateDialog(bool hasUpdate, QWidget *parent) : QDialog(parent), ui(new Ui::UpdateDialog) UpdateDialog::UpdateDialog(bool hasUpdate, QWidget *parent) : QDialog(parent), ui(new Ui::UpdateDialog)
{ {
MultiMCPlatform::fixWM_CLASS(this);
ui->setupUi(this); ui->setupUi(this);
auto channel = MMC->settings()->get("UpdateChannel").toString(); auto channel = MMC->settings()->get("UpdateChannel").toString();
if(hasUpdate) if(hasUpdate)

View File

@ -20,7 +20,6 @@
#include <dialogs/ProgressDialog.h> #include <dialogs/ProgressDialog.h>
#include "CustomMessageBox.h" #include "CustomMessageBox.h"
#include "Platform.h"
#include <BaseVersion.h> #include <BaseVersion.h>
#include <BaseVersionList.h> #include <BaseVersionList.h>
@ -34,7 +33,6 @@ VersionSelectDialog::VersionSelectDialog(BaseVersionList *vlist, QString title,
bool cancelable) bool cancelable)
: QDialog(parent), ui(new Ui::VersionSelectDialog) : QDialog(parent), ui(new Ui::VersionSelectDialog)
{ {
MultiMCPlatform::fixWM_CLASS(this);
ui->setupUi(this); ui->setupUi(this);
setWindowModality(Qt::WindowModal); setWindowModality(Qt::WindowModal);
setWindowTitle(title); setWindowTitle(title);

View File

@ -22,14 +22,12 @@
#include "MultiMC.h" #include "MultiMC.h"
#include "settings/SettingsObject.h" #include "settings/SettingsObject.h"
#include "Platform.h"
#include "widgets/IconLabel.h" #include "widgets/IconLabel.h"
#include "widgets/PageContainer.h" #include "widgets/PageContainer.h"
PageDialog::PageDialog(BasePageProviderPtr pageProvider, QString defaultId, QWidget *parent) PageDialog::PageDialog(BasePageProviderPtr pageProvider, QString defaultId, QWidget *parent)
: QDialog(parent) : QDialog(parent)
{ {
MultiMCPlatform::fixWM_CLASS(this);
setWindowTitle(pageProvider->dialogTitle()); setWindowTitle(pageProvider->dialogTitle());
m_container = new PageContainer(pageProvider, defaultId, this); m_container = new PageContainer(pageProvider, defaultId, this);

View File

@ -23,7 +23,6 @@
#include "VersionPage.h" #include "VersionPage.h"
#include "ui_VersionPage.h" #include "ui_VersionPage.h"
#include "Platform.h"
#include "dialogs/CustomMessageBox.h" #include "dialogs/CustomMessageBox.h"
#include "dialogs/VersionSelectDialog.h" #include "dialogs/VersionSelectDialog.h"
#include "dialogs/ModEditDialogCommon.h" #include "dialogs/ModEditDialogCommon.h"

View File

@ -21,8 +21,6 @@
#include <pathutils.h> #include <pathutils.h>
#include "Platform.h"
#include "settings/SettingsObject.h" #include "settings/SettingsObject.h"
#include "MultiMC.h" #include "MultiMC.h"

View File

@ -30,7 +30,6 @@
#include "MultiMC.h" #include "MultiMC.h"
#include "settings/SettingsObject.h" #include "settings/SettingsObject.h"
#include "widgets/IconLabel.h" #include "widgets/IconLabel.h"
#include "Platform.h"
#include "PageContainer_p.h" #include "PageContainer_p.h"
#include <MultiMC.h> #include <MultiMC.h>