SHA256
1
0
forked from pool/fcitx
Stephan Kulow 2014-06-10 12:38:52 +00:00 committed by Git OBS Bridge
commit 90e6e67195
7 changed files with 29 additions and 270 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:cb620ee17d4b1c55a664ceb8a980ce107a6b305ba2639267965e0a281733bc15
size 8642480

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:67f4114011d81d0ed805273ba03c6a599c18acc4926a0473e3de4e80c9c31bfa
size 8656012

View File

@ -1,59 +0,0 @@
From: Xuetian Weng <wengxt@gmail.com>
Date: Tue, 11 Mar 2014 00:13:43 +0800
Subject: add a context variable to disable punc
---
src/lib/fcitx/context.h | 2 ++
src/module/punc/punc.c | 12 ++++++++++++
2 files changed, 14 insertions(+)
diff --git a/src/lib/fcitx/context.h b/src/lib/fcitx/context.h
index 32115af..05f0f91 100644
--- a/src/lib/fcitx/context.h
+++ b/src/lib/fcitx/context.h
@@ -70,6 +70,8 @@ extern "C" {
#define CONTEXT_DISABLE_AUTO_FIRST_CANDIDATE_HIGHTLIGHT "CONTEXT_DISABLE_AUTO_FIRST_CANDIDATE_HIGHTLIGHT"
/** disable auto first candidate highlight */
#define CONTEXT_DISABLE_FULLWIDTH "CONTEXT_DISABLE_FULLWIDTH"
+ /** disable punc module */
+ #define CONTEXT_DISABLE_PUNC "CONTEXT_DISABLE_PUNC"
/**
* @brief register a new global context variable
diff --git a/src/module/punc/punc.c b/src/module/punc/punc.c
index be6dec3..3327f9c 100644
--- a/src/module/punc/punc.c
+++ b/src/module/punc/punc.c
@@ -154,6 +154,8 @@ void* PuncCreate(FcitxInstance* instance)
PuncWhichCopy, PuncWhichFree,
puncState);
+ FcitxInstanceRegisterWatchableContext(instance, CONTEXT_DISABLE_PUNC, FCT_Boolean, FCF_ResetOnInputMethodChange);
+
FcitxPuncAddFunctions(instance);
return puncState;
}
@@ -250,6 +252,11 @@ boolean PuncPreFilter(void* arg, FcitxKeySym sym, unsigned int state,
{
FCITX_UNUSED(retVal);
FcitxPuncState *puncState = (FcitxPuncState*)arg;
+ boolean disablePunc = FcitxInstanceGetContextBoolean(
+ puncState->owner, CONTEXT_DISABLE_PUNC);
+ if (disablePunc)
+ return false;
+
if (FcitxHotkeyIsHotKeySimple(sym, state) &&
!FcitxHotkeyIsHotKeyDigit(sym, state) && !IsHotKeyPunc(sym, state))
puncState->bLastIsNumber = false;
@@ -269,6 +276,11 @@ boolean ProcessPunc(void* arg, FcitxKeySym sym, unsigned int state, INPUT_RETURN
if (*retVal != IRV_TO_PROCESS)
return false;
+ boolean disablePunc = FcitxInstanceGetContextBoolean(
+ puncState->owner, CONTEXT_DISABLE_PUNC);
+ if (disablePunc)
+ return false;
+
FcitxCandidateWordList *candList = FcitxInputStateGetCandidateList(input);
if (FcitxCandidateWordGetListSize(candList) != 0) {
if (FcitxCandidateWordGetHasGoneToNextPage(candList) &&

View File

@ -1,193 +0,0 @@
diff -Npur fcitx-4.2.8.3/src/frontend/gtk2/fcitximcontext-gio.c fcitx-4.2.8.3-new/src/frontend/gtk2/fcitximcontext-gio.c
--- fcitx-4.2.8.3/src/frontend/gtk2/fcitximcontext-gio.c 2013-09-28 16:33:14.000000000 +0800
+++ fcitx-4.2.8.3-new/src/frontend/gtk2/fcitximcontext-gio.c 2014-05-08 02:10:17.149308893 +0800
@@ -47,6 +47,25 @@
# define NEW_GDK_WINDOW_GET_DISPLAY
#endif
+static const FcitxCapacityFlags purpose_related_capacity =
+ CAPACITY_ALPHA |
+ CAPACITY_DIGIT |
+ CAPACITY_NUMBER |
+ CAPACITY_DIALABLE |
+ CAPACITY_URL |
+ CAPACITY_EMAIL |
+ CAPACITY_PASSWORD;
+
+static const FcitxCapacityFlags hints_related_capacity =
+ CAPACITY_SPELLCHECK |
+ CAPACITY_NO_SPELLCHECK |
+ CAPACITY_WORD_COMPLETION |
+ CAPACITY_LOWERCASE |
+ CAPACITY_UPPERCASE |
+ CAPACITY_UPPERCASE_WORDS |
+ CAPACITY_UPPERCASE_SENTENCES |
+ CAPACITY_NO_ON_SCREEN_KEYBOARD;
+
struct _FcitxIMContext {
GtkIMContext parent;
@@ -57,11 +76,13 @@ struct _FcitxIMContext {
int has_focus;
guint32 time;
gboolean use_preedit;
+ gboolean support_surrounding_text;
gboolean is_inpreedit;
gchar* preedit_string;
gchar* surrounding_text;
int cursor_pos;
- FcitxCapacityFlags capacity;
+ FcitxCapacityFlags capacity_from_toolkit;
+ FcitxCapacityFlags last_updated_capacity;
PangoAttrList* attrlist;
gint last_cursor_pos;
gint last_anchor_pos;
@@ -364,7 +385,7 @@ fcitx_im_context_init(FcitxIMContext *co
context->last_cursor_pos = -1;
context->preedit_string = NULL;
context->attrlist = NULL;
- context->capacity = CAPACITY_SURROUNDING_TEXT;
+ context->last_updated_capacity = CAPACITY_SURROUNDING_TEXT;
context->slave = gtk_im_context_simple_new();
gtk_im_context_simple_add_table(GTK_IM_CONTEXT_SIMPLE(context->slave),
@@ -622,9 +643,31 @@ _fcitx_im_context_update_formatted_preed
(gpointer *)&widget);
if (GTK_IS_WIDGET(widget)) {
hasColor = true;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GtkStyleContext* styleContext = gtk_widget_get_style_context(widget);
+ GdkRGBA* fg_rgba = NULL;
+ GdkRGBA* bg_rgba = NULL;
+ gtk_style_context_get(styleContext, GTK_STATE_FLAG_SELECTED,
+ "background-color", &bg_rgba,
+ "color", &fg_rgba,
+ NULL
+ );
+
+ fg.pixel = 0;
+ fg.red = CLAMP ((guint) (fg_rgba->red * 65535), 0, 65535);
+ fg.green = CLAMP ((guint) (fg_rgba->green * 65535), 0, 65535);
+ fg.blue = CLAMP ((guint) (fg_rgba->blue * 65535), 0, 65535);
+ bg.pixel = 0;
+ bg.red = CLAMP ((guint) (bg_rgba->red * 65535), 0, 65535);
+ bg.green = CLAMP ((guint) (bg_rgba->green * 65535), 0, 65535);
+ bg.blue = CLAMP ((guint) (bg_rgba->blue * 65535), 0, 65535);
+ gdk_rgba_free (fg_rgba);
+ gdk_rgba_free (bg_rgba);
+#else
GtkStyle* style = gtk_widget_get_style(widget);
fg = style->text[GTK_STATE_SELECTED];
bg = style->bg[GTK_STATE_SELECTED];
+#endif
}
}
@@ -924,7 +967,7 @@ fcitx_im_context_set_surrounding (GtkIMC
FcitxIMContext *fcitxcontext = FCITX_IM_CONTEXT (context);
if (fcitx_client_is_valid(fcitxcontext->client) &&
- !(fcitxcontext->capacity & CAPACITY_PASSWORD)) {
+ !(fcitxcontext->last_updated_capacity & CAPACITY_PASSWORD)) {
gint cursor_pos;
guint utf8_len;
gchar *p;
@@ -960,10 +1003,18 @@ void
_fcitx_im_context_set_capacity(FcitxIMContext* fcitxcontext, gboolean force)
{
if (fcitx_client_is_valid(fcitxcontext->client)) {
- FcitxCapacityFlags flags = fcitxcontext->capacity & ~(CAPACITY_PREEDIT | CAPACITY_FORMATTED_PREEDIT | CAPACITY_PASSWORD);
- if (fcitxcontext->use_preedit)
+ FcitxCapacityFlags flags = fcitxcontext->capacity_from_toolkit;
+ // toolkit hint always not have preedit / surrounding hint
+ // no need to check them
+ if (fcitxcontext->use_preedit) {
flags |= CAPACITY_PREEDIT | CAPACITY_FORMATTED_PREEDIT;
+ }
+ if (fcitxcontext->support_surrounding_text) {
+ flags |= CAPACITY_SURROUNDING_TEXT;
+ }
+ // always run this code against all gtk version
+ // seems visibility != PASSWORD hint
if (fcitxcontext->client_window != NULL) {
GtkWidget *widget;
gdk_window_get_user_data (fcitxcontext->client_window,
@@ -975,12 +1026,12 @@ _fcitx_im_context_set_capacity(FcitxIMCo
}
gboolean update = FALSE;
- if (G_UNLIKELY(fcitxcontext->capacity != flags)) {
- fcitxcontext->capacity = flags;
+ if (G_UNLIKELY(fcitxcontext->last_updated_capacity != flags)) {
+ fcitxcontext->last_updated_capacity = flags;
update = TRUE;
}
if (G_UNLIKELY(update || force))
- fcitx_client_set_capacity(fcitxcontext->client, fcitxcontext->capacity);
+ fcitx_client_set_capacity(fcitxcontext->client, fcitxcontext->last_updated_capacity);
}
}
@@ -1387,12 +1438,12 @@ _request_surrounding_text (FcitxIMContex
else
return;
if (return_value) {
- (*context)->capacity |= CAPACITY_SURROUNDING_TEXT;
+ (*context)->support_surrounding_text = TRUE;
_fcitx_im_context_set_capacity (*context,
FALSE);
}
else {
- (*context)->capacity &= ~CAPACITY_SURROUNDING_TEXT;
+ (*context)->support_surrounding_text = FALSE;
_fcitx_im_context_set_capacity (*context,
FALSE);
}
@@ -1483,20 +1534,12 @@ _fcitx_im_context_input_purpose_changed_
GtkInputPurpose purpose;
g_object_get(gobject, "input-purpose", &purpose, NULL);
- const FcitxCapacityFlags related_capacity =
- CAPACITY_ALPHA |
- CAPACITY_DIGIT |
- CAPACITY_NUMBER |
- CAPACITY_DIALABLE |
- CAPACITY_URL |
- CAPACITY_EMAIL |
- CAPACITY_PASSWORD;
- fcitxcontext->capacity &= ~related_capacity;
+ fcitxcontext->capacity_from_toolkit &= ~purpose_related_capacity;
#define CASE_PURPOSE(_PURPOSE, _CAPACITY) \
case _PURPOSE: \
- fcitxcontext->capacity |= _CAPACITY; \
+ fcitxcontext->capacity_from_toolkit |= _CAPACITY; \
break;
switch(purpose) {
@@ -1528,21 +1571,11 @@ _fcitx_im_context_input_hints_changed_cb
GtkInputHints hints;
g_object_get(gobject, "input-hints", &hints, NULL);
- const FcitxCapacityFlags related_capacity =
- CAPACITY_SPELLCHECK |
- CAPACITY_NO_SPELLCHECK |
- CAPACITY_WORD_COMPLETION |
- CAPACITY_LOWERCASE |
- CAPACITY_UPPERCASE |
- CAPACITY_UPPERCASE_WORDS |
- CAPACITY_UPPERCASE_SENTENCES |
- CAPACITY_NO_ON_SCREEN_KEYBOARD;
-
- fcitxcontext->capacity &= ~related_capacity;
+ fcitxcontext->capacity_from_toolkit &= ~hints_related_capacity;
#define CHECK_HINTS(_HINTS, _CAPACITY) \
if (hints & _HINTS) \
- fcitxcontext->capacity |= _CAPACITY;
+ fcitxcontext->capacity_from_toolkit |= _CAPACITY;
CHECK_HINTS(GTK_INPUT_HINT_SPELLCHECK, CAPACITY_SPELLCHECK)
CHECK_HINTS(GTK_INPUT_HINT_NO_SPELLCHECK, CAPACITY_NO_SPELLCHECK);

View File

@ -1,3 +1,19 @@
-------------------------------------------------------------------
Sat Jun 7 16:41:30 UTC 2014 - i@marguerite.su
- update version 4.2.8.4
* Fix github issue fcitx/fcitx#134,137,153,154
* Fix google code issue 728
* Implement close event when close input method
* Restart from menu should be faster (but who cares :P).
- remove patch: fcitx-context-variable-disable-punc-on-the-fly.patch
* upstreamed
- remove patch: fcitx-password-visible-on-clutter-entry.patch
* upstreamed
- tweak New_Air theme's color to increase contrast in darker
plasma themes.
-------------------------------------------------------------------
Wed May 7 05:24:03 UTC 2014 - dliang@suse.com

View File

@ -19,7 +19,7 @@
%define libver -4_2_8
Name: fcitx
Version: 4.2.8.3
Version: 4.2.8.4
Release: 0
Summary: Flexible Context-aware Input Tool with eXtension
License: GPL-2.0+
@ -34,10 +34,6 @@ Source7: xinput-fcitx
Source8: openSUSE-themes.tar.gz
Source9: macros.%{name}
Source10: input.svgz
#PATCH-FEATURE-OPENSUSE marguerite@opensuse.org To support sougou IM, we need a context
# variable to disable punc on the fly
Patch: fcitx-context-variable-disable-punc-on-the-fly.patch
Patch1: fcitx-password-visible-on-clutter-entry.patch
BuildRequires: cairo-devel
%if 0%{?suse_version}
BuildRequires: dbus-1-devel
@ -387,8 +383,6 @@ You can either use this package for download from kde-look.org using knewstaff i
%prep
%setup -q -n %{name}-%{version}
%patch -p1
%patch1 -p1
# hack to fix incompatibility of gtk-query-immodules-2.0 (bnc#845860)
%if %suse_version < 1310
sed -i \
@ -472,20 +466,22 @@ desktop-file-install --add-category="System" --delete-original --dir=%{buildroot
# fix doc
%if 0%{?suse_version}
mkdir %{buildroot}%{_docdir}
mv %{buildroot}%{_datadir}/doc/%{name}/ %{buildroot}%{_docdir}
mkdir -p %{buildroot}%{_docdir}/
mv %{buildroot}%{_datadir}/doc/%{name} %{buildroot}%{_docdir}/
cp -r %{SOURCE2} %{buildroot}%{_docdir}/%{name}/
cp -r %{SOURCE3} %{buildroot}%{_docdir}/%{name}/
cp -r AUTHORS %{buildroot}%{_docdir}/%{name}/
cp -r ChangeLog %{buildroot}%{_docdir}/%{name}/
cp -r COPYING %{buildroot}%{_docdir}/%{name}/
%endif
%if 0%{?fedora_version}
mkdir %{buildroot}%{_docdir}/packages/
mv %{buildroot}%{_datadir}/doc/%{name}/ %{buildroot}%{_docdir}/packages/
mv %{buildroot}%{_docdir}/%{name}/ %{buildroot}%{_docdir}/packages/
cp -r %{SOURCE2} %{buildroot}%{_docdir}/packages/%{name}/
cp -r %{SOURCE3} %{buildroot}%{_docdir}/packages/%{name}/
cp -r AUTHORS %{buildroot}%{_docdir}/packages/%{name}/
cp -r ChangeLog %{buildroot}%{_docdir}/packages/%{name}/
cp -r COPYING %{buildroot}%{_docdir}/packages/%{name}/
%endif
# create autostart
@ -591,7 +587,6 @@ update-desktop-database %{_datadir}/applications &>/dev/null ||
%files -f %{name}.lang
%defattr(-,root,root)
%doc COPYING
%{_bindir}/%{name}
%{_bindir}/%{name}-autostart
%{_bindir}/%{name}-configtool
@ -609,11 +604,11 @@ update-desktop-database %{_datadir}/applications &>/dev/null ||
%{_libdir}/%{name}/
%if 0%{?suse_version}
%config %{_sysconfdir}/X11/xim.d/
%{_docdir}/%{name}/
%doc %{_docdir}/%{name}/
%endif
%if 0%{?fedora_version}
%config %{_sysconfdir}/X11/xinit/xinput.d/
%{_docdir}/packages/%{name}/
%doc %{_docdir}/packages/%{name}/
%config %{_sysconfdir}/xdg/autostart/%{name}-autostart.desktop
%endif

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:627d7d30a069ee21a5a6fd04eff5165be0afc75675fe4d97b087f0e0ceba8af2
size 778121
oid sha256:5c2083e6b4c71461caae058f3c65459ee95cf7c0f42fb981eeafbde8301bfde3
size 780402