Clang-format
This commit is contained in:
parent
50d5612b98
commit
f04cf9a501
|
@ -21,7 +21,8 @@
|
|||
#include <QtMath>
|
||||
#include <utility>
|
||||
|
||||
#if defined(FCITX_ENABLE_QT6_WAYLAND_WORKAROUND) && QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)
|
||||
#if defined(FCITX_ENABLE_QT6_WAYLAND_WORKAROUND) && \
|
||||
QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)
|
||||
#include <QtWaylandClient/private/qwayland-xdg-shell.h>
|
||||
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
|
||||
#include <QtWaylandClient/private/qwaylandintegration_p.h>
|
||||
|
@ -34,7 +35,8 @@ namespace fcitx {
|
|||
|
||||
namespace {
|
||||
|
||||
#if defined(FCITX_ENABLE_QT6_WAYLAND_WORKAROUND) && QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)
|
||||
#if defined(FCITX_ENABLE_QT6_WAYLAND_WORKAROUND) && \
|
||||
QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)
|
||||
class XdgWmBase : public QtWayland::xdg_wm_base {
|
||||
public:
|
||||
using xdg_wm_base::xdg_wm_base;
|
||||
|
@ -120,7 +122,8 @@ FcitxCandidateWindow::FcitxCandidateWindow(QWindow *window,
|
|||
// Not using Qt::BypassWindowManagerHint ensures wayland handle
|
||||
// fractional scale.
|
||||
setFlags(Qt::ToolTip | commonFlags);
|
||||
#if defined(FCITX_ENABLE_QT6_WAYLAND_WORKAROUND) && QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)
|
||||
#if defined(FCITX_ENABLE_QT6_WAYLAND_WORKAROUND) && \
|
||||
QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)
|
||||
if (auto instance = QtWaylandClient::QWaylandIntegration::instance()) {
|
||||
for (QtWaylandClient::QWaylandDisplay::RegistryGlobal global :
|
||||
instance->display()->globals()) {
|
||||
|
@ -489,7 +492,8 @@ void FcitxCandidateWindow::updateClientSideUI(
|
|||
QRect cursorRect = context_->cursorRectangleWrapper();
|
||||
QRect screenGeometry;
|
||||
|
||||
#if defined(FCITX_ENABLE_QT6_WAYLAND_WORKAROUND) && QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)
|
||||
#if defined(FCITX_ENABLE_QT6_WAYLAND_WORKAROUND) && \
|
||||
QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)
|
||||
if (isWayland_) {
|
||||
auto waylandWindow =
|
||||
static_cast<QtWaylandClient::QWaylandWindow *>(window->handle());
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
#include <qscopedpointer.h>
|
||||
#include <vector>
|
||||
|
||||
#if defined(FCITX_ENABLE_QT6_WAYLAND_WORKAROUND) && QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)
|
||||
#if defined(FCITX_ENABLE_QT6_WAYLAND_WORKAROUND) && \
|
||||
QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)
|
||||
#include <QtWaylandClient/private/qwayland-xdg-shell.h>
|
||||
#endif
|
||||
|
||||
|
@ -93,7 +94,8 @@ private:
|
|||
std::vector<QRect> candidateRegions_;
|
||||
QPointer<QWindow> parent_;
|
||||
|
||||
#if defined(FCITX_ENABLE_QT6_WAYLAND_WORKAROUND) && QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)
|
||||
#if defined(FCITX_ENABLE_QT6_WAYLAND_WORKAROUND) && \
|
||||
QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)
|
||||
QScopedPointer<QtWayland::xdg_wm_base> xdgWmBase_;
|
||||
#endif
|
||||
};
|
||||
|
|
|
@ -260,13 +260,10 @@ QFcitxPlatformInputContext::QFcitxPlatformInputContext()
|
|||
|
||||
// Input context may be created without QApplication with wayland, defer it
|
||||
// to event loop to ensure event dispatcher is avaiable.
|
||||
QTimer::singleShot(
|
||||
0,
|
||||
this,
|
||||
[this]() {
|
||||
watcher_->watch();
|
||||
fcitx4Watcher_->watch();
|
||||
});
|
||||
QTimer::singleShot(0, this, [this]() {
|
||||
watcher_->watch();
|
||||
fcitx4Watcher_->watch();
|
||||
});
|
||||
}
|
||||
|
||||
QFcitxPlatformInputContext::~QFcitxPlatformInputContext() {
|
||||
|
@ -531,16 +528,14 @@ void QFcitxPlatformInputContext::setFocusObject(QObject *object) {
|
|||
proxy->focusIn();
|
||||
// We need to delegate this otherwise it may cause self-recursion in
|
||||
// certain application like libreoffice.
|
||||
QTimer::singleShot(
|
||||
0,
|
||||
this,
|
||||
[this, window = QPointer<QWindow>(lastWindow_)]() {
|
||||
if (window != lastWindow_) {
|
||||
return;
|
||||
}
|
||||
update(Qt::ImHints | Qt::ImEnabled);
|
||||
updateCursorRect();
|
||||
});
|
||||
QTimer::singleShot(0, this,
|
||||
[this, window = QPointer<QWindow>(lastWindow_)]() {
|
||||
if (window != lastWindow_) {
|
||||
return;
|
||||
}
|
||||
update(Qt::ImHints | Qt::ImEnabled);
|
||||
updateCursorRect();
|
||||
});
|
||||
}
|
||||
|
||||
updateInputPanelVisible();
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
|
||||
#include <QHash>
|
||||
#include <QString>
|
||||
#include <xkbcommon/xkbcommon.h>
|
||||
#include <ctype.h>
|
||||
#include <qnamespace.h>
|
||||
#include <unordered_map>
|
||||
#include <xkbcommon/xkbcommon.h>
|
||||
|
||||
const std::unordered_map<uint32_t, int> &KeyTbl() {
|
||||
static std::unordered_map<uint32_t, int> keyTbl{
|
||||
|
@ -168,8 +168,10 @@ const std::unordered_map<uint32_t, int> &KeyTbl() {
|
|||
std::make_pair(XKB_KEY_Hangul_PreHanja, Qt::Key_Hangul_PreHanja),
|
||||
std::make_pair(XKB_KEY_Hangul_PostHanja, Qt::Key_Hangul_PostHanja),
|
||||
std::make_pair(XKB_KEY_Hangul_SingleCandidate, Qt::Key_SingleCandidate),
|
||||
std::make_pair(XKB_KEY_Hangul_MultipleCandidate, Qt::Key_MultipleCandidate),
|
||||
std::make_pair(XKB_KEY_Hangul_PreviousCandidate, Qt::Key_PreviousCandidate),
|
||||
std::make_pair(XKB_KEY_Hangul_MultipleCandidate,
|
||||
Qt::Key_MultipleCandidate),
|
||||
std::make_pair(XKB_KEY_Hangul_PreviousCandidate,
|
||||
Qt::Key_PreviousCandidate),
|
||||
std::make_pair(XKB_KEY_Hangul_Special, Qt::Key_Hangul_Special),
|
||||
std::make_pair(XKB_KEY_Hangul_switch, Qt::Key_Mode_switch),
|
||||
std::make_pair(XKB_KEY_dead_grave, Qt::Key_Dead_Grave),
|
||||
|
@ -187,7 +189,8 @@ const std::unordered_map<uint32_t, int> &KeyTbl() {
|
|||
std::make_pair(XKB_KEY_dead_ogonek, Qt::Key_Dead_Ogonek),
|
||||
std::make_pair(XKB_KEY_dead_iota, Qt::Key_Dead_Iota),
|
||||
std::make_pair(XKB_KEY_dead_voiced_sound, Qt::Key_Dead_Voiced_Sound),
|
||||
std::make_pair(XKB_KEY_dead_semivoiced_sound, Qt::Key_Dead_Semivoiced_Sound),
|
||||
std::make_pair(XKB_KEY_dead_semivoiced_sound,
|
||||
Qt::Key_Dead_Semivoiced_Sound),
|
||||
std::make_pair(XKB_KEY_dead_belowdot, Qt::Key_Dead_Belowdot),
|
||||
std::make_pair(XKB_KEY_dead_hook, Qt::Key_Dead_Hook),
|
||||
std::make_pair(XKB_KEY_dead_horn, Qt::Key_Dead_Horn),
|
||||
|
@ -228,9 +231,11 @@ const std::unordered_map<uint32_t, int> &KeyTbl() {
|
|||
std::make_pair(XKB_KEY_XF86LaunchC, Qt::Key_LaunchE),
|
||||
std::make_pair(XKB_KEY_XF86LaunchD, Qt::Key_LaunchF),
|
||||
std::make_pair(XKB_KEY_XF86MonBrightnessUp, Qt::Key_MonBrightnessUp),
|
||||
std::make_pair(XKB_KEY_XF86MonBrightnessDown, Qt::Key_MonBrightnessDown),
|
||||
std::make_pair(XKB_KEY_XF86MonBrightnessDown,
|
||||
Qt::Key_MonBrightnessDown),
|
||||
std::make_pair(XKB_KEY_XF86KbdLightOnOff, Qt::Key_KeyboardLightOnOff),
|
||||
std::make_pair(XKB_KEY_XF86KbdBrightnessUp, Qt::Key_KeyboardBrightnessUp),
|
||||
std::make_pair(XKB_KEY_XF86KbdBrightnessUp,
|
||||
Qt::Key_KeyboardBrightnessUp),
|
||||
std::make_pair(XKB_KEY_XF86KbdBrightnessDown,
|
||||
Qt::Key_KeyboardBrightnessDown),
|
||||
std::make_pair(XKB_KEY_XF86PowerOff, Qt::Key_PowerOff),
|
||||
|
@ -347,7 +352,8 @@ int keysymToQtKey(uint32_t keysym, const QString &text) {
|
|||
code = isprint((int)keysym) ? toupper((int)keysym) : 0;
|
||||
} else if (text.length() == 1 && text.unicode()->unicode() > 0x1f &&
|
||||
text.unicode()->unicode() != 0x7f &&
|
||||
!(keysym >= XKB_KEY_dead_grave && keysym <= XKB_KEY_dead_currency)) {
|
||||
!(keysym >= XKB_KEY_dead_grave &&
|
||||
keysym <= XKB_KEY_dead_currency)) {
|
||||
code = text.unicode()->toUpper().unicode();
|
||||
} else {
|
||||
// any other keys
|
||||
|
|
Loading…
Reference in New Issue