Changeset View
Changeset View
Standalone View
Standalone View
src/plugins/xcbplugin.cpp
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * This file is part of the KDE Libraries | ||||
3 | * Copyright (C) 2017 Aleix Pol Gonzalez <aleixpol@kde.org> | ||||
4 | * | ||||
5 | * This library is free software; you can redistribute it and/or | ||||
6 | * modify it under the terms of the GNU Library General Public | ||||
7 | * License as published by the Free Software Foundation; either | ||||
8 | * version 2 of the License, or (at your option) any later version. | ||||
9 | * | ||||
10 | * This library is distributed in the hope that it will be useful, | ||||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
13 | * Library General Public License for more details. | ||||
14 | * | ||||
15 | * You should have received a copy of the GNU Library General Public License | ||||
16 | * along with this library; see the file COPYING.LIB. If not, write to | ||||
17 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||||
18 | * Boston, MA 02110-1301, USA. | ||||
19 | */ | ||||
20 | | ||||
21 | #include "kcrashhandlerplugin.h" | ||||
22 | #include <QGuiApplication> | ||||
23 | #include <qx11info_x11.h> | ||||
24 | | ||||
25 | class XCBPlugin : public KCrashHandlerPlugin | ||||
26 | { | ||||
27 | Q_OBJECT\ | ||||
28 | Q_PLUGIN_METADATA(IID "org.kde.KCrashHandlerPlugin") | ||||
29 | Q_INTERFACES(KCrashHandlerPlugin) | ||||
30 | | ||||
31 | void extractHandlerArgs(QVarLengthArray<const char*, 50>& args) override; | ||||
32 | }; | ||||
33 | | ||||
34 | #include "xcbplugin.moc" | ||||
35 | | ||||
36 | #include <X11/Xlib.h> //This messes around with Bool and breaks compilation if not included after moc | ||||
37 | | ||||
38 | void XCBPlugin::extractHandlerArgs(QVarLengthArray<const char*, 50>& args) | ||||
39 | { | ||||
40 | const QString platformName = QGuiApplication::platformName(); | ||||
41 | | ||||
42 | if (platformName == QLatin1String("xcb")) { | ||||
43 | // start up on the correct display | ||||
44 | args << "-display"; | ||||
45 | if (QX11Info::display()) { | ||||
46 | args << XDisplayString(QX11Info::display()); | ||||
47 | } else { | ||||
48 | args << getenv("DISPLAY"); | ||||
49 | } | ||||
50 | } | ||||
51 | } | ||||
52 | |