Commit Graph

151 Commits

Author SHA1 Message Date
Integral 4b5516f87e
refactor: replace non-empty QString constructors with QStringLiteral() (#67) 2024-11-05 21:26:50 -08:00
Integral 8dffee60b0
refactor: use range-based for loop to enhance readability (#68) 2024-11-05 21:25:48 -08:00
Weng Xuetian b347ccf468
Fix copy-paste error that not set height when there's no intersection.
Fix #60
2024-04-21 12:55:57 -07:00
shijie.chen 24c7dfc67f [dev] Clean up unnecessary include 2024-03-19 00:00:22 -07:00
Weng Xuetian d380b6f8d0
bump version 2024-02-28 17:38:12 -08:00
Weng Xuetian 7ddbda9d6c
Use native coordinates when operating wayland protocol objects.
While in most case, Qt wayland scale is 1 (scale is on compositor side),
it is still possible to override the qt high dpi scale factor by certain
environment variables, including QT_SCALE_FACTOR and
QT_WAYLAND_FORCE_DPI.

Fix #55
2024-02-28 17:33:09 -08:00
Weng Xuetian 35c678c17d
Clang-tidy cleanup 2024-02-28 15:59:27 -08:00
Weng Xuetian 4eaea32c57
use deleteLater on QFileSystemWatcher when watching fcitx 4 file.
If the deletion is triggered from the fs change itself, delete the
watcher immediately may cause issuse.

Closes #54
2024-02-27 09:30:34 -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
He Yong e6d306ec5a Replace x11`s keysym with libxkbcommon`s keysym 2023-12-01 10:39:09 -08:00
Weng Xuetian 29b2524e12
set_reactive to the reposition 2023-11-20 12:45:32 -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 d7787f570b
Call QPaintDeviceWindow::update() when we need to update content.
In cc645075dd we accidentally removed
"rendowNow()" in updateClientSideUI. Which make the content to be old if
in certain cases. Replace requestUpdate() with update() since it will
also update some internal state of QPaintDeviceWindow and it also calls to
requestUpdate.
2023-11-17 04:59:21 -08:00
Weng Xuetian af535e7e10
Make qwayland workaround optional
Fix #50
2023-11-15 14:51:36 -08:00
Weng Xuetian 0d18743bdc
Do not use frameGeometry, use windowContentGeometry to clipping
Sometimes, Qt's internal "geometry" may not start at (0,0). While
windowContentGeometry is guarantee to be start with (0,0), and it's what
used for qt's internal xdg_positioner calculation.
2023-11-03 06:48:50 -07:00
Weng Xuetian 9c9e38f5c6
Fix build on older Qt6 2023-11-03 06:42:52 -07:00
Weng Xuetian f0bf41c71e
Also try to use the new qt 6.6 hidden window property to set the anchor.
So we don't neeed our own size calculation if we still need to use the
show hide trick (e.g. sway).
2023-11-01 07:46:46 -07:00
Weng Xuetian 21a12b892f
valid the cursor rect.
anchor rect may not like 0-size and non-intersect rect at all, e.g.
mutter.
2023-10-31 17:54:03 -07:00
Weng Xuetian 31e3eb2048
Fix the xdg popup position when CSD is used.
Tested with built-in decoration and qgnomeplatform decoration.
2023-10-31 16:51:32 -07:00
Weng Xuetian c2c2db6bf2
Implement our own xdg_popup_reposition
A recently found bug that makes Qt6 not happy with the show/hide trick.
https://bugreports.qt.io/browse/QTBUG-118650

While I don't have a workaround for it, with Qt6 exposed xdg_popup
object, we can actually implement xdg_popup_reposition with our own
code, this will also eliminate the blinking caused by show/hide.

Fix #47
2023-10-31 14:29:12 -07:00
Weng Xuetian 4a5aee0f92
Remove usage of deprecated setNamedColor in qt 6.4.
It's only deprecated in 6.4, but we can use QColor(QString) instead.
2023-10-31 11:14:26 -07:00
Weng Xuetian cc645075dd
Use QRasterWindow instead of our own QWindow. 2023-10-31 10:59:59 -07: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
Weng Xuetian 7c22f45efe
Fix qt4 build 2023-06-28 04:50:12 -07:00
Weng Xuetian 932ab764aa
Implement new page button alignment option. 2023-04-20 00:07:20 -07:00
Weng Xuetian 40c80056a6
Add program to display actual Qt im module information 2023-03-24 16:50:52 -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 be7ab2f085
Do not pass Qt::BypassWindowManagerHint under wayland.
This prevent wp_viewport to be used for window and render with wrong size.
See: 904b9d33dc/src/client/qwaylandwindow.cpp (L179)

Fix #38
2023-02-01 11:59:32 -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 afa0702500
Don't show input window for only empty preedit.
This make it consistent with gtk/classicui.
2022-09-08 16:17:13 -07:00
Weng Xuetian 97c70fc2ad
bump version 2022-06-01 17:31:23 -07:00
Weng Xuetian 8b44e5586f
Size 0 window should be invisible.
This may cause wayland protocol error on qt6.
2022-05-28 18:57:57 -07:00
Weng Xuetian 13d16541df
use ucs4 offset for invokeAction 2022-05-27 10:13:58 -07:00
Weng Xuetian 3d6c0e2183
Improve static plugin build process
Use add_library(OBJECT), so we don't need to add two static plugin
library and only one is enough.
2022-05-16 21:16:21 -07:00
Weng Xuetian 4cab320f17
Fix unicode font name parsing. 2022-05-14 01:47:02 -07:00
Weng Xuetian c720d2d39e
clean up unused variable. 2022-05-14 01:47:02 -07:00