2007-11-27 19:40:25 +00:00
|
|
|
/********************************************************************
|
2007-04-29 17:35:43 +00:00
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
|
|
|
|
Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
|
|
|
|
|
2007-11-27 19:40:25 +00:00
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2007-05-13 17:47:20 +00:00
|
|
|
#include "main.h"
|
2014-03-18 08:30:40 +00:00
|
|
|
#include <config-kwin.h>
|
2013-08-15 11:17:29 +00:00
|
|
|
// kwin
|
|
|
|
#include "atoms.h"
|
|
|
|
#include "options.h"
|
|
|
|
#include "sm.h"
|
|
|
|
#include "workspace.h"
|
|
|
|
|
|
|
|
// KDE
|
2014-03-17 15:24:10 +00:00
|
|
|
#include <KAboutData>
|
|
|
|
#include <KConfig>
|
|
|
|
#include <KConfigGroup>
|
|
|
|
#include <KCrash>
|
|
|
|
#include <KLocalizedString>
|
2014-03-18 13:37:01 +00:00
|
|
|
#include <KSharedConfig>
|
2013-08-15 11:17:29 +00:00
|
|
|
// Qt
|
2013-08-28 12:10:51 +00:00
|
|
|
#include <qplatformdefs.h>
|
2013-09-02 11:14:39 +00:00
|
|
|
#include <QDebug>
|
2013-08-15 10:52:37 +00:00
|
|
|
#include <QComboBox>
|
2013-08-29 14:22:30 +00:00
|
|
|
#include <qcommandlineparser.h>
|
2013-08-15 10:52:37 +00:00
|
|
|
#include <QDialog>
|
|
|
|
#include <QDialogButtonBox>
|
2007-09-27 16:22:29 +00:00
|
|
|
#include <QLabel>
|
2013-08-15 10:52:37 +00:00
|
|
|
#include <QPushButton>
|
2013-10-25 11:00:50 +00:00
|
|
|
#include <QQuickWindow>
|
2013-08-15 11:17:29 +00:00
|
|
|
#include <QStandardPaths>
|
2007-09-27 16:22:29 +00:00
|
|
|
#include <QVBoxLayout>
|
2013-08-15 11:17:29 +00:00
|
|
|
#include <QtDBus/QtDBus>
|
2012-03-30 07:54:18 +00:00
|
|
|
|
2013-08-15 11:17:29 +00:00
|
|
|
// system
|
2012-03-30 07:54:18 +00:00
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif // HAVE_UNISTD_H
|
|
|
|
|
|
|
|
#ifdef HAVE_MALLOC_H
|
|
|
|
#include <malloc.h>
|
|
|
|
#endif // HAVE_MALLOC_H
|
2007-09-27 16:22:29 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
|
|
|
Options* options;
|
|
|
|
|
|
|
|
Atoms* atoms;
|
|
|
|
|
|
|
|
int screen_number = -1;
|
2011-05-08 18:39:27 +00:00
|
|
|
bool is_multihead = false;
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-08-15 10:52:37 +00:00
|
|
|
class AlternativeWMDialog : public QDialog
|
2007-09-27 16:22:29 +00:00
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
public:
|
|
|
|
AlternativeWMDialog()
|
2013-08-15 10:52:37 +00:00
|
|
|
: QDialog() {
|
2011-01-30 14:34:42 +00:00
|
|
|
QWidget* mainWidget = new QWidget(this);
|
|
|
|
QVBoxLayout* layout = new QVBoxLayout(mainWidget);
|
|
|
|
QString text = i18n(
|
|
|
|
"KWin is unstable.\n"
|
|
|
|
"It seems to have crashed several times in a row.\n"
|
|
|
|
"You can select another window manager to run:");
|
|
|
|
QLabel* textLabel = new QLabel(text, mainWidget);
|
|
|
|
layout->addWidget(textLabel);
|
2013-08-15 10:52:37 +00:00
|
|
|
wmList = new QComboBox(mainWidget);
|
2011-01-30 14:34:42 +00:00
|
|
|
wmList->setEditable(true);
|
|
|
|
layout->addWidget(wmList);
|
|
|
|
|
2013-07-23 05:02:52 +00:00
|
|
|
addWM(QStringLiteral("metacity"));
|
|
|
|
addWM(QStringLiteral("openbox"));
|
|
|
|
addWM(QStringLiteral("fvwm2"));
|
2014-06-10 10:05:54 +00:00
|
|
|
addWM(QStringLiteral(KWIN_INTERNAL_NAME_X11));
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2013-08-15 10:52:37 +00:00
|
|
|
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
|
|
|
mainLayout->addWidget(mainWidget);
|
|
|
|
QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
|
|
|
|
buttons->button(QDialogButtonBox::Ok)->setDefault(true);
|
|
|
|
connect(buttons, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
|
|
|
connect(buttons, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
|
|
|
mainLayout->addWidget(buttons);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
raise();
|
|
|
|
}
|
2008-12-18 15:01:25 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void addWM(const QString& wm) {
|
|
|
|
// TODO: Check if WM is installed
|
2013-08-03 20:30:42 +00:00
|
|
|
if (!QStandardPaths::findExecutable(wm).isEmpty())
|
2011-01-30 14:34:42 +00:00
|
|
|
wmList->addItem(wm);
|
|
|
|
}
|
|
|
|
QString selectedWM() const {
|
|
|
|
return wmList->currentText();
|
|
|
|
}
|
2007-09-27 16:22:29 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
private:
|
2013-08-15 10:52:37 +00:00
|
|
|
QComboBox* wmList;
|
2007-09-27 16:22:29 +00:00
|
|
|
};
|
|
|
|
|
2007-09-27 14:53:52 +00:00
|
|
|
int Application::crashes = 0;
|
|
|
|
|
2014-08-12 07:08:48 +00:00
|
|
|
bool Application::isX11MultiHead()
|
|
|
|
{
|
|
|
|
return is_multihead;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Application::setX11MultiHead(bool multiHead)
|
|
|
|
{
|
|
|
|
is_multihead = multiHead;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Application::setX11ScreenNumber(int screenNumber)
|
|
|
|
{
|
|
|
|
screen_number = screenNumber;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Application::x11ScreenNumber()
|
|
|
|
{
|
|
|
|
return screen_number;
|
|
|
|
}
|
|
|
|
|
|
|
|
Application::Application(Application::OperationMode mode, int &argc, char **argv)
|
2013-08-28 12:10:51 +00:00
|
|
|
: QApplication(argc, argv)
|
2013-07-26 05:52:56 +00:00
|
|
|
, m_eventFilter(new XcbEventFilter())
|
2013-08-28 12:10:51 +00:00
|
|
|
, m_configLock(false)
|
2014-08-12 07:08:48 +00:00
|
|
|
, m_operationMode(mode)
|
2013-08-28 12:10:51 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void Application::setConfigLock(bool lock)
|
|
|
|
{
|
|
|
|
m_configLock = lock;
|
|
|
|
}
|
|
|
|
|
2013-06-25 06:52:08 +00:00
|
|
|
Application::OperationMode Application::operationMode() const
|
|
|
|
{
|
|
|
|
return m_operationMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Application::setOperationMode(OperationMode mode)
|
|
|
|
{
|
|
|
|
m_operationMode = mode;
|
|
|
|
}
|
|
|
|
|
2013-06-25 07:53:45 +00:00
|
|
|
bool Application::shouldUseWaylandForCompositing() const
|
|
|
|
{
|
|
|
|
return m_operationMode == OperationModeWaylandAndX11;
|
|
|
|
}
|
|
|
|
|
2013-06-25 08:39:13 +00:00
|
|
|
bool Application::requiresCompositing() const
|
|
|
|
{
|
|
|
|
return shouldUseWaylandForCompositing();
|
|
|
|
}
|
|
|
|
|
2013-08-28 12:10:51 +00:00
|
|
|
void Application::start()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
setQuitOnLastWindowClosed(false);
|
2013-08-28 12:10:51 +00:00
|
|
|
|
2013-09-04 14:10:36 +00:00
|
|
|
KSharedConfig::Ptr config = KSharedConfig::openConfig();
|
2013-08-28 12:10:51 +00:00
|
|
|
if (!config->isImmutable() && m_configLock) {
|
2009-10-05 06:59:10 +00:00
|
|
|
// TODO: This shouldn't be necessary
|
2008-12-18 15:01:25 +00:00
|
|
|
//config->setReadOnly( true );
|
2007-04-29 17:35:43 +00:00
|
|
|
config->reparseConfiguration();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-11-13 09:23:45 +00:00
|
|
|
crashChecking();
|
2013-09-10 10:26:18 +00:00
|
|
|
|
2014-08-12 07:08:48 +00:00
|
|
|
performStartup();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
Application::~Application()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
delete options;
|
|
|
|
delete atoms;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-09-10 10:26:18 +00:00
|
|
|
void Application::crashChecking()
|
|
|
|
{
|
|
|
|
KCrash::setEmergencySaveFunction(Application::crashHandler);
|
|
|
|
if (crashes >= 4) {
|
|
|
|
// Something has gone seriously wrong
|
|
|
|
AlternativeWMDialog dialog;
|
2014-06-10 10:05:54 +00:00
|
|
|
QString cmd = QStringLiteral(KWIN_INTERNAL_NAME_X11);
|
2013-09-10 10:26:18 +00:00
|
|
|
if (dialog.exec() == QDialog::Accepted)
|
|
|
|
cmd = dialog.selectedWM();
|
|
|
|
else
|
|
|
|
::exit(1);
|
|
|
|
if (cmd.length() > 500) {
|
|
|
|
qDebug() << "Command is too long, truncating";
|
|
|
|
cmd = cmd.left(500);
|
|
|
|
}
|
|
|
|
qDebug() << "Starting" << cmd << "and exiting";
|
|
|
|
char buf[1024];
|
|
|
|
sprintf(buf, "%s &", cmd.toAscii().data());
|
|
|
|
system(buf);
|
|
|
|
::exit(1);
|
|
|
|
}
|
|
|
|
if (crashes >= 2) {
|
|
|
|
// Disable compositing if we have had too many crashes
|
|
|
|
qDebug() << "Too many crashes recently, disabling compositing";
|
|
|
|
KConfigGroup compgroup(KSharedConfig::openConfig(), "Compositing");
|
|
|
|
compgroup.writeEntry("Enabled", false);
|
|
|
|
}
|
|
|
|
// Reset crashes count if we stay up for more that 15 seconds
|
|
|
|
QTimer::singleShot(15 * 1000, this, SLOT(resetCrashesCount()));
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
bool Application::notify(QObject* o, QEvent* e)
|
|
|
|
{
|
|
|
|
if (Workspace::self()->workspaceEvent(e))
|
2007-04-29 17:35:43 +00:00
|
|
|
return true;
|
2013-08-28 12:10:51 +00:00
|
|
|
return QApplication::notify(o, e);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void Application::crashHandler(int signal)
|
|
|
|
{
|
2007-09-27 14:53:52 +00:00
|
|
|
crashes++;
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
fprintf(stderr, "Application::crashHandler() called with signal %d; recent crashes: %d\n", signal, crashes);
|
2007-09-27 14:53:52 +00:00
|
|
|
char cmd[1024];
|
2011-01-30 14:34:42 +00:00
|
|
|
sprintf(cmd, "%s --crashes %d &",
|
|
|
|
QFile::encodeName(QCoreApplication::applicationFilePath()).constData(), crashes);
|
2007-09-27 14:53:52 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
sleep(1);
|
|
|
|
system(cmd);
|
|
|
|
}
|
2007-09-27 14:53:52 +00:00
|
|
|
|
|
|
|
void Application::resetCrashesCount()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-09-27 14:53:52 +00:00
|
|
|
crashes = 0;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-09-27 14:53:52 +00:00
|
|
|
|
2013-08-28 12:10:51 +00:00
|
|
|
void Application::setCrashCount(int count)
|
|
|
|
{
|
|
|
|
crashes = count;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Application::wasCrash()
|
|
|
|
{
|
|
|
|
return crashes > 0;
|
|
|
|
}
|
|
|
|
|
2014-08-12 07:08:48 +00:00
|
|
|
static const char description[] = I18N_NOOP("KDE window manager");
|
|
|
|
|
|
|
|
void Application::createAboutData()
|
2013-07-26 05:52:56 +00:00
|
|
|
{
|
2014-08-12 07:08:48 +00:00
|
|
|
KAboutData aboutData(QStringLiteral(KWIN_NAME), // The program name used internally
|
|
|
|
i18n("KWin"), // A displayable program name string
|
|
|
|
QStringLiteral(KWIN_VERSION_STRING), // The program version string
|
|
|
|
i18n(description), // Short description of what the app does
|
|
|
|
KAboutLicense::GPL, // The license this code is released under
|
|
|
|
i18n("(c) 1999-2013, The KDE Developers")); // Copyright Statement
|
|
|
|
|
|
|
|
aboutData.addAuthor(i18n("Matthias Ettrich"), QString(), QStringLiteral("ettrich@kde.org"));
|
|
|
|
aboutData.addAuthor(i18n("Cristian Tibirna"), QString(), QStringLiteral("tibirna@kde.org"));
|
|
|
|
aboutData.addAuthor(i18n("Daniel M. Duley"), QString(), QStringLiteral("mosfet@kde.org"));
|
|
|
|
aboutData.addAuthor(i18n("Luboš Luňák"), QString(), QStringLiteral("l.lunak@kde.org"));
|
|
|
|
aboutData.addAuthor(i18n("Martin Gräßlin"), i18n("Maintainer"), QStringLiteral("mgraesslin@kde.org"));
|
|
|
|
KAboutData::setApplicationData(aboutData);
|
2013-07-26 05:52:56 +00:00
|
|
|
}
|
|
|
|
|
2014-08-12 07:08:48 +00:00
|
|
|
static const QString s_lockOption = QStringLiteral("lock");
|
|
|
|
static const QString s_crashesOption = QStringLiteral("crashes");
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2014-08-12 07:08:48 +00:00
|
|
|
void Application::setupCommandLine(QCommandLineParser *parser)
|
|
|
|
{
|
|
|
|
QCommandLineOption lockOption(s_lockOption, i18n("Disable configuration options"));
|
|
|
|
QCommandLineOption crashesOption(s_crashesOption, i18n("Indicate that KWin has recently crashed n times"), QStringLiteral("n"));
|
|
|
|
|
|
|
|
parser->setApplicationDescription(i18n("KDE window manager"));
|
|
|
|
parser->addVersionOption();
|
|
|
|
parser->addHelpOption();
|
|
|
|
parser->addOption(lockOption);
|
|
|
|
parser->addOption(crashesOption);
|
|
|
|
KAboutData::applicationData().setupCommandLine(parser);
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2014-08-12 07:08:48 +00:00
|
|
|
void Application::processCommandLine(QCommandLineParser *parser)
|
|
|
|
{
|
|
|
|
setConfigLock(parser->isSet(s_lockOption));
|
|
|
|
Application::setCrashCount(parser->value(s_crashesOption).toInt());
|
|
|
|
}
|
|
|
|
|
|
|
|
void Application::registerDBusService()
|
|
|
|
{
|
|
|
|
QString appname;
|
|
|
|
if (x11ScreenNumber() == 0)
|
|
|
|
appname = QStringLiteral("org.kde.kwin");
|
|
|
|
else
|
|
|
|
appname.sprintf("org.kde.kwin-screen-%d", KWin::Application::x11ScreenNumber());
|
|
|
|
|
|
|
|
QDBusConnection::sessionBus().interface()->registerService(
|
|
|
|
appname, QDBusConnectionInterface::DontQueueService);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Application::setupTranslator()
|
|
|
|
{
|
|
|
|
QTranslator qtTranslator;
|
|
|
|
qtTranslator.load("qt_" + QLocale::system().name(),
|
|
|
|
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
|
|
|
installTranslator(&qtTranslator);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Application::setupMalloc()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2012-03-30 07:54:18 +00:00
|
|
|
#ifdef M_TRIM_THRESHOLD
|
|
|
|
// Prevent fragmentation of the heap by malloc (glibc).
|
|
|
|
//
|
|
|
|
// The default threshold is 128*1024, which can result in a large memory usage
|
|
|
|
// due to fragmentation especially if we use the raster graphicssystem. On the
|
|
|
|
// otherside if the threshold is too low, free() starts to permanently ask the kernel
|
|
|
|
// about shrinking the heap.
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
const int pagesize = sysconf(_SC_PAGESIZE);
|
|
|
|
#else
|
|
|
|
const int pagesize = 4*1024;
|
|
|
|
#endif // HAVE_UNISTD_H
|
|
|
|
mallopt(M_TRIM_THRESHOLD, 5*pagesize);
|
|
|
|
#endif // M_TRIM_THRESHOLD
|
2014-08-12 07:08:48 +00:00
|
|
|
}
|
2011-05-21 12:32:30 +00:00
|
|
|
|
2014-08-12 07:08:48 +00:00
|
|
|
void Application::setupLocalizedString()
|
|
|
|
{
|
2014-04-29 06:51:04 +00:00
|
|
|
KLocalizedString::setApplicationDomain("kwin");
|
2014-08-12 07:08:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Application::setupLoggingCategoryFilters()
|
|
|
|
{
|
2013-11-29 05:18:28 +00:00
|
|
|
QLoggingCategory::setFilterRules(QStringLiteral("aurorae.debug = true\n") +
|
|
|
|
QStringLiteral("kwineffects.debug = true"));
|
2014-08-12 07:08:48 +00:00
|
|
|
}
|
2013-11-25 13:55:58 +00:00
|
|
|
|
2014-08-12 07:08:48 +00:00
|
|
|
void Application::notifyKSplash()
|
|
|
|
{
|
|
|
|
// Tell KSplash that KWin has started
|
|
|
|
QDBusMessage ksplashProgressMessage = QDBusMessage::createMethodCall(QStringLiteral("org.kde.KSplash"),
|
|
|
|
QStringLiteral("/KSplash"),
|
|
|
|
QStringLiteral("org.kde.KSplash"),
|
|
|
|
QStringLiteral("setStage"));
|
|
|
|
ksplashProgressMessage.setArguments(QList<QVariant>() << QStringLiteral("wm"));
|
|
|
|
QDBusConnection::sessionBus().asyncCall(ksplashProgressMessage);
|
|
|
|
}
|
2011-05-08 18:39:27 +00:00
|
|
|
|
2014-08-12 07:08:48 +00:00
|
|
|
void Application::createWorkspace()
|
|
|
|
{
|
|
|
|
// ensure the helper atoms are retrieved before we create the Workspace
|
|
|
|
atoms->retrieveHelpers();
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2014-08-12 07:08:48 +00:00
|
|
|
// we want all QQuickWindows with an alpha buffer, do here as Workspace might create QQuickWindows
|
|
|
|
QQuickWindow::setDefaultAlphaBuffer(true);
|
2008-12-18 15:01:25 +00:00
|
|
|
|
2014-08-12 07:08:48 +00:00
|
|
|
// This tries to detect compositing options and can use GLX. GLX problems
|
|
|
|
// (X errors) shouldn't cause kwin to abort, so this is out of the
|
|
|
|
// critical startup section where x errors cause kwin to abort.
|
2010-06-13 20:22:50 +00:00
|
|
|
|
2014-08-12 07:08:48 +00:00
|
|
|
// create workspace.
|
|
|
|
(void) new Workspace(isSessionRestored());
|
|
|
|
}
|
2014-03-09 11:37:21 +00:00
|
|
|
|
2014-08-12 07:08:48 +00:00
|
|
|
void Application::createAtoms()
|
|
|
|
{
|
|
|
|
atoms = new Atoms;
|
|
|
|
}
|
2013-08-28 12:10:51 +00:00
|
|
|
|
2014-08-12 07:08:48 +00:00
|
|
|
void Application::createOptions()
|
|
|
|
{
|
|
|
|
options = new Options;
|
|
|
|
}
|
2014-06-04 13:59:03 +00:00
|
|
|
|
2014-08-12 07:08:48 +00:00
|
|
|
void Application::setupEventFilters()
|
|
|
|
{
|
|
|
|
installNativeEventFilter(m_eventFilter.data());
|
|
|
|
}
|
2013-08-28 12:10:51 +00:00
|
|
|
|
2014-08-12 07:08:48 +00:00
|
|
|
void Application::destroyWorkspace()
|
|
|
|
{
|
|
|
|
delete Workspace::self();
|
|
|
|
}
|
2013-08-28 12:10:51 +00:00
|
|
|
|
2014-08-12 07:08:48 +00:00
|
|
|
bool XcbEventFilter::nativeEventFilter(const QByteArray &eventType, void *message, long int *result)
|
|
|
|
{
|
|
|
|
Q_UNUSED(result)
|
|
|
|
if (!Workspace::self()) {
|
|
|
|
// Workspace not yet created
|
|
|
|
return false;
|
2014-03-09 11:37:21 +00:00
|
|
|
}
|
2014-08-12 07:08:48 +00:00
|
|
|
if (eventType != "xcb_generic_event_t") {
|
|
|
|
return false;
|
2014-03-09 11:37:21 +00:00
|
|
|
}
|
2014-08-12 07:08:48 +00:00
|
|
|
return Workspace::self()->workspaceEvent(static_cast<xcb_generic_event_t *>(message));
|
2010-05-31 21:24:40 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2014-08-15 12:03:52 +00:00
|
|
|
static bool s_useLibinput = false;
|
|
|
|
|
|
|
|
void Application::setUseLibinput(bool use)
|
|
|
|
{
|
|
|
|
s_useLibinput = use;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Application::usesLibinput()
|
|
|
|
{
|
|
|
|
return s_useLibinput;
|
|
|
|
}
|
|
|
|
|
2014-08-12 07:08:48 +00:00
|
|
|
} // namespace
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
#include "main.moc"
|