commit:     ed0c2deee9c8b4347a6f0677b7df927562a22b6b
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Wed Mar 23 22:27:18 2016 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Thu Mar 24 14:42:46 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ed0c2dee

app-i18n/fcitx-qt5: Version bump (1.0.5).

 app-i18n/fcitx-qt5/Manifest                        |  1 +
 app-i18n/fcitx-qt5/fcitx-qt5-1.0.5.ebuild          | 44 +++++++++++
 .../fcitx-qt5/files/fcitx-qt5-1.0.5-ucs4.patch     | 86 ++++++++++++++++++++++
 3 files changed, 131 insertions(+)

diff --git a/app-i18n/fcitx-qt5/Manifest b/app-i18n/fcitx-qt5/Manifest
index 9fe4f27..c7fa740 100644
--- a/app-i18n/fcitx-qt5/Manifest
+++ b/app-i18n/fcitx-qt5/Manifest
@@ -1,2 +1,3 @@
 DIST fcitx-qt5-1.0.2.tar.xz 53324 SHA256 
b8073f07d9384878c616f6d2cea44fc739a3b5731b95b10b3133e0914d49f66d SHA512 
f7075d5334e29fd00c54563182c9cc4027011503aa14d577aa2fb75eb8558c385d91c939f1f21e51850c9c64fc5c396aad5b32fdcc8ddd99c46ec74bd577255d
 WHIRLPOOL 
35ae384cf13fdfdb86c34b7dbefbbe780a2c20ac220868824e25a0ba4368581c19d45cbc9447e1c2dd3236b0758ee9e4311dab1f348a524ca2d002d0b43c760c
 DIST fcitx-qt5-1.0.4.tar.xz 53552 SHA256 
b42a428008d9bf3a5d9140d63c9a475386480d598bb9ce3b78fad43879a50d1c SHA512 
f5a2d3ed30bbbb8da3687dc12dd5be3038242ba40e6bef48483931aacfd9f200db9d24d0df03cb93058eedb3941ef6ecb92d874040eb60742f60a44beda77868
 WHIRLPOOL 
c1dcf45eed09625721c175b1b09724f1f9934cb8cb3413df811009815d4231d2758c54a7b346cb29910c0ce156eb9906136d471359566eb288438cc1f5466710
+DIST fcitx-qt5-1.0.5.tar.xz 53584 SHA256 
8cef90024ca84c3f607943b91f6bfe63fd077507bbe100e5a1936464095841de SHA512 
f4da9ede8918cef7aa0dbacea534ab81024e3c6d812bedd287c4c4c9a8b9ca994d4708489c602967f3504ce057ec6e118674503f5d796883f1890e8ecc11c501
 WHIRLPOOL 
764190a5f523fc40ca5f937704d5bc1a7018232284f50b9b1b6a36b5dd41dfbebda5db337bdc49b08e601e94f51935f2a70d96dddbd4091744ec8c89a77f26b0

diff --git a/app-i18n/fcitx-qt5/fcitx-qt5-1.0.5.ebuild 
b/app-i18n/fcitx-qt5/fcitx-qt5-1.0.5.ebuild
new file mode 100644
index 0000000..8e71460
--- /dev/null
+++ b/app-i18n/fcitx-qt5/fcitx-qt5-1.0.5.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit cmake-utils
+
+if [[ "${PV}" == "9999" ]]; then
+       inherit git-r3
+
+       EGIT_REPO_URI="https://github.com/fcitx/fcitx-qt5";
+fi
+
+DESCRIPTION="Fcitx input method module for Qt 5"
+HOMEPAGE="https://fcitx-im.org/ https://github.com/fcitx/fcitx-qt5";
+if [[ "${PV}" == "9999" ]]; then
+       SRC_URI=""
+else
+       SRC_URI="https://download.fcitx-im.org/${PN}/${P}.tar.xz";
+fi
+
+LICENSE="GPL-2+"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+# Private headers of dev-qt/qtgui:5 used.
+RDEPEND=">=app-i18n/fcitx-4.2.8
+       dev-qt/qtcore:5
+       dev-qt/qtdbus:5
+       dev-qt/qtgui:5=
+       dev-qt/qtwidgets:5
+       virtual/libintl
+       x11-libs/libxkbcommon"
+DEPEND="${RDEPEND}
+       kde-frameworks/extra-cmake-modules:5
+       virtual/pkgconfig"
+
+PATCHES=(
+       "${FILESDIR}/${P}-ucs4.patch"
+)
+
+DOCS=()

diff --git a/app-i18n/fcitx-qt5/files/fcitx-qt5-1.0.5-ucs4.patch 
b/app-i18n/fcitx-qt5/files/fcitx-qt5-1.0.5-ucs4.patch
new file mode 100644
index 0000000..c237d10
--- /dev/null
+++ b/app-i18n/fcitx-qt5/files/fcitx-qt5-1.0.5-ucs4.patch
@@ -0,0 +1,86 @@
+https://github.com/fcitx/fcitx-qt5/commit/31ecc9f2f9c8eb77082044944bbb6740d35ae7c3
+https://github.com/fcitx/fcitx-qt5/commit/8fc110e6125d85d3c50112bc20a6ed36395b2b21
+
+--- platforminputcontext/qfcitxplatforminputcontext.cpp
++++ platforminputcontext/qfcitxplatforminputcontext.cpp
+@@ -254,6 +254,12 @@
+                     anchor = var2.toInt();
+                 else
+                     anchor = cursor;
++
++                // adjust it to real character size
++                QVector<uint> tempUCS4 = text.leftRef(cursor).toUcs4();
++                cursor = tempUCS4.size();
++                tempUCS4 = text.leftRef(anchor).toUcs4();
++                anchor = tempUCS4.size();
+                 if (data.surroundingText != text) {
+                     data.surroundingText = text;
+                     proxy->SetSurroundingText(text, cursor, anchor);
+@@ -388,6 +394,7 @@
+             delete data.proxy;
+         }
+         data.proxy = new 
FcitxQtInputContextProxy(m_connection->serviceName(), path, 
*m_connection->connection(), this);
++        data.proxy->setProperty("icData", 
qVariantFromValue(static_cast<void*>(&data)));
+         connect(data.proxy, SIGNAL(CommitString(QString)), this, 
SLOT(commitString(QString)));
+         connect(data.proxy, SIGNAL(ForwardKey(uint, uint, int)), this, 
SLOT(forwardKey(uint, uint, int)));
+         connect(data.proxy, 
SIGNAL(UpdateFormattedPreedit(FcitxQtFormattedPreeditList,int)), this, 
SLOT(updateFormattedPreedit(FcitxQtFormattedPreeditList,int)));
+@@ -480,15 +487,56 @@
+     update(Qt::ImCursorRectangle);
+ }
+ 
+-void QFcitxPlatformInputContext::deleteSurroundingText(int offset, uint nchar)
++void QFcitxPlatformInputContext::deleteSurroundingText(int offset, uint 
_nchar)
+ {
+     QObject *input = qApp->focusObject();
+     if (!input)
+         return;
+ 
+     QInputMethodEvent event;
+-    event.setCommitString("", offset, nchar);
+-    QCoreApplication::sendEvent(input, &event);
++
++    FcitxQtInputContextProxy *proxy = 
qobject_cast<FcitxQtInputContextProxy*>(sender());
++    if (!proxy) {
++        return;
++    }
++
++    FcitxQtICData *data = 
static_cast<FcitxQtICData*>(proxy->property("icData").value<void *>());
++    QVector<uint> ucsText = data->surroundingText.toUcs4();
++
++    int cursor = data->surroundingCursor;
++    // make nchar signed so we are safer
++    int nchar = _nchar;
++    // Qt's reconvert semantics is different from gtk's. It doesn't count the 
current
++    // selection. Discard selection from nchar.
++    if (data->surroundingAnchor < data->surroundingCursor) {
++        nchar -= data->surroundingCursor - data->surroundingAnchor;
++        offset += data->surroundingCursor - data->surroundingAnchor;
++        cursor = data->surroundingAnchor;
++    } else if (data->surroundingAnchor > data->surroundingCursor) {
++        nchar -= data->surroundingAnchor - data->surroundingCursor;
++        cursor = data->surroundingCursor;
++    }
++
++    // validates
++    if (nchar >= 0 && cursor + offset >= 0 && cursor + offset + nchar < 
ucsText.size()) {
++        // order matters
++        QVector<uint> replacedChars = ucsText.mid(cursor + offset, nchar);
++        nchar = QString::fromUcs4(replacedChars.data(), 
replacedChars.size()).size();
++
++        int start, len;
++        if (offset >= 0) {
++            start = cursor;
++            len = offset;
++        } else {
++            start = cursor;
++            len = -offset;
++        }
++
++        QVector<uint> prefixedChars = ucsText.mid(start, len);
++        offset = QString::fromUcs4(prefixedChars.data(), 
prefixedChars.size()).size() * (offset >= 0 ? 1 : -1);
++        event.setCommitString("", offset, nchar);
++        QCoreApplication::sendEvent(input, &event);
++    }
+ }
+ 
+ void QFcitxPlatformInputContext::forwardKey(uint keyval, uint state, int type)

Reply via email to