swift
keyboard.cpp
1 // SPDX-FileCopyrightText: Copyright (C) 2013 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
4 #include "keyboard.h"
5 
6 #if defined(Q_OS_WIN)
7 # include "win/keyboardwindows.h"
8 #elif defined(Q_OS_LINUX)
9 # include "linux/keyboardlinux.h"
10 #elif defined(Q_OS_MACOS)
11 # include "macos/keyboardmacos.h"
12 #else
13 # error "Platform is not supported!"
14 #endif
15 
16 namespace swift::input
17 {
18  IKeyboard::IKeyboard(QObject *parent) : QObject(parent) {}
19 
20  std::unique_ptr<IKeyboard> IKeyboard::create(QObject *parent)
21  {
22 #if defined(Q_OS_WIN)
23  std::unique_ptr<IKeyboard> ptr(new CKeyboardWindows(parent));
24 #elif defined(Q_OS_LINUX)
25  std::unique_ptr<IKeyboard> ptr(new CKeyboardLinux(parent));
26 #elif defined(Q_OS_MACOS)
27  std::unique_ptr<IKeyboard> ptr(new CKeyboardMacOS(parent));
28 #endif
29  ptr->init();
30  return ptr;
31  }
32 } // namespace swift::input
Linux implemenation of IKeyboard using hook procedure.
Definition: keyboardlinux.h:24
MacOS implemenation of IKeyboard using hook procedure.
Definition: keyboardmacos.h:22
Windows implemenation of IKeyboard using hook procedure.
IKeyboard(QObject *parent=nullptr)
Constructor.
Definition: keyboard.cpp:18
static std::unique_ptr< IKeyboard > create(QObject *parent=nullptr)
Creates a native keyboard handler object.
Definition: keyboard.cpp:20