Changeset View
Changeset View
Standalone View
Standalone View
kcms/touchpadx/src/touchpadbackend.cpp
- This file was copied from kcms/touchpad/src/touchpadbackend.cpp.
Show All 14 Lines | |||||
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | #include "touchpadbackend.h" | 20 | #include "touchpadbackend.h" | ||
21 | 21 | | |||
22 | #include "backends/x11/xlibbackend.h" | 22 | #include "backends/x11/xlibbackend.h" | ||
23 | #include "backends/kwin_wayland/kwinwaylandbackend.h" | | |||
24 | #include "logging.h" | 23 | #include "logging.h" | ||
25 | 24 | | |||
26 | #include <QThreadStorage> | 25 | #include <QThreadStorage> | ||
27 | #include <QSharedPointer> | 26 | #include <QSharedPointer> | ||
28 | 27 | | |||
29 | #include <KWindowSystem/kwindowsystem.h> | 28 | #include <KWindowSystem/kwindowsystem.h> | ||
30 | 29 | | |||
31 | TouchpadBackend *TouchpadBackend::implementation() | 30 | TouchpadBackend *TouchpadBackend::implementation() | ||
32 | { | 31 | { | ||
33 | //There are multiple possible backends | 32 | //There are multiple possible backends | ||
34 | if (KWindowSystem::isPlatformX11()) { | 33 | if (KWindowSystem::isPlatformX11()) { | ||
35 | static QThreadStorage<QSharedPointer<XlibBackend> > backend; | 34 | static QThreadStorage<QSharedPointer<XlibBackend> > backend; | ||
36 | if (!backend.hasLocalData()) { | 35 | if (!backend.hasLocalData()) { | ||
37 | qCDebug(KCM_TOUCHPAD) << "Using X11 backend"; | 36 | qCDebug(KCM_TOUCHPAD) << "Using X11 backend"; | ||
38 | backend.setLocalData(QSharedPointer<XlibBackend>(XlibBackend::initialize())); | 37 | backend.setLocalData(QSharedPointer<XlibBackend>(XlibBackend::initialize())); | ||
39 | } | 38 | } | ||
40 | return backend.localData().data(); | 39 | return backend.localData().data(); | ||
41 | } | 40 | } | ||
42 | // TODO: test on kwin_wayland specifically? What about possibly other compositors under Wayland? | | |||
43 | else if (KWindowSystem::isPlatformWayland()) { | | |||
44 | qCDebug(KCM_TOUCHPAD) << "Using KWin+Wayland backend"; | | |||
45 | return (new KWinWaylandBackend()); | | |||
46 | } | | |||
47 | else { | 41 | else { | ||
48 | qCCritical(KCM_TOUCHPAD) << "Not able to select appropriate backend."; | 42 | qCCritical(KCM_TOUCHPAD) << "Not able to select appropriate backend."; | ||
49 | return nullptr; | 43 | return nullptr; | ||
50 | } | 44 | } | ||
51 | } | 45 | } |