File indexing completed on 2024-05-12 05:35:48
0001 /* 0002 SPDX-FileCopyrightText: 1999 Matthias Hoelzer-Kluepfel <hoelzer@kde.org> 0003 SPDX-FileCopyrightText: 2005 Lubos Lunak <l.lunak@kde.org> 0004 SPDX-FileCopyrightText: 2017 Xuetian Weng <wengxt@gmail.com> 0005 SPDX-FileCopyrightText: 2018 Roman Gilg <subdiff@gmail.com> 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 0010 #include "backends/x11/x11_backend.h" 0011 0012 #include <KWindowSystem> 0013 0014 #include <QDebug> 0015 #include <QFile> 0016 #include <QGuiApplication> 0017 #include <memory> // std::unique_ptr 0018 0019 int main(int argc, char *argv[]) 0020 { 0021 int ret = 0; 0022 QGuiApplication::setDesktopSettingsAware(false); 0023 QGuiApplication app(argc, argv); 0024 if (argc != 3) 0025 return 1; 0026 QString theme = QFile::decodeName(argv[1]); 0027 QString size = QFile::decodeName(argv[2]); 0028 0029 if (!KWindowSystem::isPlatformX11()) { 0030 qDebug() << "X11 backend not detected. Exit."; 0031 return 2; 0032 } 0033 0034 std::unique_ptr<X11Backend> backend(X11Backend::implementation()); 0035 0036 if (!backend) { 0037 return 2; 0038 } 0039 0040 if (!backend->isValid()) { 0041 return 2; 0042 } 0043 0044 // Note: If you update this code, update main.cpp as well. 0045 0046 backend->applyCursorTheme(theme, size.toInt()); 0047 0048 return ret; 0049 }