summaryrefslogtreecommitdiff
path: root/app-i18n/fcitx/files
diff options
context:
space:
mode:
authorArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>2016-03-23 23:19:20 +0100
committerMike Gilbert <floppym@gentoo.org>2016-03-24 10:42:46 -0400
commitb842ab8562990a8bc92adf2cd3872f9ce83d05ab (patch)
tree41975f84d766d2b3a9afae03c556fe8b704f7708 /app-i18n/fcitx/files
parentac5980bba03608b068a61ec5b9cefa43422ec88e (diff)
downloadgentoo-b842ab8562990a8bc92adf2cd3872f9ce83d05ab.tar.gz
gentoo-b842ab8562990a8bc92adf2cd3872f9ce83d05ab.tar.xz
app-i18n/fcitx: Version bump (4.2.9.1).
Diffstat (limited to 'app-i18n/fcitx/files')
-rw-r--r--app-i18n/fcitx/files/fcitx-4.2.9.1-qt-4_ucs4.patch95
-rw-r--r--app-i18n/fcitx/files/fcitx-4.2.9.1-tray_icon.patch145
2 files changed, 240 insertions, 0 deletions
diff --git a/app-i18n/fcitx/files/fcitx-4.2.9.1-qt-4_ucs4.patch b/app-i18n/fcitx/files/fcitx-4.2.9.1-qt-4_ucs4.patch
new file mode 100644
index 00000000000..2e114b087f2
--- /dev/null
+++ b/app-i18n/fcitx/files/fcitx-4.2.9.1-qt-4_ucs4.patch
@@ -0,0 +1,95 @@
+https://github.com/fcitx/fcitx/commit/14faccfbb0d87e06c25d182ae842808d18be3dc7
+https://github.com/fcitx/fcitx/commit/216a09e3ec056f272eebfbe82809b803d86012cb
+
+--- src/frontend/qt/qfcitxinputcontext.cpp
++++ src/frontend/qt/qfcitxinputcontext.cpp
+@@ -232,6 +232,20 @@
+ anchor = var2.toInt();
+ else
+ anchor = cursor;
++
++ // adjust it to real character size
++ // QTBUG-25536;
++ QVector<uint> tempUCS4 = text.leftRef(cursor).toUcs4();
++ while (!tempUCS4.empty() && tempUCS4.last() == 0) {
++ tempUCS4.pop_back();
++ }
++ cursor = tempUCS4.size();
++ tempUCS4 = text.leftRef(anchor).toUcs4();
++ while (!tempUCS4.empty() && tempUCS4.last() == 0) {
++ tempUCS4.pop_back();
++ }
++ anchor = tempUCS4.size();
++
+ if (data->surroundingText != text) {
+ data->surroundingText = text;
+ proxy->SetSurroundingText(text, cursor, anchor);
+@@ -581,6 +595,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)));
+@@ -680,11 +695,57 @@
+ sendEvent(event);
+ }
+
+-void QFcitxInputContext::deleteSurroundingText(int offset, uint nchar)
++void QFcitxInputContext::deleteSurroundingText(int offset, uint _nchar)
+ {
+ QInputMethodEvent event;
+- event.setCommitString("", offset, nchar);
+- sendEvent(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();
++
++ // QTBUG-25536
++ while (!ucsText.empty() && ucsText.last() == 0) {
++ ucsText.pop_back();
++ }
++
++ 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);
++ sendEvent(event);
++ }
+ }
+
+ void QFcitxInputContext::forwardKey(uint keyval, uint state, int type)
diff --git a/app-i18n/fcitx/files/fcitx-4.2.9.1-tray_icon.patch b/app-i18n/fcitx/files/fcitx-4.2.9.1-tray_icon.patch
new file mode 100644
index 00000000000..4f04f5ea423
--- /dev/null
+++ b/app-i18n/fcitx/files/fcitx-4.2.9.1-tray_icon.patch
@@ -0,0 +1,145 @@
+https://github.com/fcitx/fcitx/issues/241
+https://github.com/fcitx/fcitx/commit/c737618fffa84bfe5a6caf55cee9b9288a791bbf
+https://github.com/fcitx/fcitx/commit/353683e29be4ef26409b9a05e0cb647a5180fa8c
+https://github.com/fcitx/fcitx/commit/fe2732db27a1c2e183400ceeb3283559e10a4ca8
+https://github.com/fcitx/fcitx/commit/440c431d29876a8e4871159d289bc9a573f9a41b
+
+--- src/module/notificationitem/notificationitem.c
++++ src/module/notificationitem/notificationitem.c
+@@ -565,8 +565,17 @@
+
+ boolean FcitxNotificationItemEnable(FcitxNotificationItem* notificationitem, FcitxNotificationItemAvailableCallback callback, void* data)
+ {
+- if (!callback || notificationitem->callback)
++ if (!callback)
+ return false;
++
++ if (notificationitem->callback == callback) {
++ return true;
++ }
++
++ if (notificationitem->callback) {
++ return false;
++ }
++
+ if (notificationitem->serviceName) {
+ FcitxLog(ERROR, "This should not happen, please report bug.");
+ return false;
+--- src/ui/classic/TrayWindow.c
++++ src/ui/classic/TrayWindow.c
+@@ -48,7 +48,7 @@
+ Display *dpy = classicui->dpy;
+ int iScreen = classicui->iScreen;
+ char strWindowName[] = "Fcitx Tray Window";
+- if (!classicui->bUseTrayIcon || classicui->isSuspend)
++ if (!classicui->bUseTrayIcon || classicui->isSuspend || classicui->notificationItemAvailable)
+ return;
+
+ if (trayWindow->window == None && trayWindow->dockWindow != None) {
+@@ -61,12 +61,12 @@
+ wsa.colormap = colormap;
+ wsa.background_pixel = 0;
+ wsa.border_pixel = 0;
+- trayWindow->window = XCreateWindow(dpy, p, -1, -1, 1, 1,
++ trayWindow->window = XCreateWindow(dpy, p, -1, -1, 22, 22,
+ 0, vi->depth, InputOutput, vi->visual,
+ CWBackPixmap | CWBackPixel | CWBorderPixel | CWColormap, &wsa);
+ } else {
+ trayWindow->window = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy),
+- -1, -1, 1, 1, 0,
++ -1, -1, 22, 22, 0,
+ BlackPixel(dpy, DefaultScreen(dpy)),
+ WhitePixel(dpy, DefaultScreen(dpy)));
+ XSetWindowBackgroundPixmap(dpy, trayWindow->window, ParentRelative);
+@@ -74,6 +74,7 @@
+ if (trayWindow->window == (Window) NULL)
+ return;
+
++ trayWindow->size = 22;
+ XSizeHints size_hints;
+ size_hints.flags = PWinGravity | PBaseSize;
+ size_hints.base_width = trayWindow->size;
+@@ -161,7 +162,7 @@
+ png_surface = image->image;
+
+ c = cairo_create(trayWindow->cs);
+- cairo_set_source_rgba(c, 0, 0, 0, 0);
++ cairo_set_source_rgba(c, 1, 1, 1, 0);
+ cairo_set_operator(c, CAIRO_OPERATOR_SOURCE);
+ cairo_paint(c);
+
+@@ -226,8 +227,6 @@
+ if (event->xclient.message_type == trayWindow->atoms[ATOM_MANAGER]
+ && event->xclient.data.l[1] == trayWindow->atoms[ATOM_SELECTION]
+ && trayWindow->dockWindow == None) {
+- if (classicui->notificationItemAvailable)
+- return true;
+ trayWindow->dockWindow = event->xclient.data.l[2];
+ TrayWindowRelease(trayWindow);
+ TrayWindowInit(trayWindow);
+@@ -245,6 +244,7 @@
+ int size = event->xconfigure.height;
+ if (size != trayWindow->size) {
+ trayWindow->size = size;
++ XResizeWindow(dpy, trayWindow->window, size, size);
+ XSizeHints size_hints;
+ size_hints.flags = PWinGravity | PBaseSize;
+ size_hints.base_width = trayWindow->size;
+@@ -286,6 +286,14 @@
+ return true;
+ }
+ break;
++ case PropertyNotify:
++ if (event->xproperty.atom == trayWindow->atoms[ATOM_VISUAL] &&
++ event->xproperty.window == trayWindow->dockWindow) {
++ TrayWindowRelease(trayWindow);
++ TrayWindowInit(trayWindow);
++ return true;
++ }
++ break;
+ }
+ return false;
+ }
+--- src/ui/classic/classicui.c
++++ src/ui/classic/classicui.c
+@@ -168,7 +168,7 @@
+ void ClassicUIDelayedInitTray(void* arg) {
+ FcitxClassicUI* classicui = (FcitxClassicUI*) arg;
+ // FcitxLog(INFO, "yeah we delayed!");
+- if (!classicui->bUseTrayIcon)
++ if (!classicui->bUseTrayIcon || classicui->isSuspend)
+ return;
+ /*
+ * if this return false, something wrong happened and callback
+@@ -187,7 +187,7 @@
+ {
+ FcitxClassicUI* classicui = (FcitxClassicUI*) arg;
+ classicui->trayTimeout = 0;
+- if (!classicui->bUseTrayIcon)
++ if (!classicui->bUseTrayIcon || classicui->isSuspend)
+ return;
+
+ if (!classicui->trayWindow->bTrayMapped) {
+--- src/ui/classic/tray.c
++++ src/ui/classic/tray.c
+@@ -106,8 +106,9 @@
+
+ XWindowAttributes attr;
+ XGetWindowAttributes(dpy, DefaultRootWindow(dpy), &attr);
+- if ((attr.your_event_mask & StructureNotifyMask) != StructureNotifyMask) {
+- XSelectInput(dpy, DefaultRootWindow(dpy), attr.your_event_mask | StructureNotifyMask); // for MANAGER selection
++ int neededMask = StructureNotifyMask;
++ if ((attr.your_event_mask & neededMask) != neededMask) {
++ XSelectInput(dpy, DefaultRootWindow(dpy), attr.your_event_mask | neededMask); // for MANAGER selection
+ }
+ return True;
+ }
+@@ -123,7 +124,7 @@
+ Display* dpy = tray->owner->dpy;
+
+ if (tray->dockWindow != None) {
+- XSelectInput(dpy, tray->dockWindow, StructureNotifyMask);
++ XSelectInput(dpy, tray->dockWindow, PropertyChangeMask | StructureNotifyMask);
+ TraySendOpcode(tray, SYSTEM_TRAY_REQUEST_DOCK, tray->window, 0, 0);
+ tray->bTrayMapped = True;
+ return 1;