File indexing completed on 2024-05-12 17:07:23

0001 /*
0002     SPDX-FileCopyrightText: 2017 Xuetian Weng <wengxt@gmail.com>
0003     SPDX-FileCopyrightText: 2018 Roman Gilg <subdiff@gmail.com>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 #include "inputbackend.h"
0008 
0009 #include "backends/kwin_wl/kwin_wl_backend.h"
0010 #include "backends/x11/x11_backend.h"
0011 #include "logging.h"
0012 
0013 #include <KWindowSystem>
0014 
0015 InputBackend *InputBackend::implementation(QObject *parent)
0016 {
0017     // There are multiple possible backends
0018     if (KWindowSystem::isPlatformX11()) {
0019         qCDebug(KCM_MOUSE) << "Using X11 backend";
0020         return X11Backend::implementation(parent);
0021     } else if (KWindowSystem::isPlatformWayland()) {
0022         qCDebug(KCM_MOUSE) << "Using KWin+Wayland backend";
0023         return new KWinWaylandBackend(parent);
0024     } else {
0025         qCCritical(KCM_MOUSE) << "Not able to select appropriate backend.";
0026         return nullptr;
0027     }
0028 }