Commit Graph

88 Commits

Author SHA1 Message Date
liulinsong 2450f9dede 删除主动增加的38px的y轴偏移量
通过Kylin SDK获取的窗口坐标会考虑窗口是否启用了标题栏,
并根据是否存在标题栏返回相应的窗口坐标。可以简单的理解为
窗口坐标指的是不包含标题栏的窗口左上角的坐标。因此,不再
需要表示标题栏高度的38px了。这样的话,可以避免在应用程序
禁用了窗口标题栏后输入窗口偏下的问题
2025-04-10 15:52:28 +08:00
hantengc 172bbaab5c 使用kysdk提供的接口获取当前窗口基于屏幕的坐标信息,解决输入法无法正确获取坐标的问题 2025-04-10 15:52:15 +08:00
Weng Xuetian 35c678c17d
Clang-tidy cleanup 2024-02-28 15:59:27 -08:00
Weng Xuetian f04cf9a501
Clang-format 2024-02-26 17:58:47 -08:00
He Yong 1cf2a2b357 Add ENABLE_X11 option
it`s easy to port to a pure Wayland environment
that we split the code of x11
2023-12-01 10:39:09 -08:00
oldherl 7b82525b4a use QTimer::singleShot with lambda 2023-11-18 08:24:19 -08:00
oldherl 924577069f Fix build on older Qt5
Get rid of the new overloaded QMetaObject::invokeMethod from Qt 5.10.
This enables building the plugin-only on Qt 5.5, and rest of the project
on Qt 5.7.
(REQUIRED_QT5_VERSION 5.1.0) in cmake is wrong and is updated accordingly.
2023-11-18 08:24:19 -08:00
Weng Xuetian e19b1bdd86
Defer watcher's watch() to event loop.
QFileSystemWatcher seems to be not happy to be created within
QPlatformInputContext's constructor, defer and always re-create when
watch and unwatch.

Fix #46.
2023-09-03 22:02:19 -07:00
Weng Xuetian 5178d35716
Add old fcitx4 dbus service support, but always prefer the fcitx5 version first. 2023-08-10 17:31:38 -07:00
unknown f13bebc68e add support of virtualkeyboard show and hide 2023-07-31 15:07:48 -07:00
liulinsong 9a9571e1a0
The input method is disabled only if it's really needed (#39)
When QPlatformInputContext object does not support input method and
the focus object/focus object wrapper do not support input method,
it's really needed to disable it.
2023-02-19 19:56:03 -08:00
Weng Xuetian 1d50b4e6e1
Hack the event filter to commitPreedit for kate part, konsole, and libreoffice.
The hack we does here will break invokeAction, but those case doesn't
support invokeAction anyway. Also, gtk doesn't support invoke action and
there's only one engine can do it (pinyin), so doesn't really matter if
we break it.

But the code here is fragile to class name change in those applications,
so ultimately, we should fix them instead.

Fix fcitx/fcitx5-unikey#35
2022-12-20 08:19:43 -08:00
Weng Xuetian 1b2022e869
Implement QPlatformInputContext::commit (fcitx/fcitx5-unikey#35)
Actually this seems to be the place where qt request commit preedit but
we have been ignore it.
2022-12-20 06:37:20 -08:00
Weng Xuetian 7e91e9b97c
update surrounding need to happen if any of surrounding value changes. 2022-12-19 17:40:07 -08:00
Weng Xuetian 4290bf272e
Implement notifyFocusOut signal for fcitx/fcitx5#687
When focus out happens on server side, make sure we can also commit preedit.
2022-12-15 18:23:41 -08:00
liulinsong 224fb0a6a1
Use focusObjectWrapper to get the real focus object. (#37) 2022-11-26 20:53:30 -08:00
liulinsong 61d89ce511
Suppress a compiler warning. (#36) 2022-11-26 15:00:49 -08:00
liulinsong 584b81e07a
Fix the condition when real focus doesn't change (#35)
Co-authored-by: Weng Xuetian <wengxt@gmail.com>
2022-11-26 14:35:46 -08:00
Weng Xuetian 0015de3a0d
Refactor the implementation to use focusProxy directly.
The reason of this is that: focusWidgetChanged arrives after
setFocusObject. This makes QApplication::focusWidget value out of date
at the point of setFocusObject. The qwidget logic is actually simple
enough (see QWidgetPrivate::deepestFocusProxy), just use the same logic
here.
2022-11-25 11:10:27 -08:00
Weng Xuetian fbc5f69b74
Try to workaround inconsistency if QWidget focus proxy is used. 2022-11-22 17:21:58 -08:00
Weng Xuetian 53aa175051
Force update enable / disable state upon focus or key event.
Qt does not always notify us about input method accept change, need to
poll the update to ensure the value is up to date.
2022-11-18 11:24:05 -08:00
liulinsong d396b48d15
Notify fcitx of the focus event even if the focus object does not support IM. (#34)
This will make use of a new capability flag Disable to indicate that ic doesn't want input method.
filterEvent has another check for not forwarding the event, so it should be ok that no key will reach fcitx.
2022-11-15 14:08:42 -08:00
Weng Xuetian 13d16541df
use ucs4 offset for invokeAction 2022-05-27 10:13:58 -07:00
Ka Ho Ng f7f983e1e7
Fix compilation error for qfcitxplatforminputcontext.cpp (#27)
The compilation error happens in FreeBSD CURRENT 610d908f8a6.

Error:
	/wrkdir/textproc/fcitx5-qt/work/fcitx5-qt-5.0.7/qt5/platforminputcontext/qfcitxplatforminputcontext.cpp:973:31: error: implicit instantiation of undefined template 'std::array<char, 256>'
	        std::array<char, 256> buffer;
	                              ^
	/usr/include/c++/v1/__tuple:219:64: note: template is declared here
	template <class _Tp, size_t _Size> struct _LIBCPP_TEMPLATE_VIS array;

This fix adds #include <array> to the affected source file.
2021-12-08 12:50:32 -08:00
Weng Xuetian 1f5d876711
Clear commitPreedit before sending the event.
QCoreApplication::sendEvent may trigger reentrant commitPreedit. We need
to clear commitPreedit before call sendEvent.

Fix #26.
2021-12-07 18:53:13 -08:00
Weng Xuetian 62650f4534
Implement InvokeAction. 2021-11-23 17:44:02 -08:00
Weng Xuetian a2f8c69293
Use old qt API to use invokeMethod. 2021-04-08 18:52:27 -07:00
Weng Xuetian c9fbdd0321
Exclude auto repeat bit. 2021-03-22 11:05:37 -07:00
Weng Xuetian 6fb3778699
clean up the code by removing the "wid" property.
icData already has the window information.
2021-03-05 07:42:32 -08:00
Weng Xuetian 58f60459d0
ensure we clear the ui upon fcitx exit and focus out. 2021-02-17 17:18:43 -08:00
Weng Xuetian ffefd6df93
Use the new flag for client side input panel. 2021-01-23 07:51:07 -08:00
Weng Xuetian d22e9455d7
Add client side ui support for im module and dbusaddons 2021-01-21 20:52:06 -08:00
Weng Xuetian dea97f6ff1
Detect more wayland platform with platform.startsWith("wayland") 2021-01-18 20:57:38 -08:00
Weng Xuetian 9f2e2e984c
Increase the buffer size of compose.
This should not be a problem for the current default XCompose profile,
but we should still increase the buffer size.

fcitx/fcitx5#198
2021-01-06 09:17:44 -08:00
Weng Xuetian b1883a57f2
Fix qt6 compatibility issue 2020-12-08 21:14:23 -08:00
Weng Xuetian 1c155eae30
Fix delete surounding text boundary check 2020-12-08 21:14:09 -08:00
Weng Xuetian 29a82227bb
Send key repeat information to fcitx. 2020-12-08 09:53:29 -08:00
Weng Xuetian ffa3f9ac7a
Use timestamp for actual events instead of get time. 2020-12-08 09:13:34 -08:00
Weng Xuetian 6a3b6c6717
Replace uint with unsigned int 2020-12-06 16:01:41 -08:00
Weng Xuetian 97ea203b40
Workaround a self-recursion issue in libreoffice.
QInputMethod::cursorRectangle may cause setFocus in libreoffice,
delegate it to main event loop to avoid recursion.
2020-10-28 17:23:43 -07:00
Weng Xuetian b3b0245ce3
Add qt6 support. 2020-10-06 17:15:39 -07:00
Weng Xuetian 1e7b694b82
Add support for set cursor rect v2. 2020-09-12 10:42:41 -07:00
Weng Xuetian 91a4b144c0
Add more fix on key translation for configtool. 2020-08-02 14:53:23 -07:00
ilya-fedin 47628ac9f8
Get rid of QtX11Extras (#8) 2020-07-31 12:31:55 -07:00
Weng Xuetian 123301896a
Use handleExtendedKeyEvent instead of sendEvent for forward event. 2020-05-28 08:59:51 -07:00
Weng Xuetian b8a4eb2dda
Consider frame margin for position on wayland. 2020-05-26 15:06:27 -07:00
Weng Xuetian 1f3d4862c7
Add flag for key event order fix. 2020-05-26 00:17:25 -07:00
Weng Xuetian 099ebd423c
Always keep a original filtered key event copy as keysym to qt reference. 2020-05-25 23:50:11 -07:00
Weng Xuetian 616a173502
Set relative cap correctly for wayland case. 2020-05-23 21:46:58 -07:00
Weng Xuetian b4d9cb2439 Don't run focus in on input method disabled window 2020-05-18 09:54:03 -07:00