File: testim.cpp

package info (click to toggle)
fcitx5 5.1.17-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 17,356 kB
  • sloc: cpp: 75,670; sh: 1,770; xml: 1,545; python: 1,052; ansic: 71; makefile: 11
file content (35 lines) | stat: -rw-r--r-- 855 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
 * SPDX-FileCopyrightText: 2020-2020 CSSlayer <wengxt@gmail.com>
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 *
 */
#include "testim.h"
#include "fcitx/addonfactory.h"
#include "fcitx/addonmanager.h"

namespace fcitx {

TestIM::TestIM(Instance *instance) : instance_(instance) {}

TestIM::~TestIM() {}

void TestIM::keyEvent(const InputMethodEntry &entry, KeyEvent &keyEvent) {
    FCITX_INFO() << "IM " << entry.uniqueName()
                 << " received event: " << keyEvent.key().toString()
                 << keyEvent.isRelease();
    if (handler_) {
        handler_(entry, keyEvent);
    }
}

class TestIMFactory : public AddonFactory {
public:
    AddonInstance *create(AddonManager *manager) override {
        return new TestIM(manager->instance());
    }
};

} // namespace fcitx

FCITX_ADDON_FACTORY_V2(testim, fcitx::TestIMFactory);