File indexing completed on 2024-11-10 04:56:58

0001 /*
0002     SPDX-FileCopyrightText: 2022 David Redondo <kde@david-redono.de>
0003 
0004     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006 
0007 #include <main.h>
0008 #include <plugin.h>
0009 
0010 #include "buttonrebindsfilter.h"
0011 
0012 class KWIN_EXPORT ButtonRebindsFactory : public KWin::PluginFactory
0013 {
0014     Q_OBJECT
0015     Q_PLUGIN_METADATA(IID PluginFactory_iid FILE "metadata.json")
0016     Q_INTERFACES(KWin::PluginFactory)
0017 
0018 public:
0019     std::unique_ptr<KWin::Plugin> create() const override
0020     {
0021         switch (KWin::kwinApp()->operationMode()) {
0022         case KWin::Application::OperationModeXwayland:
0023             [[fallthrough]];
0024         case KWin::Application::OperationModeWaylandOnly:
0025             return std::make_unique<ButtonRebindsFilter>();
0026         case KWin::Application::OperationModeX11:
0027             [[fallthrough]];
0028         default:
0029             return nullptr;
0030         }
0031     }
0032 };
0033 
0034 #include "main.moc"