From 4f2d7949f03e1c198bc888f2d05f421d35c57e21 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 9 Oct 2017 18:53:29 +0100 Subject: reinit the tree, so we can have metadata --- app-i18n/fcitx/files/fcitx-4.2.9.1-qt-4_ucs4.patch | 95 ++++++++++++++ app-i18n/fcitx/files/fcitx-4.2.9.1-tray_icon.patch | 145 +++++++++++++++++++++ app-i18n/fcitx/files/fcitx-4.2.9.2-scripts.patch | 60 +++++++++ app-i18n/fcitx/files/fcitx-4.2.9.3-restart.patch | 13 ++ 4 files changed, 313 insertions(+) create mode 100644 app-i18n/fcitx/files/fcitx-4.2.9.1-qt-4_ucs4.patch create mode 100644 app-i18n/fcitx/files/fcitx-4.2.9.1-tray_icon.patch create mode 100644 app-i18n/fcitx/files/fcitx-4.2.9.2-scripts.patch create mode 100644 app-i18n/fcitx/files/fcitx-4.2.9.3-restart.patch (limited to 'app-i18n/fcitx/files') 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 000000000000..e417a0615716 --- /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 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(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(sender()); ++ if (!proxy) { ++ return; ++ } ++ ++ FcitxQtICData *data = static_cast(proxy->property("icData").value()); ++ QVector 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 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 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 000000000000..7bfbc6e9ade0 --- /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; diff --git a/app-i18n/fcitx/files/fcitx-4.2.9.2-scripts.patch b/app-i18n/fcitx/files/fcitx-4.2.9.2-scripts.patch new file mode 100644 index 000000000000..a3399767e7b0 --- /dev/null +++ b/app-i18n/fcitx/files/fcitx-4.2.9.2-scripts.patch @@ -0,0 +1,60 @@ +https://github.com/fcitx/fcitx/issues/342 +https://github.com/fcitx/fcitx/commit/de4bd3d535736afe061d9ac63fcc897e3ab3237e + +--- /cmake/fcitx-cmake-helper.sh ++++ /cmake/fcitx-cmake-helper.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/usr/bin/env bash + # Copyright (C) 2012~2013 by Yichao Yu + # yyc1992@gmail.com + # +--- /cmake/fcitx-merge-config.sh ++++ /cmake/fcitx-merge-config.sh +@@ -1,4 +1,4 @@ +-#!/bin/sh ++#!/usr/bin/env bash + # Copyright (C) 2012~2012 by Yichao Yu + # yyc1992@gmail.com + # +--- /data/icon/data/gen.sh ++++ /data/icon/data/gen.sh +@@ -1,4 +1,4 @@ +-#!/bin/sh ++#!/usr/bin/env bash + + a="$(find scabable/status/ -type f -name \*.svg)" + echo $a +--- /data/script/fcitx-configtool.sh ++++ /data/script/fcitx-configtool.sh +@@ -28,7 +28,7 @@ + } + fi + +-if type gettext > /dev/null 2>&1; then ++if which gettext > /dev/null 2>&1; then + _() { + gettext "$@" + } +--- /src/lib/fcitx-utils/gen-hotkey.sh ++++ /src/lib/fcitx-utils/gen-hotkey.sh +@@ -1,7 +1,6 @@ + #!/bin/sh + +-function download_file() +-{ ++download_file() { + if [ "x$3" != "xf" ]; then + if [ -f $1 ]; then + return +--- /src/ui/classic/fcitx-skin-installer.sh ++++ /src/ui/classic/fcitx-skin-installer.sh +@@ -25,7 +25,7 @@ + } + fi + +-if type gettext > /dev/null 2>&1; then ++if which gettext > /dev/null 2>&1; then + _() { + gettext "$@" + } diff --git a/app-i18n/fcitx/files/fcitx-4.2.9.3-restart.patch b/app-i18n/fcitx/files/fcitx-4.2.9.3-restart.patch new file mode 100644 index 000000000000..b71bdac9461a --- /dev/null +++ b/app-i18n/fcitx/files/fcitx-4.2.9.3-restart.patch @@ -0,0 +1,13 @@ +https://github.com/fcitx/fcitx/issues/362 +https://github.com/fcitx/fcitx/commit/82202f6b81361263693f07ae17c55c8ce048b220 + +--- /src/lib/fcitx/instance.c ++++ /src/lib/fcitx/instance.c +@@ -365,6 +365,7 @@ + setjmp(FcitxRecover); + + if (instance->destroy || instance->restart) { ++ FcitxInstanceEnd(instance); + FcitxInstanceRealEnd(instance); + break; + } -- cgit v1.2.3