Fix MainWindow Icon; Fix WM_CLASS issue; now links QX11Extras and libxcb on linux
This commit is contained in:
parent
205570be32
commit
78882ff6b1
@ -350,6 +350,15 @@ IF(WIN32)
|
||||
SET(MULTIMC_RCS multimc.rc)
|
||||
ENDIF()
|
||||
|
||||
####### X11 Stuff #######
|
||||
IF(UNIX AND NOT APPLE)
|
||||
SET(MultiMC_QT_ADDITIONAL_MODULES ${MultiMC_QT_ADDITIONAL_MODULES} X11Extras)
|
||||
SET(MultiMC_LINK_ADDITIONAL_LIBS ${MultiMC_LINK_ADDITIONAL_LIBS} xcb)
|
||||
LIST(APPEND MULTIMC_SOURCES gui/platform_x11.cpp)
|
||||
ELSE()
|
||||
LIST(APPEND MULTIMC_SOURCES gui/platform_other.cpp)
|
||||
ENDIF()
|
||||
|
||||
|
||||
################################ COMPILE ################################
|
||||
|
||||
@ -380,7 +389,7 @@ ADD_EXECUTABLE(MultiMC MACOSX_BUNDLE WIN32
|
||||
|
||||
# Link
|
||||
TARGET_LINK_LIBRARIES(MultiMC xz-embedded unpack200 quazip libUtil libSettings libGroupView ${MultiMC_LINK_ADDITIONAL_LIBS})
|
||||
QT5_USE_MODULES(MultiMC Core Widgets Network Xml)
|
||||
QT5_USE_MODULES(MultiMC Core Widgets Network Xml ${MultiMC_QT_ADDITIONAL_MODULES})
|
||||
ADD_DEPENDENCIES(MultiMC MultiMCLauncher)
|
||||
|
||||
option(BUILD_KEYRING_TEST "Build the simple keyring test binary" OFF)
|
||||
|
@ -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));
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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
|
||||
|
@ -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!
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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));
|
||||
|
@ -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()));
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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()));
|
||||
|
||||
|
@ -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">
|
||||
|
@ -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);
|
||||
|
35
gui/platform.h
Normal file
35
gui/platform.h
Normal file
@ -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
|
27
gui/platform_other.cpp
Normal file
27
gui/platform_other.cpp
Normal file
@ -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
|
||||
*/
|
||||
MultiMCPlatform::fixWM_CLASS(QWidget *widget)
|
||||
{
|
||||
Q_UNUSED(widget);
|
||||
}
|
62
gui/platform_x11.cpp
Normal file
62
gui/platform_x11.cpp
Normal file
@ -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());
|
||||
}
|
@ -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());
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user