rpms/im-sdk/FC-3 httx-preedit-state-svn2544-146523.patch, NONE, 1.1 httx-status-focus-svn2500-146406.patch, NONE, 1.1 unitle-Punjabi-missing-keys-svn2604-151477.patch, NONE, 1.1 xiiimp-aux-segfault-svn2507-148765.patch, NONE, 1.1 xiiimp-close-candidate-146407.patch, NONE, 1.1 xiiimp-close-on-reset-svn2543-146407.patch, NONE, 1.1 xiiimp-pango.patch, NONE, 1.1 xiiimp-preedit-area-svn2505-147458.patch, NONE, 1.1 xiiimp-preedit-callback-svn2548-147459.patch, NONE, 1.1 xiiimp-preedit-return-value-svn2549-149607.patch, NONE, 1.1 im-sdk.spec, 1.100, 1.101 xiiimp-fix-gcc-warnings.patch, 1.1, 1.2 xiiimp.so-gcc-warnings.patch, 1.1, 1.2
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Wed Jul 27 14:10:27 UTC 2005
- Previous message (by thread): rpms/policycoreutils/devel .cvsignore, 1.57, 1.58 policycoreutils-rhat.patch, 1.94, 1.95 policycoreutils.spec, 1.124, 1.125 sources, 1.60, 1.61
- Next message (by thread): rpms/jonas/devel jonas.spec,1.93,1.94
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: tagoh
Update of /cvs/dist/rpms/im-sdk/FC-3
In directory cvs.devel.redhat.com:/tmp/cvs-serv30718
Modified Files:
im-sdk.spec xiiimp-fix-gcc-warnings.patch
xiiimp.so-gcc-warnings.patch
Added Files:
httx-preedit-state-svn2544-146523.patch
httx-status-focus-svn2500-146406.patch
unitle-Punjabi-missing-keys-svn2604-151477.patch
xiiimp-aux-segfault-svn2507-148765.patch
xiiimp-close-candidate-146407.patch
xiiimp-close-on-reset-svn2543-146407.patch xiiimp-pango.patch
xiiimp-preedit-area-svn2505-147458.patch
xiiimp-preedit-callback-svn2548-147459.patch
xiiimp-preedit-return-value-svn2549-149607.patch
Log Message:
added more patches.
httx-preedit-state-svn2544-146523.patch:
R6IMProtocol.cpp | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
--- NEW FILE httx-preedit-state-svn2544-146523.patch ---
diff -ur im-sdk-r12_1-svn2002.org/iiimxcf/htt_xbe/lib/IMdkit/r6im/R6IMProtocol.cpp im-sdk-r12_1-svn2002/iiimxcf/htt_xbe/lib/IMdkit/r6im/R6IMProtocol.cpp
--- im-sdk-r12_1-svn2002.org/iiimxcf/htt_xbe/lib/IMdkit/r6im/R6IMProtocol.cpp 2005-01-27 13:35:26.000000000 +0900
+++ im-sdk-r12_1-svn2002/iiimxcf/htt_xbe/lib/IMdkit/r6im/R6IMProtocol.cpp 2005-01-28 14:41:24.623269272 +0900
@@ -337,7 +337,8 @@
}
else if (!strcmp(icp->name, XNPreeditState)) {
icp->value = new CARD32;
- (*(CARD32*)icp->value) = ic->is_conv_state();
+ (*(CARD32*)icp->value) = (ic->is_conv_state()) ?
+ XIMPreeditEnable : XIMPreeditDisable;
icp->value_length = sizeof(CARD32);
}
}
@@ -351,7 +352,8 @@
}
else if (!strcmp(icp->name, XNPreeditState)) {
icp->value = new CARD32;
- (*(CARD32*)icp->value) = ic->is_conv_state();
+ (*(CARD32*)icp->value) = (ic->is_conv_state()) ?
+ XIMPreeditEnable : XIMPreeditDisable;
icp->value_length = sizeof(CARD32);
}
else if (!strcmp(icp->name, XNArea)) {
httx-status-focus-svn2500-146406.patch:
i18nPtHdr.c | 7 +++++++
1 files changed, 7 insertions(+)
--- NEW FILE httx-status-focus-svn2500-146406.patch ---
diff -ur im-sdk-r12_1-svn2002.org/iiimxcf/htt_xbe/lib/IMdkit/r6im/i18nPtHdr.c im-sdk-r12_1-svn2002/iiimxcf/htt_xbe/lib/IMdkit/r6im/i18nPtHdr.c
--- im-sdk-r12_1-svn2002.org/iiimxcf/htt_xbe/lib/IMdkit/r6im/i18nPtHdr.c 2005-01-27 13:35:26.000000000 +0900
+++ im-sdk-r12_1-svn2002/iiimxcf/htt_xbe/lib/IMdkit/r6im/i18nPtHdr.c 2005-01-27 19:37:50.223243584 +0900
@@ -903,6 +903,13 @@
_Xi18nSendMessage(ims, connect_id,
XIM_RESET_IC_REPLY, 0, reply, total_size);
+ /* execute set/unset focus function to redraw status text */
+ if (IsFocused(resetic->icid)) {
+ SetICFocus(resetic->icid);
+ }
+ else {
+ UnsetICFocus(resetic->icid);
+ }
/* free FrameMgr */
FrameMgrFree(fm);
XFree(reply);
unitle-Punjabi-missing-keys-svn2604-151477.patch:
phonetic.utf | 82 +++++++++++++++++++++++++++++------------------------------
1 files changed, 41 insertions(+), 41 deletions(-)
--- NEW FILE unitle-Punjabi-missing-keys-svn2604-151477.patch ---
diff -ruN im-sdk-r12_1-svn2002.orig/leif/unit/dict/GURMUKHI/phonetic.utf im-sdk-r12_1-svn2002/leif/unit/dict/GURMUKHI/phonetic.utf
--- im-sdk-r12_1-svn2002.orig/leif/unit/dict/GURMUKHI/phonetic.utf 2004-10-13 09:28:49.000000000 +0900
+++ im-sdk-r12_1-svn2002/leif/unit/dict/GURMUKHI/phonetic.utf 2005-07-27 22:42:03.000000000 +0900
@@ -2,7 +2,7 @@
[ Description ]
Locale Name: pa_IN.UTF-8
-Layout Name: Phonetic
+Layout Name: phonetic(ਧà©à¨¨à©)
Encode: UTF-8
UsedCodes: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()_-+=|\~`:;"'{[}]<,>.?/
MaxCodes: 1
@@ -20,33 +20,31 @@
SelectKey_Mode: Number
[ Single ]
-! !
-1 ੧
-@ à¨
-2 ੨
-# à¨
-3 à©©
-$ à¨
-4 ੪
-5 à©«
-6 ੬
-7 à©
-8 à©®
-( (
-9 ੯
-) )
-0 ੦
+! ੧
+1 1
+@ ੨
+2 2
+# à©©
+3 3
+$ ੪
+4 4
+5 5
+6 6
+7 7
+8 8
+( ੯
+9 9
+) ੦
+0 0
_ _
- -
+ +
= =
-Q ਤ
-q ਥ
-W à¨
+Q ਥ
+q ਤ
w ਾ
-E à¨
+E à¨
e ੲ
-R R
r ਰ
T à¨
t à¨
@@ -60,12 +58,12 @@
o à©
P ਫ
p ਪ
-{ à¨
-[ à¨
-} à¨
-] à¨
-A ੳ
-a à¨
+{ (
+[ [
+} )
+] ]
+A à¨
+a ੳ
S ਸ਼
s ਸ
D ਧ
@@ -74,7 +72,6 @@
f ਡ
G à¨
g à¨
-H à¨
h ਹ
J à¨
j à¨
@@ -86,14 +83,14 @@
; ;
" "
' '
-| |
-\ \
-~ à©°
-` ੱ
+| ।
+\ à¨
+~ ੱ
+` à©
Z à©
-z à©
-X à©
-x à©
+z à©
+X ਯ
+x ਣ
C à¨
c à¨
V à©
@@ -109,10 +106,13 @@
> à©´
. ਼
? ?
-/ ਯ
+/ à¨
[ Phrase ]
-% à¨
-^ à©
-& &
-* *
+% à©«
+^ ੬
+& à©
+* à©®
+R à©à¨°
+H à©à¨¹
+W ਾà¨
xiiimp-aux-segfault-svn2507-148765.patch:
guiIMLookup.c | 33 ++++++++++++++++++++++-----------
1 files changed, 22 insertions(+), 11 deletions(-)
--- NEW FILE xiiimp-aux-segfault-svn2507-148765.patch ---
diff -ur im-sdk-r12_1-svn2002.org/iiimxcf/xiiimp.so/iiimp/guiIMLookup.c im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/guiIMLookup.c
--- im-sdk-r12_1-svn2002.org/iiimxcf/xiiimp.so/iiimp/guiIMLookup.c 2005-01-27 13:35:26.000000000 +0900
+++ im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/guiIMLookup.c 2005-02-10 18:43:34.247837464 +0900
@@ -146,7 +146,7 @@
/* label */
str = label->string.multi_byte;
- str_len = strlen(str);
+ str_len = (str) ? strlen(str) : 0;
/* need to get wchar string */
wc_len = str_len;
@@ -188,7 +188,7 @@
/* value */
str = value->string.multi_byte;
- str_len = strlen(str);
+ str_len = (str) ? strlen(str) : 0;
/* need to get wchar string */
wc_len = str_len;
@@ -845,9 +845,14 @@
return DRAW_NOTHING;
for (i = 0; i < length; i++) {
- if (strcmp(lc1->value[lc1_start + i].string.multi_byte,
- lc2->value[lc2_start + i].string.multi_byte))
+ char* lc1_value = lc1->value[lc1_start + i].string.multi_byte;
+ char* lc2_value = lc2->value[lc2_start + i].string.multi_byte;
+ if (lc1_value && lc2_value) {
+ if (strcmp(lc1_value, lc2_value)) return CONTENTS;
+ }
+ else {
return CONTENTS;
+ }
}
if (lc1->value_feedback == 0 ||
lc2->value_feedback == 0 ||
@@ -940,9 +945,16 @@
to->feedback = Xmalloc(sizeof(XIMFeedback) * to->length);
if (from->encoding_is_wchar == False) {
- int len = strlen(from->string.multi_byte);
- to->string.multi_byte = Xmalloc(len + 1);
- strcpy(to->string.multi_byte, from->string.multi_byte);
+ int len;
+ if (from->string.multi_byte) {
+ len = strlen(from->string.multi_byte);
+ to->string.multi_byte = Xmalloc(len + 1);
+ strcpy(to->string.multi_byte, from->string.multi_byte);
+ }
+ else {
+ len = 0;
+ to->string.multi_byte = NULL;
+ }
} else {
XimCommon im = (XimCommon)ic->core.im;
int len = from->length * XLC_PUBLIC(im->core.lcd, mb_cur_max);
@@ -1046,6 +1058,7 @@
(value_str ? strlen(value_str) : 0) + 7;
}
candidate = Xmalloc(len);
+ candidate[0] = 0;
if (label_str) {
switch (call_data->choices->label_decoration) {
case BRACKET_DECORATION:
@@ -1059,10 +1072,8 @@
break;
}
strcat(candidate, " ");
- strcat(candidate, value_str);
- } else {
- strcpy(candidate, value_str);
}
+ if (value_str) strcat(candidate, value_str);
len = strlen(candidate);
/* get wchar so that we can get the right extents */
@@ -1095,7 +1106,7 @@
}
lookup->candidateArray[i] = candidate;
- lookup->labelArray[i] = (char*)strdup(label_str);
+ lookup->labelArray[i] = (char*)strdup((label_str ? label_str : ""));
if (i % lookup->ncolumns == 0) {
realRow++;
}
xiiimp-close-candidate-146407.patch:
iiimcfFun.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletion(-)
--- NEW FILE xiiimp-close-candidate-146407.patch ---
diff -ur im-sdk-r12_1-svn2002.org/iiimxcf/xiiimp.so/iiimp/iiimcfFun.c im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/iiimcfFun.c
--- im-sdk-r12_1-svn2002.org/iiimxcf/xiiimp.so/iiimp/iiimcfFun.c 2004-06-05 04:44:15.000000000 +0900
+++ im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/iiimcfFun.c 2005-02-10 19:47:29.909728224 +0900
@@ -530,7 +530,9 @@
{
IIIMCF_event ev;
if (!ic) return False;
-
+ if (conv_mode == CONV_OFF) {
+ end_lookup_choice(ic);
+ }
if (iiimcf_create_trigger_notify_event(conv_mode, &ev)
!= IIIMF_STATUS_SUCCESS) return False;
xiiimp-close-on-reset-svn2543-146407.patch:
iiimcfFun.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletion(-)
--- NEW FILE xiiimp-close-on-reset-svn2543-146407.patch ---
diff -ur im-sdk-r12_1-svn2002.org/iiimxcf/xiiimp.so/iiimp/iiimcfFun.c im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/iiimcfFun.c
--- im-sdk-r12_1-svn2002.org/iiimxcf/xiiimp.so/iiimp/iiimcfFun.c 2004-06-05 04:44:15.000000000 +0900
+++ im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/iiimcfFun.c 2005-02-10 19:47:29.909728224 +0900
@@ -530,7 +530,9 @@
{
IIIMCF_event ev;
if (!ic) return False;
-
+ if (conv_mode == CONV_OFF) {
+ end_lookup_choice(ic);
+ }
if (iiimcf_create_trigger_notify_event(conv_mode, &ev)
!= IIIMF_STATUS_SUCCESS) return False;
xiiimp-pango.patch:
configure.ac | 12 +
iiimp/Makefile.am | 3
iiimp/XimpConv.c | 2
iiimp/codeinput.c | 11 -
iiimp/guiIMLookup.c | 476 ++++++++++++++++++++++++++++++++++++++++++++----
iiimp/guiIMLookup.h | 18 +
iiimp/guiIMSts.c | 137 +++++++++++++
iiimp/guiIMSts.h | 16 +
iiimp/guiIMStsArea.c | 19 +
iiimp/guiIMStsNothing.c | 20 +-
iiimp/iiimpAux.c | 3
iiimp/iiimpColor.c | 56 +++++
iiimp/iiimpColor.h | 15 +
iiimp/popupIM.c | 149 +++++++++++++++
iiimp/popupIM.h | 16 +
iiimp/xfactory.c | 43 ++++
iiimp/xfactory.h | 10 +
17 files changed, 952 insertions(+), 54 deletions(-)
--- NEW FILE xiiimp-pango.patch ---
diff -ruN im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/configure.ac im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/configure.ac
--- im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/configure.ac 2005-07-27 22:54:41.000000000 +0900
+++ im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/configure.ac 2005-07-27 22:55:01.000000000 +0900
@@ -58,6 +58,16 @@
IM_CHECK_X
IM_CHECK_XUTF8API
+AC_ARG_ENABLE(pango,
+ AC_HELP_STRING([--disable-pango],
+ [Do not build against Pango for glyph rendering.]),
+ [enable_pango=$enableval],
+ [enable_pango=yes])
+if test "x$enable_pango" = "xyes"; then
+ PKG_CHECK_MODULES(PANGO, pangoxft pango,
+ AC_DEFINE(HAVE_PANGO,,[enable Pango support]))
+fi
+
# Checks for library functions.
#AC_FUNC_MALLOC
#AC_FUNC_STAT
@@ -101,6 +111,8 @@
AC_SUBST(XIIIMP_MAJOR_VERSION)
AC_SUBST(XIIIMP_MINOR_VERSION)
AC_SUBST(XIIIMP_SOX18N_VERSION)
+AC_SUBST(PANGO_CFLAGS)
+AC_SUBST(PANGO_LIBS)
AC_OUTPUT(Makefile iiimp/Makefile)
diff -ruN im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/Makefile.am im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/Makefile.am
--- im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/Makefile.am 2004-03-23 07:37:51.000000000 +0900
+++ im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/Makefile.am 2005-07-27 22:55:01.000000000 +0900
@@ -1,7 +1,7 @@
moduledir = $(IMDIR)
xiiimp_la_CFLAGS = $(X_CFLAGS) -I$(X_PRIVATEINC) \
$(SHLIBCFLAGS) $(THREAD_CXX_CFLAGS) \
- -I$(CSCONV_DIR)
+ -I$(CSCONV_DIR) $(PANGO_CFLAGS)
xiiimp_la_LDFLAGS = -rpath $(moduledir) -version-info $(XIIIMP_SOX18N_VERSION) \
-module -export-dynamic -no-undefined
# On GNU/Linux system, libtool does not take care of -no-undefined so that
@@ -10,6 +10,7 @@
xiiimp_la_LIBADD = $(X_LIBS) \
$(IM_LIBDIR)/iiimcf/libiiimcf.la \
$(IM_LIBDIR)/iiimp/libiiimp.la \
+ $(PANGO_LIBS) \
$(DLOPEN_LIBS) $(THREAD_LIBS)
xiiimp_la_SOURCES = \
genutil.c \
diff -ruN im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/XimpConv.c im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/XimpConv.c
--- im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/XimpConv.c 2005-07-27 22:54:41.000000000 +0900
+++ im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/XimpConv.c 2005-07-27 22:55:01.000000000 +0900
@@ -233,7 +233,7 @@
static unsigned char look[BUF_SIZE] = {0}; /* Clean up bss */
#ifndef MAXINT
-#define MAXINT (~((unsigned int)1 << (8 * sizeof(int)) - 1))
+#define MAXINT (~((unsigned int)1 << ((8 * sizeof(int)) - 1)))
#endif /* !MAXINT */
Public int
diff -ruN im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/codeinput.c im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/codeinput.c
--- im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/codeinput.c 2004-05-05 03:55:05.000000000 +0900
+++ im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/codeinput.c 2005-07-27 22:55:01.000000000 +0900
@@ -90,7 +90,7 @@
hook = (LocalPreeditExt *)(ic->local_icpart->preedit_ext);
}
{
- XIMCallback *cb = &ic->core.preedit_attr.start_callback;
+ XIMCallback *cb = (XIMCallback *)&ic->core.preedit_attr.start_callback;
int max_len = -1;
if (cb->callback &&
ic->core.input_style & XIMPreeditCallbacks)
@@ -178,8 +178,7 @@
preedit_draw.feedback_list = 0;
{
- XIMCallback *cb;
- cb = &ic->core.preedit_attr.draw_callback;
+ XIMCallback *cb = (XIMCallback *)&ic->core.preedit_attr.draw_callback;
if (cb->callback &&
ic->core.input_style & XIMPreeditCallbacks)
(*cb->callback)((XIC)ic, cb->client_data, (XPointer)&call_data);
@@ -210,8 +209,7 @@
preedit_draw.feedback_list = 0;
{
- XIMCallback *cb;
- cb = &ic->core.preedit_attr.draw_callback;
+ XIMCallback *cb = (XIMCallback *)&ic->core.preedit_attr.draw_callback;
if (cb->callback &&
ic->core.input_style & XIMPreeditCallbacks)
(*cb->callback)((XIC)ic, cb->client_data, (XPointer)&call_data);
@@ -221,8 +219,7 @@
}
}
{
- XIMCallback *cb;
- cb = &ic->core.preedit_attr.done_callback;
+ XIMCallback *cb = (XIMCallback *)&ic->core.preedit_attr.done_callback;
if (cb->callback &&
ic->core.input_style & XIMPreeditCallbacks)
(*cb->callback)((XIC)ic, cb->client_data, NULL);
diff -ruN im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/guiIMLookup.c im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/guiIMLookup.c
--- im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/guiIMLookup.c 2005-07-27 22:54:41.000000000 +0900
+++ im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/guiIMLookup.c 2005-07-27 22:55:01.000000000 +0900
@@ -39,6 +39,9 @@
Sun Microsystems, Inc. or its licensors is granted.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include "xiiimp.h"
#include "iiimpIM.h"
#include "iiimpColor.h"
@@ -51,6 +54,10 @@
#include <X11/keysym.h>
#include "trace_message.h"
#include <stdio.h>
+#ifdef HAVE_PANGO
+#include <wchar.h>
+#include <pango/pangoxft.h>
+#endif /* HAVE_PANGO */
static void doneProc(XicCommon ic, XPointer p);
@@ -58,6 +65,157 @@
static void UpdateLookup(XicCommon);
static void highlightCandidate(XicCommon ic, int, Bool highlight);
+#ifdef HAVE_PANGO
+static void
+get_string_pixel_size(XicCommon ic,
+ LookupWin lookup,
+ const char *string,
+ size_t length,
+ int *width,
+ int *height)
+{
+ PangoLayout *layout = pango_layout_new(lookup->context);
+
+ if (string == NULL || length == 0) {
+ *width = 0;
+ *height = 0;
+ return;
+ }
+ if (lookup->font == NULL)
+ XFactoryCreateDefaultPangoFontDescription(XIM_IIIMP(ic->core.im, default_font_name));
+ pango_layout_set_font_description(layout, lookup->font);
+ pango_layout_set_text(layout, string, length);
+ pango_layout_get_pixel_size(layout, width, height);
+ g_object_unref(layout);
+}
+
+static void
+set_line_attribute_for_pango(XicCommon ic,
+ LookupWin lookup,
+ XIMFeedback feedback,
+ const char *string,
+ int idx,
+ int *start_index)
+{
+ PangoAttrList *attrs = pango_layout_get_attributes(lookup->layout);
+ PangoAttribute *fg_attr, *bg_attr;
+
+ if (feedback & XIMReverse) {
+ fg_attr = pango_attr_foreground_new(lookup->bg.color.red,
+ lookup->bg.color.green,
+ lookup->bg.color.blue);
+ bg_attr = pango_attr_background_new(lookup->fg.color.red,
+ lookup->fg.color.green,
+ lookup->fg.color.blue);
+ } else {
+ fg_attr = pango_attr_foreground_new(lookup->fg.color.red,
+ lookup->fg.color.green,
+ lookup->fg.color.blue);
+ bg_attr = pango_attr_background_new(lookup->bg.color.red,
+ lookup->bg.color.green,
+ lookup->bg.color.blue);
+ }
+ if (lookup->nrows == 1) {
+ size_t len = strlen(lookup->candidateArray[idx]);
+
+ fg_attr->start_index = *start_index;
+ fg_attr->end_index = *start_index + len;
+ pango_attr_list_change(attrs, fg_attr);
+ bg_attr->start_index = *start_index;
+ bg_attr->end_index = *start_index + len;
+ pango_attr_list_change(attrs, bg_attr);
+ *start_index += len + 1;
+ } else {
+ PangoLayoutLine *line = pango_layout_get_line(lookup->layout, idx);
+
+ fg_attr->start_index = line->start_index;
+ fg_attr->end_index = line->start_index + line->length;
+ pango_attr_list_change(attrs, fg_attr);
+ bg_attr->start_index = line->start_index;
+ bg_attr->end_index = line->start_index + line->length;
+ pango_attr_list_change(attrs, bg_attr);
+ }
+ pango_layout_set_attributes(lookup->layout, attrs);
+}
+
+static char *
+convert_string_to_utf8(XimCommon im, char *string, int length)
+{
+ gchar *retval;
+ wchar_t *wcstr;
+ size_t len;
+
+ if (string == NULL)
+ return NULL;
+ len = strlen(string);
+ if (len <= 0)
+ return NULL;
+ wcstr = (wchar_t *)malloc(sizeof (wchar_t) * (len + 1));
+ if (IIimpMbstoWcs(im, string, len, wcstr, len, NULL) == 0) {
+ free(wcstr);
+ return NULL;
+ }
+ wcstr[length] = 0;
+ retval = g_ucs4_to_utf8((gunichar *)wcstr, len, NULL, NULL, NULL);
+ free(wcstr);
+
+ return retval;
+}
+
+static void
+set_line_attribute2_for_pango(XicCommon ic,
+ LookupWin lookup,
+ const char *string,
+ XIMChoiceObject2 *choice,
+ int idx,
+ int *start_index)
+{
+ XIMText *label = &choice->label[idx];
+ XIMText *value = &choice->value[idx];
+ IMFeedbackList *pfeedback;
+ PangoAttrList *attrs = pango_layout_get_attributes(lookup->layout);
+ PangoLayoutLine *line = NULL;
+ int i, j;
+ glong size = 0L;
+
+ if (lookup->nrows == 1) {
+ size = *start_index;
+ } else {
+ line = pango_layout_get_line(lookup->layout, idx);
+ size = g_utf8_strlen(string, line->start_index);
+ }
+ /* label */
+ for (pfeedback = choice->label_feedback[idx], i = 0; i < label->length; i++, pfeedback++) {
+ for (j = 1; j < (label->length - i); j++, pfeedback++) {
+ if (SameIMFeedbackList(pfeedback - 1, pfeedback) == False)
+ break;
+ }
+ set_attributes_for_pango(ic, ic->core.im->core.display,
+ pfeedback, attrs, string,
+ size + i,
+ size + j);
+ pango_layout_set_attributes(lookup->layout, attrs);
+ i += j;
+ }
+ size += label->length;
+ /* space */
+ size++;
+
+ /* value */
+ for (pfeedback = choice->value_feedback[idx], i = 0; i < value->length; pfeedback++) {
+ for (j = 1; j < (value->length - i); j++, pfeedback++) {
+ if (SameIMFeedbackList(pfeedback, pfeedback + 1) == False)
+ break;
+ }
+ set_attributes_for_pango(ic, ic->core.im->core.display,
+ pfeedback, attrs, string,
+ size + i,
+ size + j);
+ pango_layout_set_attributes(lookup->layout, attrs);
+ }
+ *start_index = size;
+}
+#else /* !HAVE_PANGO */
static void
DrawLookupString(Display *display, Window win, XFontSet fontset,
GC gc, GC rgc, XIMFeedback feedback,
@@ -158,6 +316,7 @@
error:
return;
}
+#endif /* HAVE_PANGO */
#if 0
#define xMargin 5
@@ -182,6 +341,42 @@
return value;
}
+#ifdef HAVE_PANGO
+static int
+getChoiceIndex(XicCommon ic, XEvent *event)
+{
+ LookupWin lookup = (LookupWin)(ic->gui_icpart->lookup);
+ int x = event->xbutton.x, y = event->xbutton.y;
+ int w, h;
+ int idx, i;
+
+ if (lookup == NULL)
+ return -1;
+
+ pango_layout_xy_to_index(lookup->layout, x * PANGO_SCALE, y * PANGO_SCALE, &idx, NULL);
+ if (lookup->nrows == 1) {
+ for (i = 0, w = 0; i < lookup->ncolumns; i++) {
+ w += strlen(lookup->candidateArray[i]) + 1;
+ if (idx < w)
+ break;
+ }
+ idx = i;
+ } else {
+ /*
+ * assuming that lookup->ncolumns should be 1
+ * not sure if multiple rows and multiple columns is possible.
+ */
+ for (i = 0, h = 0; i < lookup->nrows; i++) {
+ h += strlen(lookup->candidateArray[i]) + 1;
+ if (idx < h)
+ break;
+ }
+ idx = i;
+ }
+
+ return idx;
+}
+#else /* !HAVE_PANGO */
static int
getChoiceIndex(XicCommon ic, XEvent *event) {
LookupWin lookup = (LookupWin)(ic->gui_icpart->lookup);
@@ -226,6 +421,7 @@
return idx;
}
+#endif /* HAVE_PANGO */
static void
selectCandidate(XicCommon ic, int idx) {
@@ -261,7 +457,7 @@
index + 1 to keysym value */
keysym = XK_0 + idx + 1;
}
-
+
ev.xkey.x = 0;
ev.xkey.y = 0;
ev.xkey.x_root = 0;
@@ -351,6 +547,94 @@
return True;
}
+#ifdef HAVE_PANGO
+static void
+highlightCandidate(XicCommon ic, int highlight_index, Bool highlight)
+{
+ LookupWin lookup = (LookupWin)(ic->gui_icpart->lookup);
+
+ lookup->previous = lookup->highlight_index;
+ lookup->current = highlight_index;
+
+ if (highlight_index == lookup->highlight_index) {
+ /* nothing changed */
+ return;
+ }
+
+ UpdateLookup(ic);
+
+ if (highlight) {
+ lookup->highlight_index = highlight_index;
+ } else {
+ lookup->highlight_index = -1;
+ }
+}
+
+static void
+UpdateLookup(XicCommon ic)
+{
+ LookupWin lookup = (LookupWin)(ic->gui_icpart->lookup);
+ int current_columns = lookup->ncolumns, x = xMargin, y = yMargin, i, baseline, start_index;
+ GString *strings = g_string_new(NULL);
+ PangoAttrList *attrs = NULL;
+ PangoLayoutLine *line;
+ PangoRectangle logrect;
+ PangoLayoutIter *iter = NULL;
+
+ if (lookup->candidates == NULL || lookup->length == 0)
+ return;
+ if (lookup->ncolumns > lookup->length)
+ current_columns = lookup->length;
+ if (lookup->redraw & CONTENTS)
+ XClearArea(ic->core.im->core.display, lookup->window, 0, 0, 0, 0, False);
+
+ if (lookup->nrows == 1) {
+ for (i = 0; i < lookup->length; i++)
+ g_string_append_printf(strings, "%s ", lookup->candidateArray[i]);
+ } else {
+ for (i = 0; i < lookup->length; i++)
+ g_string_append_printf(strings, "%s\n", lookup->candidateArray[i]);
+ }
+ pango_layout_set_font_description(lookup->layout, lookup->font);
+ pango_layout_set_text(lookup->layout, strings->str, strings->len);
+
+ /* set attributes */
+ attrs = pango_attr_list_new();
+ pango_layout_set_attributes(lookup->layout, attrs);
+ for (i = 0, start_index = 0; i < lookup->length; i++) {
+ if (lookup->candidates->label_feedback != NULL &&
+ lookup->candidates->value_feedback != NULL &&
+ lookup->candidates->label_feedback[i] != NULL &&
+ lookup->candidates->value_feedback[i] != NULL) {
+ set_line_attribute2_for_pango(ic, lookup, strings->str, lookup->candidates, i, &start_index);
+ } else {
+ if (i == lookup->current) {
+ set_line_attribute_for_pango(ic, lookup, XIMReverse, strings->str, i, &start_index);
+ } else {
+ set_line_attribute_for_pango(ic, lookup, 0, strings->str, i, &start_index);
+ }
+ }
+ }
+ for (i = 0, iter = pango_layout_get_iter(lookup->layout);
+ i < lookup->length && iter != NULL;
+ i++, pango_layout_iter_next_line(iter)) {
+ line = pango_layout_iter_get_line(iter);
+ pango_layout_iter_get_line_extents(iter, NULL, &logrect);
+ baseline = pango_layout_iter_get_baseline(iter);
+ if (i == lookup->current) {
+ pango_xft_render_layout_line(lookup->xftdraw, &lookup->bg, line, x, y + baseline);
+ } else {
+ pango_xft_render_layout_line(lookup->xftdraw, &lookup->fg, line, x, y + baseline);
+ }
+ }
+ if (iter != NULL)
+ pango_layout_iter_free(iter);
+ lookup->redraw = DRAW_ALL;
+
+ pango_attr_list_unref(attrs);
+ g_string_free(strings, TRUE);
+}
+#else /* !HAVE_PANGO */
static void
UpdateLookup(XicCommon ic) {
LookupWin lookup = (LookupWin)(ic->gui_icpart->lookup);
@@ -491,6 +775,7 @@
return;
}
+#endif /* HAVE_PANGO */
static Bool
SetupLookupExt(XicCommon ic) {
@@ -511,12 +796,17 @@
Display *display = ic->core.im->core.display;
Window parent, win;
unsigned long fg, bg;
+#ifndef HAVE_PANGO
unsigned long val_mask;
XGCValues gcval;
+#endif /* !HAVE_PANGO */
LookupWin lookup = (LookupWin)(ic->gui_icpart->lookup);
XIMFilterRec filters[10];
int n;
XClassHint class_hint;
+#ifdef HAVE_PANGO
+ int screen = DefaultScreen(display);
+#endif /* HAVE_PANGO */
TRACE_MESSAGE('l', ("SetupLookupWindow: 0x%08x\n", lookup->window));
@@ -585,6 +875,22 @@
lookup->window = win;
+#ifdef HAVE_PANGO
+ lookup->xftdraw = XftDrawCreate(display, lookup->window,
+ DefaultVisual(display, screen),
+ DefaultColormap(display, screen));
+ lookup->fg.color.red = 0;
+ lookup->fg.color.green = 0;
+ lookup->fg.color.blue = 0;
+ lookup->fg.color.alpha = 0xffff;
+ lookup->bg.color.red = 0xffff;
+ lookup->bg.color.green = 0xffff;
+ lookup->bg.color.blue = 0xffff;
+ lookup->bg.color.alpha = 0xffff;
+ lookup->context = pango_xft_get_context(display, screen);
+ lookup->layout = pango_layout_new(lookup->context);
+ lookup->font = XFactoryCreateDefaultPangoFontDescription(XIM_IIIMP(ic->core.im, default_font_name));
+#else /* !HAVE_PANGO */
val_mask = GCForeground | GCBackground;
gcval.foreground = fg;
gcval.background = bg;
@@ -606,6 +912,7 @@
XIM_IIIMP(ic->core.im, default_font_name));
lookup->need_free_fontset = True;
}
+#endif /* HAVE_PANGO */
return True;
}
@@ -615,18 +922,23 @@
LookupWin lookup = (LookupWin)(ic->gui_icpart->lookup);
XPoint point;
int x = 0, y = 0; /* default */
+#ifdef HAVE_PANGO
+ int width = 0, height = 0;
+#endif /* HAVE_PANGO */
point.x = point.y = 0; /* default */
- if (XIMP_CHK_PREAREAMASK(ic)) {
- x = ic->core.preedit_attr.area.x;
- y = ic->core.preedit_attr.area.y;
- XFactoryGetLocationOnScreen(ic->core.im->core.display,
- ic->core.client_window, x, y, &point);
- } else if (XIMP_CHK_PRESPOTLMASK(ic)) {
+ if (XIMP_CHK_PRESPOTLMASK(ic)) {
point.x = -1;
point.y = -1;
PreeditCaretPlacement(ic, &point);
if ((-1 == point.x) && (-1 == point.y)) {
+#ifdef HAVE_PANGO
+ x = ic->core.preedit_attr.spot_location.x;
+ y = ic->core.preedit_attr.spot_location.y;
+ get_string_pixel_size(ic, lookup, " ", 1, &width, &height);
+ y += height;
+ y += yMargin;
+#else /* !HAVE_PANGO */
XFontSetExtents *fse;
fse = XExtentsOfFontSet(lookup->fontset);
@@ -634,12 +946,18 @@
y = ic->core.preedit_attr.spot_location.y;
y += (fse->max_logical_extent.height + fse->max_logical_extent.y);
y += yMargin;
+#endif /* HAVE_PANGO */
XFactoryGetLocationOnScreen(ic->core.im->core.display,
ic->core.focus_window, x, y, &point);
} else {
point.y += 4; /* offset */
}
+ } else if (XIMP_CHK_PREAREAMASK(ic)) {
+ x = ic->core.preedit_attr.area.x;
+ y = ic->core.preedit_attr.area.y;
+ XFactoryGetLocationOnScreen(ic->core.im->core.display,
+ ic->core.client_window, x, y, &point);
} else {
Window parent;
Window root;
@@ -656,6 +974,7 @@
point.y += border_width_return;
}
+#ifndef HAVE_PANGO
if (lookup->fontset) {
XFontSetExtents *fse;
fse = XExtentsOfFontSet(lookup->fontset);
@@ -667,6 +986,7 @@
lookup->column_height = height;
}
}
+#endif /* !HAVE_PANGO */
x = point.x;
y = point.y;
@@ -769,12 +1089,12 @@
FreeLookupData(LookupWin lookup) {
if (lookup->array_size == 0) return;
- if (lookup->n_choices && lookup->candidates) {
+ if (lookup->length && lookup->candidates) {
XIMText *label = lookup->candidates->label;
XIMText *value = lookup->candidates->value;
int i;
- for (i = 0; i < lookup->n_choices; i++) {
+ for (i = 0; i < lookup->length; i++) {
if (lookup->candidates->label_feedback)
FreeFeedbackList(lookup->candidates->label_feedback[i],
label[i].length);
@@ -827,6 +1147,23 @@
return;
}
+#ifdef HAVE_PANGO
+static void
+CopyXIMText(XicCommon ic, XIMText *to, XIMText *from)
+{
+ to->length = from->length;
+ to->encoding_is_wchar = False;
+ to->feedback = Xmalloc(sizeof (XIMFeedback) * to->length);
+
+ if (from->encoding_is_wchar == False) {
+ to->string.multi_byte = convert_string_to_utf8((XimCommon)ic->core.im, from->string.multi_byte, to->length);
+ } else {
+ to->string.multi_byte = g_ucs4_to_utf8((gunichar *)from->string.wide_char, wcslen(from->string.wide_char), NULL, NULL, NULL);
+ }
+ memmove((void *)(to->feedback), (void *)(from->feedback),
+ sizeof (XIMFeedback) * to->length);
+}
+#else /* !HAVE_PANGO */
static void
CopyXIMText(XicCommon ic, XIMText *to, XIMText *from) {
to->length = from->length;
@@ -859,19 +1196,25 @@
sizeof(XIMFeedback) * to->length);
return;
}
+#endif /* HAVE_PANGO */
static Bool
CopyLookupData(XicCommon ic, LookupWin lookup,
XIMLookupDrawCallbackStruct2 *call_data) {
- int i;
+ int i, j;
char *candidate;
int len;
int realRow = 0;
- int temp;
+ int cand_width = 0;
char *value_str, *label_str;
XIMText *value;
XIMText *label;
IMFeedbackList **value_flist, **label_flist;
+ int actual_width = 0;
+#ifdef HAVE_PANGO
+ int height = 0, total_height = 0, width = 0;
+ GString *str = g_string_new(NULL);
+#endif /* HAVE_PANGO */
if (lookup->array_size == 0) {
lookup->array_size = 26; /* init size */
@@ -892,8 +1235,8 @@
return False;
}
- lookup->candidates->label = Xmalloc(sizeof(XIMText) * lookup->n_choices);
- lookup->candidates->value = Xmalloc(sizeof(XIMText) * lookup->n_choices);
+ lookup->candidates->label = Xmalloc(sizeof(XIMText) * lookup->length);
+ lookup->candidates->value = Xmalloc(sizeof(XIMText) * lookup->length);
if (!lookup->candidates->label || !lookup->candidates->value) {
/* something wrong */
@@ -902,18 +1245,18 @@
if (call_data->choices->label_feedback &&
call_data->choices->value_feedback) {
lookup->candidates->label_feedback =
- Xmalloc(sizeof(IMFeedbackList*) * lookup->n_choices);
+ Xmalloc(sizeof(IMFeedbackList*) * lookup->length);
lookup->candidates->value_feedback =
- Xmalloc(sizeof(IMFeedbackList*) * lookup->n_choices);
+ Xmalloc(sizeof(IMFeedbackList*) * lookup->length);
if(!lookup->candidates->label_feedback ||
!lookup->candidates->value_feedback) {
/* something wrong */
return False;
}
memset(lookup->candidates->label_feedback, 0,
- sizeof(IMFeedbackList*) * lookup->n_choices);
+ sizeof(IMFeedbackList*) * lookup->length);
memset(lookup->candidates->value_feedback, 0,
- sizeof(IMFeedbackList*) * lookup->n_choices);
+ sizeof(IMFeedbackList*) * lookup->length);
} else {
lookup->candidates->label_feedback = 0;
lookup->candidates->value_feedback = 0;
@@ -925,20 +1268,20 @@
value_flist = lookup->candidates->value_feedback;
lookup->maxWidth = 0;
- for (i = 0; i < lookup->n_choices; i++) {
- CopyXIMText(ic, &(label[i]), &(call_data->choices->label[i]));
- CopyXIMText(ic, &(value[i]), &(call_data->choices->value[i]));
+ for (i = lookup->first, j = 0; i < lookup->last + 1 && i < lookup->n_choices; i++, j++) {
+ CopyXIMText(ic, &(label[j]), &(call_data->choices->label[i]));
+ CopyXIMText(ic, &(value[j]), &(call_data->choices->value[i]));
if (label_flist)
- CopyFeedbackList(ic, &(label_flist[i]),
+ CopyFeedbackList(ic, &(label_flist[j]),
call_data->choices->label_feedback[i],
- label[i].length);
+ label[j].length);
if (value_flist)
- CopyFeedbackList(ic, &(value_flist[i]),
+ CopyFeedbackList(ic, &(value_flist[j]),
call_data->choices->value_feedback[i],
- value[i].length);
+ value[j].length);
- label_str = label[i].string.multi_byte;
- value_str = value[i].string.multi_byte;
+ label_str = label[j].string.multi_byte;
+ value_str = value[j].string.multi_byte;
if (call_data->choices->label_decoration != NO_DECORATION) {
len = (label_str ? strlen(label_str) : 0) +
(value_str ? strlen(value_str) : 0) + 5;
@@ -964,12 +1307,24 @@
}
if (value_str) strcat(candidate, value_str);
len = strlen(candidate);
- if (lookup->maxWidth < (temp = XmbTextEscapement(lookup->fontset,
- candidate, len))) {
- lookup->maxWidth = temp;
- }
- lookup->candidateArray[i] = candidate;
- lookup->labelArray[i] = (char*)strdup((label_str ? label_str : ""));
+#ifdef HAVE_PANGO
+ if (lookup->nrows == 1)
+ g_string_append_printf(str, "%s ", candidate);
+ get_string_pixel_size(ic, lookup, candidate, len, &cand_width, &height);
+ total_height += height;
+ if (lookup->maxWidth < cand_width)
+ lookup->maxWidth = cand_width;
+#else /* !HAVE_PANGO */
+ if (lookup->maxWidth < (cand_width = XmbTextEscapement(lookup->fontset,
+ candidate, len))) {
+ lookup->maxWidth = cand_width;
+ }
+#endif /* HAVE_PANGO */
+ actual_width += cand_width;
+
+ lookup->candidateArray[j] = candidate;
+ lookup->labelArray[j] = (char*)strdup((label_str ? label_str : ""));
+ lookup->candWidth[j] = cand_width;
if (i % lookup->ncolumns == 0) {
realRow++;
}
@@ -980,11 +1335,32 @@
lookup->maxWidth = (lookup->title_width / lookup->ncolumns);
}
- lookup->width = (lookup->maxWidth + cMargin) * (lookup->length > lookup->ncolumns ?
+#ifdef HAVE_PANGO
+ if (lookup->nrows == 1) {
+ get_string_pixel_size(ic, lookup, str->str, str->len, &width, &height);
+ lookup->width = width;
+ } else {
+ lookup->width = (lookup->maxWidth + cMargin) * (lookup->length > lookup->ncolumns ?
+ lookup->ncolumns : lookup->length);
+ }
+ lookup->column_height = total_height / lookup->n_choices;
+ if (lookup->nrows == 1)
+ lookup->height = lookup->column_height;
+ else
+ lookup->height = total_height;
+ g_string_free(str, TRUE);
+ resizeLookupWindow(ic);
+#else /* !HAVE_PANGO */
+ if (lookup->nrows == 1)
+ lookup->width = actual_width + cMargin * (lookup->length > lookup->ncolumns ?
lookup->ncolumns : lookup->length);
+ else
+ lookup->width = (lookup->maxWidth + cMargin) * (lookup->length > lookup->ncolumns ?
+ lookup->ncolumns : lookup->length);
lookup->height = (lookup->column_height + cMargin) * realRow;
lookup->width -= cMargin;
lookup->height -= cMargin;
+#endif /* HAVE_PANGO */
return True;
}
@@ -998,7 +1374,7 @@
if (lookup->length == (call_data->last_index - call_data->first_index + 1) &&
DRAW_NOTHING == (lookup->redraw = CompareLookupData(lookup->candidates,
- lookup->first,
+ 0,
call_data->choices,
call_data->first_index,
lookup->length))) {
@@ -1008,18 +1384,19 @@
lookup->n_choices = call_data->n_choices;
lookup->first = call_data->first_index;
lookup->last = call_data->last_index;
+ if (lookup->last >= lookup->n_choices) {
+ /* is this a bug? */
+ lookup->last = lookup->n_choices - 1;
+ }
lookup->length = lookup->last - lookup->first + 1;
- if (lookup->length != lookup->n_choices)
- fprintf(stderr, "something is wrong?\n");
-
if (!CopyLookupData(ic, lookup, call_data)) {
DestroyLookup(ic, NULL);
return;
}
}
lookup->previous = lookup->current;
- lookup->current = call_data->current_index;
+ lookup->current = call_data->current_index - lookup->first;
return;
}
@@ -1035,16 +1412,22 @@
if ((call_data->title != NULL) &&
(call_data->title->length != 0)) {
- int title_width;
+ int title_width = 0;
title_string = call_data->title->string.multi_byte;
if ((lookup->title_width <= 0) ||
((NULL != lookup->title) &&
(0 != strcmp(lookup->title, title_string)))) {
+#ifdef HAVE_PANGO
+ int height = 0;
+
+ get_string_pixel_size(ic, lookup, title_string, strlen(title_string), &title_width, &height);
+#else /* !HAVE_PANGO */
title_width = XmbTextEscapement(lookup->fontset,
title_string,
strlen(title_string));
+#endif /* HAVE_PANGO */
XFactoryRemoveDecorationExceptTitle(display, lookup->window);
free(lookup->title);
lookup->title = strdup(title_string);
@@ -1090,10 +1473,23 @@
if (!lookup) return;
+#ifdef HAVE_PANGO
+ if (lookup->xftdraw != NULL) {
+ XftDrawDestroy(lookup->xftdraw);
+ lookup->xftdraw = NULL;
+ }
+ if (lookup->layout != NULL) {
+ g_object_unref(lookup->layout);
+ lookup->layout = NULL;
+ }
+ if (lookup->font != NULL)
+ XFactoryFreeDefaultPangoFontDescription();
+#else /* !HAVE_PANGO */
if (lookup->fontset && lookup->need_free_fontset) {
XFactoryFreeDefaultFontSet (ic->core.im->core.display);
lookup->need_free_fontset = False;
}
+#endif /* HAVE_PANGO */
XDestroyWindow(ic->core.im->core.display,
lookup->window);
_XUnregisterFilter(ic->core.im->core.display, lookup->window,
@@ -1107,8 +1503,10 @@
_XUnregisterFilter(ic->core.im->core.display, lookup->window,
FilterButtonRelease, (XPointer)ic);
+#ifndef HAVE_PANGO
if (lookup->gc) XFreeGC(ic->core.im->core.display, lookup->gc);
if (lookup->rgc) XFreeGC(ic->core.im->core.display, lookup->rgc);
+#endif /* !HAVE_PANGO */
if (lookup->candidateArray) Xfree(lookup->candidateArray);
if (lookup->labelArray) Xfree(lookup->labelArray);
diff -ruN im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/guiIMLookup.h im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/guiIMLookup.h
--- im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/guiIMLookup.h 2001-03-16 00:52:22.000000000 +0900
+++ im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/guiIMLookup.h 2005-07-27 22:55:27.000000000 +0900
@@ -41,6 +41,14 @@
*/
#ifndef _guiIM_LOOKUP_h
#define _guiIM_LOOKUP_h
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#ifdef HAVE_PANGO
+#include <X11/Xft/Xft.h>
+#include <pango/pango-layout.h>
+#include <pango/pango-font.h>
+#endif /* HAVE_PANGO */
typedef enum {
DRAW_NOTHING = 0,
@@ -57,10 +65,19 @@
int y;
unsigned int width;
unsigned int height;
+#ifndef HAVE_PANGO
GC gc;
GC rgc;
XFontSet fontset;
Bool need_free_fontset;
+#else /* HAVE_PANGO */
+ XftDraw *xftdraw;
+ XftColor fg;
+ XftColor bg;
+ PangoContext *context;
+ PangoLayout *layout;
+ PangoFontDescription *font;
+#endif /* !HAVE_PANGO */
int nrows;
int ncolumns;
int choice_per_window;
@@ -69,6 +86,7 @@
XIMChoiceObject2 *candidates;
char **candidateArray;
char **labelArray;
+ int *candWidth;
/* for drawing cache */
LUCUpdate redraw;
int first;
diff -ruN im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/guiIMSts.c im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/guiIMSts.c
--- im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/guiIMSts.c 2004-08-25 15:09:50.000000000 +0900
+++ im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/guiIMSts.c 2005-07-27 22:55:01.000000000 +0900
@@ -46,6 +46,9 @@
#include "XimpIm.h"
#include "xfactory.h"
#include <X11/Xatom.h>
+#ifdef HAVE_PANGO
+#include <pango/pangoxft.h>
+#endif /* HAVE_PANGO */
static void UpdateStatus(XicCommon ic, Bool);
char *MergeStatus(XicCommon ic);
@@ -93,6 +96,42 @@
return False;
}
+#ifdef HAVE_PANGO
+static void
+draw_status_string_for_pango(XicCommon ic,
+ StatusWin status,
+ const char *string,
+ int length)
+{
+ IMFeedbackList *pfeedback;
+ int i;
+ PangoAttrList *attrs;
+
+ if (status->feedback != NULL) {
+ attrs = pango_attr_list_new();
+
+ for (i = 0, pfeedback = status->feedback;
+ i < status->text.length;
+ i++, pfeedback++) {
+ set_attributes_for_pango(ic, ic->core.im->core.display,
+ pfeedback, attrs, string, i, i + 1);
+ }
+ pango_layout_set_attributes(status->layout, attrs);
+ pango_attr_list_unref(attrs);
+ } else {
+ attrs = pango_attr_list_new();
+ pango_layout_set_attributes(status->layout, attrs);
+ pango_attr_list_unref(attrs);
+ }
+ pango_layout_set_font_description(status->layout, status->font);
+ pango_layout_set_text(status->layout, string, length);
+ pango_xft_render_layout(status->xftdraw,
+ &status->xftcolor,
+ status->layout,
+ status->x,
+ status->y);
+}
+#else /* !HAVE_PANGO */
static void
DrawStatusString(XicCommon ic,
Display *display, Window win, XFontSet fontset,
@@ -131,6 +170,7 @@
error:
XmbDrawString(display, win, fontset, gc, x, y, str, str_len);
}
+#endif /* HAVE_PANGO */
#if defined(USE_FILTER_KEY_PRESS_IN_STATUS)
static Bool
@@ -172,12 +212,15 @@
memset(&status->status_cache, 0, sizeof(CacheRec));
+#ifndef HAVE_PANGO
status->need_free_fontset = False;
+#endif /* HAVE_PANGO */
ic->gui_icpart->status = (void *)status;
return True;
}
+#ifndef HAVE_PANGO
static void
CreateGC(XicCommon ic) {
StatusWin status = (StatusWin)(ic->gui_icpart->status);
@@ -220,23 +263,30 @@
#endif
return;
}
+#endif /* !HAVE_PANGO */
void
UpdateStatus(XicCommon ic, Bool doCache) {
StatusWin status = (StatusWin)(ic->gui_icpart->status);
int len;
char * status_string;
- status_string = MergeStatus(ic);
- if (NULL == status_string) return;
- len = strlen(status_string);
+
if (!status->window) {
if (!SetupStatusWindow(ic, ic->core.client_window)) return;
}
+ status_string = MergeStatus(ic);
+ if (NULL == status_string) return;
+ len = strlen(status_string);
+#ifdef HAVE_PANGO
+ if (status->font == NULL)
+ SetStatusFont(ic, NULL);
+#else /* !HAVE_PANGO */
if (!status->fontset)
SetStatusFont(ic, NULL);
if (!status->fontset)
return;
+#endif /* HAVE_PANGO */
if (!MapStatusWindow(ic, status->window))
return;
@@ -250,6 +300,9 @@
XClearArea(ic->core.im->core.display, status->window, 0, 0, 0, 0, False);
+#ifdef HAVE_PANGO
+ draw_status_string_for_pango(ic, status, status_string, -1);
+#else /* !HAVE_PANGO */
if (!status->gc) {
CreateGC(ic);
if (!status->gc) return;
@@ -260,6 +313,7 @@
status->gc, status->x, status->y,
status_string, len,
status->feedback, status->text.length);
+#endif /* HAVE_PANGO */
/* status cache */
status->len = len;
@@ -281,6 +335,9 @@
XIMFilterRec filters[4];
int n;
unsigned int event_mask;
+#ifdef HAVE_PANGO
+ int screen = DefaultScreen(display);
+#endif /* HAVE_PANGO */
extern Bool popup_button_press(Display *d, Window w, XEvent *ev,
XPointer client_data);
@@ -381,6 +438,13 @@
status->window = win;
}
+#ifdef HAVE_PANGO
+ status->xftdraw = XftDrawCreate(display, status->window,
+ DefaultVisual(display, screen),
+ DefaultColormap(display, screen));
+ status->context = pango_xft_get_context(display, screen);
+ status->layout = pango_layout_new(status->context);
+#endif /* HAVE_PANGO */
#if 0
{
unsigned long val_mask;
@@ -400,6 +464,27 @@
return True;
}
+#ifdef HAVE_PANGO
+void
+SetStatusForeground(XicCommon ic, XPointer call_data)
+{
+}
+
+void
+SetStatusBackground(XicCommon ic, XPointer call_data)
+{
+}
+
+void
+SetStatusFont(XicCommon ic, XPointer call_data)
+{
+ StatusWin status = (StatusWin)(ic->gui_icpart->status);
+
+ if (status != NULL && status->font == NULL) {
+ status->font = XFactoryCreateDefaultPangoFontDescription(XIM_IIIMP(ic->core.im, default_font_name));
+ }
+}
+#else /* !HAVE_PANGO */
void
SetStatusForeground(XicCommon ic, XPointer call_data) {
StatusWin status = (StatusWin)(ic->gui_icpart->status);
@@ -503,6 +588,7 @@
}
return;
}
+#endif /* HAVE_PANGO */
void
StatusStart(XicCommon ic, XPointer call_data) {
@@ -602,10 +688,23 @@
if (!status) return;
+#ifdef HAVE_PANGO
+ if (status->xftdraw != NULL) {
+ XftDrawDestroy(status->xftdraw);
+ status->xftdraw = NULL;
+ }
+ if (status->layout != NULL) {
+ g_object_unref(status->layout);
+ status->layout = NULL;
+ }
+ if (status->font != NULL)
+ XFactoryFreeDefaultPangoFontDescription();
+#else /* !HAVE_PANGO */
if (status->fontset && status->need_free_fontset) {
XFactoryFreeDefaultFontSet (ic->core.im->core.display);
status->need_free_fontset = False;
}
+#endif /* HAVE_PANGO */
_XUnregisterFilter(ic->core.im->core.display, status->window,
RepaintStatus, (XPointer)ic);
#if defined(USE_FILTER_KEY_PRESS_IN_STATUS)
@@ -619,10 +718,12 @@
status->window = 0;
}
+#ifndef HAVE_PANGO
if (status->gc) XFreeGC(ic->core.im->core.display, status->gc);
#ifdef USE_STATUS_FEEDBACK
if (status->rgc) XFreeGC(ic->core.im->core.display, status->rgc);
#endif
+#endif /* !HAVE_PANGO */
if (status->text.string.multi_byte) {
Xfree(status->text.string.multi_byte);
}
@@ -635,6 +736,35 @@
return;
}
+#ifdef HAVE_PANGO
+char *
+MergeStatus(XicCommon ic)
+{
+ StatusWin status = (StatusWin)(ic->gui_icpart->status);
+ size_t len = 0;
+ wchar_t *status_string;
+ XimCommon im = (XimCommon)ic->core.im;
+ gchar *retval;
+
+ if (status == NULL)
+ return NULL;
+ if (status->text.string.multi_byte != NULL) {
+ len = strlen(status->text.string.multi_byte);
+ }
+ if (len <= 0)
+ return NULL;
+ status_string = (wchar_t *)malloc(sizeof (wchar_t) * (len + 1));
+ if (IIimpMbstoWcs(im, status->text.string.multi_byte, len, status_string, len, NULL) == 0) {
+ free(status_string);
+ return NULL;
+ }
+ status_string[status->text.length] = 0;
+ retval = g_ucs4_to_utf8((gunichar *)status_string, len, NULL, NULL, NULL);
+ free(status_string);
+
+ return retval;
+}
+#else /* !HAVE_PANGO */
char *
MergeStatus(XicCommon ic) {
StatusWin status = (StatusWin)(ic->gui_icpart->status);
@@ -660,3 +790,4 @@
*(status_string + len) = '\0';
return status_string;
}
+#endif /* HAVE_PANGO */
diff -ruN im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/guiIMSts.h im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/guiIMSts.h
--- im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/guiIMSts.h 2001-03-16 00:52:22.000000000 +0900
+++ im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/guiIMSts.h 2005-07-27 22:55:01.000000000 +0900
@@ -42,18 +42,34 @@
#ifndef _guiIM_STS_h
#define _guiIM_STS_h
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include "guiIM.h"
+#ifdef HAVE_PANGO
+#include <X11/Xft/Xft.h>
+#include <pango/pango-layout.h>
+#include <pango/pango-font.h>
+#endif /* HAVE_PANGO */
typedef void (*StatusCB)(XicCommon, XPointer);
typedef struct _StatusWinRec {
Window window;
+#ifndef HAVE_PANGO
GC gc;
#ifdef USE_STATUS_FEEDBACK
GC rgc;
#endif
XFontSet fontset;
Bool need_free_fontset;
+#else /* HAVE_PANGO */
+ XftDraw *xftdraw;
+ XftColor xftcolor;
+ PangoContext *context;
+ PangoLayout *layout;
+ PangoFontDescription *font;
+#endif /* !HAVE_PANGO */
XIMText text;
IMFeedbackList *feedback;
int x;
diff -ruN im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/guiIMStsArea.c im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/guiIMStsArea.c
--- im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/guiIMStsArea.c 2003-04-24 19:24:26.000000000 +0900
+++ im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/guiIMStsArea.c 2005-07-27 22:55:01.000000000 +0900
@@ -39,6 +39,9 @@
Sun Microsystems, Inc. or its licensors is granted.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include "xiiimp.h"
#include "guiIMSts.h"
#include "XimpIm.h"
@@ -90,6 +93,14 @@
status_cache = (CacheRec*)&(status->status_cache);
+#ifdef HAVE_PANGO
+ if (status_cache->win_x == ic->core.status_attr.area.x &&
+ status_cache->win_y == ic->core.status_attr.area.y &&
+ status_cache->win_width == ic->core.status_attr.area.width &&
+ status_cache->win_height == ic->core.status_attr.area.height) {
+ return;
+ }
+#else /* !HAVE_PANGO */
if (status_cache->win_x == ic->core.status_attr.area.x &&
status_cache->win_y == ic->core.status_attr.area.y &&
status_cache->win_width == ic->core.status_attr.area.width &&
@@ -97,9 +108,14 @@
status_cache->font_set == status->fontset) {
return;
}
+#endif /* HAVE_PANGO */
status->x = 0;
+#ifdef HAVE_PANGO
+ if (status->font == NULL)
+ SetStatusFont(ic, NULL);
+#else /* !HAVE_PANGO */
if (!status->fontset) {
SetStatusFont(ic, NULL);
}
@@ -114,6 +130,7 @@
} else {
status->y = ic->core.status_attr.area.height;
}
+#endif /* HAVE_PANGO */
if (!status->window)
SetupStatusWindow(ic, ic->core.client_window);
@@ -129,7 +146,9 @@
status_cache->win_y = ic->core.status_attr.area.y;
status_cache->win_width = ic->core.status_attr.area.width;
status_cache->win_height = ic->core.status_attr.area.height;
+#ifndef HAVE_PANGO
status_cache->font_set = status->fontset;
+#endif /* !HAVE_PANGO */
return;
}
diff -ruN im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/guiIMStsNothing.c im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/guiIMStsNothing.c
--- im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/guiIMStsNothing.c 2004-05-05 03:55:05.000000000 +0900
+++ im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/guiIMStsNothing.c 2005-07-27 22:55:01.000000000 +0900
@@ -39,6 +39,9 @@
Sun Microsystems, Inc. or its licensors is granted.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include "xiiimp.h"
#include "guiIMSts.h"
#include "XimpIm.h"
@@ -168,23 +171,38 @@
y = win_att.y;
y += win_att.height;
+#ifdef HAVE_PANGO
+ if (status->font == NULL)
+ SetStatusFont(ic, NULL);
+#else /* !HAVE_PANGO */
if (!status->fontset)
SetStatusFont(ic, NULL);
if (!status->fontset)
return;
+#endif /* HAVE_PANGO */
status_string = MergeStatus(ic);
len = ((NULL == status_string) ? 0 : strlen(status_string));
if (0 < len) {
+#ifdef HAVE_PANGO
+ PangoLayout *layout = pango_layout_new(status->context);
+
+ pango_layout_set_font_description(layout, status->font);
+ pango_layout_set_text(layout, status_string, len);
+ pango_layout_get_pixel_size(layout, &width, &height);
+ g_object_unref(layout);
+#else /* !HAVE_PANGO */
XFontSetExtents *fse;
fse = XExtentsOfFontSet(status->fontset);
width = XmbTextEscapement(status->fontset,
status_string,
len);
height = fse->max_logical_extent.height;
+#endif /* HAVE_PANGO */
}
- Xfree(status_string);
+ if (status_string != NULL)
+ Xfree(status_string);
/* avoid creating 0 width/height or too large status window */
if (width == 0 || width > 1000) width = 100;
if (height == 0 || height > 1000) height = 15;
diff -ruN im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/iiimpAux.c im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/iiimpAux.c
--- im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/iiimpAux.c 2005-07-27 22:54:41.000000000 +0900
+++ im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/iiimpAux.c 2005-07-27 22:55:01.000000000 +0900
@@ -168,6 +168,7 @@
aux_string_length(
const IIIMP_card16 *str
);
+static void show_AC(aux_data_t *pad);
/* faked "COMPOSED":-P structure. */
typedef struct {
@@ -1455,7 +1456,6 @@
const IIIMP_card16 **pstrs;
#ifdef ENABLE_TRACE
- static void show_AC(aux_data_t *pad);
show_AC(pac->pad);
#endif
if (pad->integer_count > 0) {
@@ -1517,7 +1517,6 @@
const IIIMP_card16 **pstrs;
#ifdef ENABLE_TRACE
- static void show_AC(aux_data_t *pad);
show_AC(pac->pad);
#endif
if (pad->integer_count > 0) {
diff -ruN im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/iiimpColor.c im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/iiimpColor.c
--- im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/iiimpColor.c 2004-05-05 03:55:05.000000000 +0900
+++ im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/iiimpColor.c 2005-07-27 22:55:01.000000000 +0900
@@ -64,6 +64,62 @@
BG_COLOR = (1L << 2)
} IMSetColor;
+#ifdef HAVE_PANGO
+void
+set_attributes_for_pango(XicCommon ic,
+ Display *dpy,
+ IMFeedbackList *flist,
+ PangoAttrList *attrs,
+ const char *str,
+ int start_pos,
+ int end_pos)
+{
+ XColor color;
+ Colormap cmap;
+ int i;
+ unsigned short r, g, b;
+ char colorName[20]; /* enough */
+ const char *formater = "#%2.2lX%2.2lX%2.2lX";
+ PangoAttribute *attr;
+ int start_index = g_utf8_offset_to_pointer(str, start_pos) - str;
+ int end_index = g_utf8_offset_to_pointer(str, end_pos) - str;
+
+ cmap = DefaultColormap(dpy, XIC_GUI(ic, screen_number));
+ for (i = 0; i < flist->count_feedbacks; i++) {
+ r = (flist->feedbacks[i].value & 0x00ff0000) >> 16;
+ g = (flist->feedbacks[i].value & 0x0000ff00) >> 8;
+ b = flist->feedbacks[i].value & 0x000000ff;
+ sprintf(colorName, formater, r, g, b);
+ if (XParseColor(dpy, cmap, colorName, &color)) {
+ XAllocColor(dpy, cmap, &color);
+
+ switch (flist->feedbacks[i].type) {
+ case IM_FOREGROUND_RGB_FEEDBACK:
+ attr = pango_attr_foreground_new(r, g, b);
+ attr->start_index = start_index;
+ attr->end_index = end_index;
+ pango_attr_list_change(attrs, attr);
+ break;
+ case IM_BACKGROUND_RGB_FEEDBACK:
+ attr = pango_attr_background_new(r, g, b);
+ attr->start_index = start_index;
+ attr->end_index = end_index;
+ pango_attr_list_change(attrs, attr);
+ break;
+ case IM_UNDERLINE_RGB_FEEDBACK:
+ attr = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE);
+ attr->start_index = start_index;
+ attr->end_index = end_index;
+ pango_attr_list_change(attrs, attr);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+}
+#endif /* HAVE_PANGO */
+
int
SetIMColors(XicCommon ic,
Display *display, Window win, GC gc, GC rgc,
diff -ruN im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/iiimpColor.h im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/iiimpColor.h
--- im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/iiimpColor.h 2005-07-27 22:54:41.000000000 +0900
+++ im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/iiimpColor.h 2005-07-27 22:55:01.000000000 +0900
@@ -47,12 +47,27 @@
#ifndef _IIIMP_COLOR_H
#define _IIIMP_COLOR_H
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <X11/X.h>
#include <X11/Xlib.h>
#include "xiiimp.h"
#include "commonIM.h"
+#ifdef HAVE_PANGO
+#include <pango/pango-attributes.h>
+#endif /* HAVE_PANGO */
extern Bool SameIMFeedbackList(IMFeedbackList *a, IMFeedbackList *b);
+#ifdef HAVE_PANGO
+void set_attributes_for_pango(XicCommon ic,
+ Display *dpy,
+ IMFeedbackList *flist,
+ PangoAttrList *attrs,
+ const char *str,
+ int start_pos,
+ int end_pos);
+#endif /* HAVE_PANGO */
extern int SetIMColors(XicCommon ic,
Display *display, Window win, GC gc, GC rgc,
IMFeedbackList *flist, XIMFeedback unused);
diff -ruN im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/popupIM.c im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/popupIM.c
--- im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/popupIM.c 2005-07-27 22:54:41.000000000 +0900
+++ im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/popupIM.c 2005-07-27 22:55:01.000000000 +0900
@@ -84,6 +84,21 @@
return True;
}
+#ifdef HAVE_PANGO
+static PangoFontDescription *
+status_window_font_description(XicCommon ic)
+{
+ PangoFontDescription *font = NULL;
+ StatusWin status;
+
+ SetStatusFont(ic, NULL);
+ status = (StatusWin)ic->gui_icpart->status;
+ if (status != NULL)
+ font = status->font;
+
+ return font;
+}
+#else /* !HAVE_PANGO */
static XFontSet
status_window_fontset(XicCommon ic) {
XFontSet fs = 0;
@@ -97,11 +112,16 @@
}
return fs;
}
+#endif /* HAVE_PANGO */
static unsigned int
status_window_height(XicCommon ic) {
unsigned int height = ic->core.status_attr.area.height;
if (height == 0) {
+#ifdef HAVE_PANGO
+#warning FIXME: need to calculate height here
+ fprintf(stderr, "%s: FIXME: need to calculate height here.\n", __FUNCTION__);
+#else /* !HAVE_PANGO */
XFontSet fs;
if ((fs = status_window_fontset(ic))) {
XFontSetExtents *fse;
@@ -109,6 +129,7 @@
height = fse->max_logical_extent.height;
height += (fse->max_ink_extent.height + fse->max_ink_extent.y);
}
+#endif /* HAVE_PANGO */
}
if (height == 0) height = 19; /* may not work */
return height;
@@ -172,6 +193,54 @@
{"zh_TW", "[ T-Chinese ]"}
};
+#ifdef HAVE_PANGO
+static void
+draw_text_for_pango(XicCommon ic,
+ PangoFontDescription *font,
+ int x,
+ int y,
+ XftColor *fg,
+ XftColor *bg,
+ char *utf8_text)
+{
+ PangoAttrList *attrs = pango_attr_list_new();
+ PangoAttribute *attr;
+ size_t len = strlen(utf8_text);
+
+ attr = pango_attr_foreground_new(fg->color.red, fg->color.green, fg->color.blue);
+ attr->start_index = 0;
+ attr->end_index = len;
+ pango_attr_list_change(attrs, attr);
+ attr = pango_attr_background_new(bg->color.red, bg->color.green, bg->color.blue);
+ attr->start_index = 0;
+ attr->end_index = len;
+ pango_attr_list_change(attrs, attr);
+ pango_layout_set_attributes(XIM_POPUP(ic->core.im, layout), attrs);
+ pango_layout_set_font_description(XIM_POPUP(ic->core.im, layout), font);
+ pango_layout_set_text(XIM_POPUP(ic->core.im, layout), utf8_text, -1);
+ pango_xft_render_layout(XIM_POPUP(ic->core.im, xftdraw), fg, XIM_POPUP(ic->core.im, layout), x, y);
+}
+
+static unsigned int
+text_escapement_for_pango(XicCommon ic,
+ PangoFontDescription *font,
+ char *utf8_text)
+{
+ StatusWin status = (StatusWin)ic->gui_icpart->status;
+ PangoLayout *layout;
+ int width = 0;
+
+ if (utf8_text == NULL || strlen(utf8_text) == 0)
+ return 0;
+ layout = pango_layout_new(status->context);
+ pango_layout_set_font_description(layout, font);
+ pango_layout_set_text(layout, utf8_text, -1);
+ pango_layout_get_pixel_size(layout, &width, NULL);
+ g_object_unref(layout);
+
+ return width;
+}
+#else /* !HAVE_PANGO */
static void
DrawText(XicCommon ic, XFontSet fs, GC gc, int x, int y,
char *utf8_text)
@@ -216,6 +285,7 @@
}
return XmbTextEscapement(fs, utf8_text, len);
}
+#endif /* HAVE_PANGO */
static char*
convertToDisplayLanguage(char *src) {
@@ -227,11 +297,19 @@
}
return (char*)src;
}
+
static void
update_menu(XicCommon ic) {
int y, n;
+#ifdef HAVE_PANGO
+ PangoFontDescription *font = status_window_font_description(ic);
+
+ if (font == NULL)
+ return;
+#else /* !HAVE_PANGO */
XFontSet fs = status_window_fontset(ic);
if (!fs) return;
+#endif /* HAVE_PANGO */
y = 0;
n = 1;
@@ -246,12 +324,26 @@
}
y += status_window_height(ic);
if (n == XIC_POPUP(ic, menu_index)) {
+#ifdef HAVE_PANGO
+ draw_text_for_pango(ic, font,
+ &XIM_POPUP(ic->core.im, bg),
+ &XIM_POPUP(ic->core.im, fg),
+ xMargin, y, state->name);
+#else /* !HAVE_PANGO */
DrawText(ic, fs, XIM_POPUP(ic->core.im, rgc),
xMargin, y, state->name);
+#endif /* HAVE_PANGO */
} else if ((-1 == XIC_POPUP(ic, menu_index_pre)) ||
(n == XIC_POPUP(ic, menu_index_pre))) {
+#ifdef HAVE_PANGO
+ draw_text_for_pango(ic, font,
+ &XIM_POPUP(ic->core.im, fg),
+ &XIM_POPUP(ic->core.im, bg),
+ xMargin, y, state->name);
+#else /* !HAVE_PANGO */
DrawText(ic, fs, XIM_POPUP(ic->core.im, gc),
xMargin, y, state->name);
+#endif /* HAVE_PANGO */
}
n++;
state = state->next;
@@ -271,12 +363,26 @@
}
y += status_window_height(ic);
if (n == XIC_POPUP(ic, menu_index)) {
+#ifdef HAVE_PANGO
+ draw_text_for_pango(ic, font,
+ &XIM_POPUP(ic->core.im, bg),
+ &XIM_POPUP(ic->core.im, fg),
+ xMargin, y, display_lang);
+#else /* HAVE_PANGO */
DrawText(ic, fs, XIM_POPUP(ic->core.im, rgc),
xMargin, y, display_lang);
+#endif /* HAVE_PANGO */
} else if ((-1 == XIC_POPUP(ic, menu_index_pre)) ||
(n == XIC_POPUP(ic, menu_index_pre))) {
+#ifdef HAVE_PANGO
+ draw_text_for_pango(ic, font,
+ &XIM_POPUP(ic->core.im, fg),
+ &XIM_POPUP(ic->core.im, bg),
+ xMargin, y, display_lang);
+#else /* !HAVE_PANGO */
DrawText(ic, fs, XIM_POPUP(ic->core.im, gc),
xMargin, y, display_lang);
+#endif /* HAVE_PANGO */
}
n++;
}
@@ -304,9 +410,16 @@
static void
get_menu_size(XicCommon ic, unsigned int *w, unsigned int *h) {
unsigned int width, height, temp;
+#ifdef HAVE_PANGO
+ PangoFontDescription *font = status_window_font_description(ic);
+
+ if (font == NULL)
+ return;
+#else /* !HAVE_PANGO */
XFontSet fs = status_window_fontset(ic);
if (!fs) return;
+#endif /* HAVE_PANGO */
width = 0;
height = 0;
@@ -320,7 +433,11 @@
continue;
}
len = strlen(state->name);
+#ifdef HAVE_PANGO
+ temp = text_escapement_for_pango(ic, font, state->name);
+#else /* !HAVE_PANGO */
temp = TextEscapement(ic, fs, state->name);
+#endif /* HAVE_PANGO */
width = (temp > width) ? temp : width;
height += status_window_height(ic);
state = state->next;
@@ -340,7 +457,11 @@
display_lang = convertToDisplayLanguage(p->string.multi_byte);
}
len = strlen(display_lang);
+#ifdef HAVE_PANGO
+ temp = text_escapement_for_pango(ic, font, display_lang);
+#else /* !HAVE_PANGO */
temp = TextEscapement(ic, fs, display_lang);
+#endif /* HAVE_PANGO */
width = (temp > width) ? temp : width;
height += status_window_height(ic);
}
@@ -375,8 +496,10 @@
XSizeHints hints;
unsigned int width;
unsigned int height;
+#ifndef HAVE_PANGO
unsigned long val_mask;
XGCValues gcval;
+#endif /* !HAVE_PANGO */
int new_x;
int new_y;
XIMPopup popup_impart = 0;
@@ -384,6 +507,9 @@
Bool use_client_color;
Display *display = ic->core.im->core.display;
XIM im = ic->core.im;
+#ifdef HAVE_PANGO
+ int screen = DefaultScreen(display);
+#endif /* HAVE_PANGO */
if (!display) return;
@@ -428,6 +554,21 @@
XFree(popup_impart);
return;
}
+#ifdef HAVE_PANGO
+ XIM_POPUP(im, xftdraw) = XftDrawCreate(display, XIM_POPUP(im, window),
+ DefaultVisual(display, screen),
+ DefaultColormap(display, screen));
+ XIM_POPUP(im, fg).color.red = 0;
+ XIM_POPUP(im, fg).color.green = 0;
+ XIM_POPUP(im, fg).color.blue = 0;
+ XIM_POPUP(im, fg).color.alpha = 0xffff;
+ XIM_POPUP(im, fg).color.red = 0xffff;
+ XIM_POPUP(im, fg).color.green = 0xffff;
+ XIM_POPUP(im, fg).color.blue = 0xffff;
+ XIM_POPUP(im, fg).color.alpha = 0xffff;
+ XIM_POPUP(im, context) = pango_xft_get_context(display, screen);
+ XIM_POPUP(im, layout) = pango_layout_new(XIM_POPUP(im, context));
+#else /* !HAVE_PANGO */
val_mask = GCForeground | GCBackground;
gcval.foreground = fg;
gcval.background = bg;
@@ -442,6 +583,7 @@
XIM_POPUP(im, rgc) = XCreateGC(display,
XIM_POPUP(im, window), val_mask, &gcval);
+#endif /* HAVE_PANGO */
#ifdef override_redirect
attr.override_redirect = True;
@@ -693,8 +835,15 @@
void
ClosePopupIM(XimCommon im) {
if (im && im->popup_impart && im->core.display) {
+#ifdef HAVE_PANGO
+ if (XIM_POPUP(im, xftdraw) != NULL)
+ XftDrawDestroy(XIM_POPUP(im, xftdraw));
+ if (XIM_POPUP(im, layout) != NULL)
+ g_object_unref(XIM_POPUP(im, layout));
+#else /* !HAVE_PANGO */
if (XIM_POPUP(im, gc)) XFreeGC(im->core.display, XIM_POPUP(im, gc));
if (XIM_POPUP(im, rgc)) XFreeGC(im->core.display, XIM_POPUP(im, rgc));
+#endif /* HAVE_PANGO */
if (XIM_POPUP(im, window)) {
XDestroyWindow(im->core.display, XIM_POPUP(im, window));
}
diff -ruN im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/popupIM.h im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/popupIM.h
--- im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/popupIM.h 2001-03-16 00:52:22.000000000 +0900
+++ im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/popupIM.h 2005-07-27 22:55:01.000000000 +0900
@@ -42,13 +42,29 @@
#ifndef _popupIM_h
#define _popupIM_h
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include "commonIM.h"
#include <X11/Xlib.h>
+#ifdef HAVE_PANGO
+#include <X11/Xft/Xft.h>
+#include <pango/pango-context.h>
+#include <pango/pango-layout.h>
+#endif /* HAVE_PANGO */
typedef struct _XIMPopupRec {
Window window;
+#ifndef HAVE_PANGO
GC gc;
GC rgc;
+#else /* HAVE_PANGO */
+ XftDraw *xftdraw;
+ XftColor fg;
+ XftColor bg;
+ PangoContext *context;
+ PangoLayout *layout;
+#endif /* !HAVE_PANGO */
int status_height;
int x;
int y;
diff -ruN im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/xfactory.c im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/xfactory.c
--- im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/xfactory.c 2004-08-24 19:37:02.000000000 +0900
+++ im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/xfactory.c 2005-07-27 22:55:01.000000000 +0900
@@ -39,6 +39,9 @@
Sun Microsystems, Inc. or its licensors is granted.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <X11/Xlib.h>
#include <X11/Xatom.h> /* Required for XA_ATOM */
#ifndef linux
@@ -48,6 +51,10 @@
#include "xfactory.h"
#define PROP_WM_STATE_ELEMENTS 2
+#ifdef HAVE_PANGO
+#define DEFAULT_FONT_FAMILY "Sans"
+#define DEFAULT_FONT_SIZE 12
+#endif /* HAVE_PANGO */
typedef struct _PropWMState {
unsigned long state;
@@ -437,6 +444,42 @@
return s;
}
+#ifdef HAVE_PANGO
+static PangoFontDescription *default_font = NULL;
+static unsigned int pango_ref_count = 0;
+
+PangoFontDescription *
+XFactoryCreateDefaultPangoFontDescription(char *default_fontname)
+{
+ pango_ref_count++;
+
+ if (default_font != NULL)
+ return default_font;
+
+ if (default_fontname != NULL)
+ default_font = pango_font_description_from_string(default_fontname);
+ else
+ default_font = pango_font_description_new();
+ if ((pango_font_description_get_set_fields(default_font) & PANGO_FONT_MASK_FAMILY) == 0)
+ pango_font_description_set_family(default_font, DEFAULT_FONT_FAMILY);
+ if ((pango_font_description_get_set_fields(default_font) & PANGO_FONT_MASK_SIZE) == 0)
+ pango_font_description_set_size(default_font, DEFAULT_FONT_SIZE * PANGO_SCALE);
+
+ return default_font;
+}
+
+void
+XFactoryFreeDefaultPangoFontDescription(void)
+{
+ if (--pango_ref_count == 0) {
+ if (default_font != NULL) {
+ pango_font_description_free(default_font);
+ default_font = NULL;
+ }
+ }
+}
+#endif /* HAVE_PANGO */
+
static XFontSet default_fontset = (XFontSet)0;
static int ref_count = 0;
diff -ruN im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/xfactory.h im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/xfactory.h
--- im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/xfactory.h 2004-03-24 04:34:17.000000000 +0900
+++ im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/xfactory.h 2005-07-27 22:55:01.000000000 +0900
@@ -46,6 +46,12 @@
#ifndef _XFACTORY_H
#define _XFACTORY_H
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#ifdef HAVE_PANGO
+#include <pango/pango-font.h>
+#endif /* HAVE_PANGO */
#pragma ident "@(#)xfactory.h 1.1 99/11/04 SMI"
@@ -80,6 +86,10 @@
extern int XFactoryMoveWindowInsideScreen(Display * display, Window w,
int x, int y);
+#ifdef HAVE_PANGO
+PangoFontDescription *XFactoryCreateDefaultPangoFontDescription(char *default_fontname);
+void XFactoryFreeDefaultPangoFontDescription (void);
+#endif /* HAVE_PANGO */
extern XFontSet XFactoryCreateDefaultFontSet (Display *display,
char *default_font_name);
extern void XFactoryFreeDefaultFontSet(Display *display);
xiiimp-preedit-area-svn2505-147458.patch:
guiIMPre.c | 12 +++-
guiIMPreArea.c | 161 +++++++++++++++++++++++++++++++++++++++++++--------------
2 files changed, 133 insertions(+), 40 deletions(-)
--- NEW FILE xiiimp-preedit-area-svn2505-147458.patch ---
diff -ur im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/guiIMPre.c im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/guiIMPre.c
--- im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/guiIMPre.c 2005-01-27 13:35:26.000000000 +0900
+++ im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/guiIMPre.c 2005-02-22 18:42:40.913270752 +0900
@@ -194,6 +194,10 @@
/* Draw All Preedit Text */
for (i = 0; i < preedit->active_areas; i++) {
+ if (ic->core.input_style & XIMPreeditArea) {
+ XClearArea(ic->core.im->core.display,
+ preedit_area[i].window, 0, 0, 0, 0, False);
+ }
if (preedit_area[i].active_lines == 0) {
DrawPreeditString(ic,
ic->core.im->core.display,
@@ -330,8 +334,12 @@
}
if (start == 0 && len == 0) {
UpdatePreeditAll(ic);
- }
- if (len > 0) {
+ } else if (ic->core.input_style & XIMPreeditArea &&
+ (preedit_area[0].configured == True ||
+ preedit_area[0].char_len !=
+ preedit_area[0].char_len_backup)) {
+ UpdatePreeditAll(ic);
+ } else if (len > 0) {
int x;
unsigned int width;
wchar_t *wcstr = preedit_chars->wchar;
diff -ur im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/guiIMPreArea.c im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/guiIMPreArea.c
--- im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/guiIMPreArea.c 2003-04-24 19:24:26.000000000 +0900
+++ im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/guiIMPreArea.c 2005-02-22 18:49:22.724186208 +0900
@@ -70,65 +70,150 @@
PreeditArea preedit_area;
CacheRec *preedit_cache;
PreeditChars preedit_chars;
- unsigned int width, height;
+ XRectangle *ic_preedit_area;
+ unsigned int width, height, max_width, max_height;
+ XFontSetExtents *fse;
if (!preedit) {
create(ic, NULL);
preedit = (PreeditWin)(ic->gui_icpart->preedit);
if (!preedit) return;
}
- preedit_area = (PreeditArea)(preedit->preedit_areas);
-
if (!preedit->fontset) {
SetPreeditFont(ic, NULL);
+ if (!preedit->fontset) return;
}
preedit_chars = (PreeditChars)&(preedit->preedit_chars);
- if (preedit_area) {
- preedit_area[0].x = 0;
- preedit_area[0].char_offset = 0;
- preedit_area[0].char_len = preedit_chars->wchar_len;
- }
-
if (preedit_chars->wchar_len == 0) return;
- if (preedit->fontset) {
- XFontSetExtents *fse;
- fse = XExtentsOfFontSet(preedit->fontset);
- width = XwcTextEscapement(preedit->fontset,
- preedit_chars->wchar,
- preedit_chars->wchar_len);
- height = fse->max_logical_extent.height;
- if (preedit_area) {
- preedit_area[0].y = fse->max_ink_extent.height;
+ preedit_area = (PreeditArea)(preedit->preedit_areas);
+ if (preedit->active_areas != 1 || !preedit_area ||
+ !preedit_area[0].window) {
+ return;
+ }
+
+ fse = XExtentsOfFontSet(preedit->fontset);
+ width = XwcTextEscapement(preedit->fontset,
+ preedit_chars->wchar,
+ preedit_chars->wchar_len);
+ if (width == 0) width = 1;
+ height = fse->max_ink_extent.height;
+ if (height == 0) height = 1;
+
+ ic_preedit_area = &ic->core.preedit_attr.area;
+ max_width = (fse->max_ink_extent.width > ic_preedit_area->width) ?
+ fse->max_ink_extent.width : ic_preedit_area->width;
+ max_height = ic_preedit_area->height;
+
+ preedit_area[0].configured = False;
+ preedit_area[0].x = 0;
+ preedit_area[0].char_offset = 0;
+ preedit_area[0].char_len = preedit_chars->wchar_len;
+ if (max_height < fse->max_ink_extent.height) {
+ int height_diff;
+ height_diff =
+ (max_height - fse->max_ink_extent.height);
+ height_diff += (height_diff & 1);
+ preedit_area[0].y = (-fse->max_ink_extent.y) + (height_diff / 2);
+ }
+ else {
+ preedit_area[0].y = (-fse->max_ink_extent.y);
+ }
+
+ if (width <= max_width) {
+ preedit_area[0].active_lines = 0;
+ }
+ else if (max_height < fse->max_ink_extent.height) {
+ /* draw latest characters only */
+ preedit_area[0].active_lines = 0;
+ preedit_area[0].x = max_width - width;
+ }
+ else {
+ /* draw more than two lines */
+ int left;
+ wchar_t *wcstr;
+ int n, prev_y, line_spacing;
+ PreeditLine preedit_line;
+
+ preedit_line = preedit_area[0].lines;
+ left = preedit_chars->wchar_len;
+ wcstr = preedit_chars->wchar;
+ n = 0;
+ line_spacing = (ic->core.preedit_attr.line_spacing > 0) ?
+ ic->core.preedit_attr.line_spacing : height;
+ prev_y = preedit_area[0].y - line_spacing;;
+ while (left) {
+ wchar_t *p = wcstr;
+ int cur_width = 0;
+ int i;
+ if (n == preedit_area[0].alloc_lines) {
+ preedit_area[0].alloc_lines += 10;
+ if (!preedit_area[0].lines) {
+ preedit_area[0].lines =
+ (PreeditLine)Xmalloc(sizeof(PreeditLineRec) *
+ preedit_area[0].alloc_lines);
+ }
+ else {
+ preedit_area[0].lines =
+ (PreeditLine)Xrealloc(preedit_area[0].lines,
+ sizeof(PreeditLineRec) *
+ preedit_area[0].alloc_lines);
+ }
+ if (!preedit_area[0].lines) return;
+ preedit_line = preedit_area[0].lines;
+ }
+ for (i = 1; i <= left; i++) {
+ cur_width += XwcTextEscapement(preedit->fontset, p++, 1);
+ if (cur_width > max_width) break;
+ }
+ preedit_line[n].x = 0;
+ preedit_line[n].y = prev_y + line_spacing;
+ preedit_line[n].char_offset = wcstr - preedit_chars->wchar;
+ preedit_line[n].char_len = i - 1;
+ prev_y = preedit_line[n].y;
+ n++;
+ left -= (i - 1);
+ wcstr += i - 1;
}
- } else {
- width = ic->core.preedit_attr.area.width;
- height = ic->core.preedit_attr.area.height;
- if (preedit_area) {
- preedit_area[0].y = ic->core.preedit_attr.area.height;
+ preedit_area[0].active_lines = n;
+ height = line_spacing * n;
+ if (max_height < height) {
+ int i;
+ int height_diff = height - max_height;
+ for (i = 0; i < n; ++i) {
+ preedit_line[i].y -= height_diff;
+ }
}
}
-
+ if (max_width < width) width = max_width;
+ // Is window size changed?
+ if (preedit_area[0].win_config.x != ic_preedit_area->x ||
+ preedit_area[0].win_config.y != ic_preedit_area->y ||
+ preedit_area[0].win_config.width != ic_preedit_area->width ||
+ preedit_area[0].win_config.height != ic_preedit_area->height) {
+ XMoveResizeWindow(ic->core.im->core.display,
+ preedit_area[0].window,
+ ic_preedit_area->x, ic_preedit_area->y,
+ ic_preedit_area->width, ic_preedit_area->height);
+ preedit_area[0].win_config.x = ic_preedit_area->x;
+ preedit_area[0].win_config.y = ic_preedit_area->y;
+ preedit_area[0].win_config.width = ic_preedit_area->width;
+ preedit_area[0].win_config.height = ic_preedit_area->height;
+ preedit_area[0].configured = True;
+ }
+ // Is preedit area not changed ?
preedit_cache = (CacheRec*)&(preedit->preedit_cache);
- if (preedit_cache->win_x == ic->core.preedit_attr.area.x &&
- preedit_cache->win_y == ic->core.preedit_attr.area.y &&
+ if (preedit_cache->win_x == preedit_area[0].x &&
+ preedit_cache->win_y == preedit_area[0].y &&
preedit_cache->win_width == width &&
- preedit_cache->win_height == height &&
- preedit_cache->font_set == preedit->fontset) {
+ preedit_cache->win_height == height) {
return;
}
- if (preedit->active_areas == 1 && preedit_area &&
- preedit_area[0].window) {
- XMoveResizeWindow(ic->core.im->core.display,
- preedit_area[0].window,
- ic->core.preedit_attr.area.x,
- ic->core.preedit_attr.area.y,
- width, height);
- }
+ preedit_area[0].configured = True;
/* data cache */
- preedit_cache->win_x = ic->core.preedit_attr.area.x;
- preedit_cache->win_y = ic->core.preedit_attr.area.y;
+ preedit_cache->win_x = preedit_area[0].x;
+ preedit_cache->win_y = preedit_area[0].y;
preedit_cache->win_width = width;
preedit_cache->win_height = height;
preedit_cache->font_set = preedit->fontset;
xiiimp-preedit-callback-svn2548-147459.patch:
iiimcfFun.c | 12 ++++++++++++
1 files changed, 12 insertions(+)
--- NEW FILE xiiimp-preedit-callback-svn2548-147459.patch ---
diff -ur im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/iiimcfFun.c im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/iiimcfFun.c
--- im-sdk-r12_1-svn2002.orig/iiimxcf/xiiimp.so/iiimp/iiimcfFun.c 2004-06-05 04:44:15.000000000 +0900
+++ im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/iiimcfFun.c 2005-02-14 11:22:50.859657552 +0900
@@ -390,11 +390,23 @@
if (ic->commit_string_callback.callback) {
XIMText cbtext;
XIMCallback *cb = &ic->commit_string_callback;
+ int len = 0;
st = iiimcf_get_committed_text(XIC_IIIMP(ic, context), &text);
if (st != IIIMF_STATUS_SUCCESS) return st;
+ st = iiimcf_get_text_length(text, &len);
+ if (st != IIIMF_STATUS_SUCCESS) return st;
st = IIimpConvertToXIMText(text, &cbtext, NULL, useUnicode);
if (st != IIIMF_STATUS_SUCCESS) return st;
+ if (ic->core.input_style & XIMPreeditCallbacks) {
+ /* erace preedit text */
+ XIMPreeditDrawCallbackStruct call_data;
+ memset(&call_data, 0, sizeof(XIMPreeditDrawCallbackStruct));
+ call_data.caret = len;
+ call_data.chg_length = len;
+ CallPreeditDrawCallback(ic, &call_data, NULL);
+ XIC_IIIMP(ic, preedit_prev_len) = 0;
+ }
(*cb->callback)((XIC)ic,
cb->client_data,
(XPointer)&cbtext); /* for UNICODE1 */
xiiimp-preedit-return-value-svn2549-149607.patch:
iiimpIC.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 55 insertions(+), 4 deletions(-)
--- NEW FILE xiiimp-preedit-return-value-svn2549-149607.patch ---
--- im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/iiimpIC.c~ 2005-07-27 21:48:06.000000000 +0900
+++ im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/iiimpIC.c 2005-07-27 22:19:22.000000000 +0900
@@ -420,11 +420,33 @@
)
{
XicCommon ic = (XicCommon)xic;
-
+ IIIMF_status st;
+ IIIMCF_text text;
+ char *str = NULL;
+ int caret, len;
+
+ st = iiimcf_get_preedit_text(XIC_IIIMP(ic, context), &text, &caret);
+ if (st == IIIMF_STATUS_SUCCESS) {
+ st = iiimcf_get_text_length(text, &len);
+ if (st == IIIMF_STATUS_SUCCESS && len > 0) {
+ XICCallback *cb = &ic->core.preedit_attr.draw_callback;
+ XimCommon im = (XimCommon)ic->core.im;
+ Bool useUnicode = (XIM_USE_UNICODE(im) && cb->callback &&
+ (ic->core.input_style & XIMPreeditCallbacks));
+ st = IIimpConvertToString(text, useUnicode, &str);
+ if (st != IIIMF_STATUS_SUCCESS && str) {
+ free(str);
+ str = NULL;
+ }
+ }
+ }
iiimcf_reset_context(XIC_IIIMP(ic, context));
ic->core.preedit_attr.preedit_state = XIMPreeditDisable;
ChangePreeditState(ic);
- return (char*)NULL;
+ /* to unmap preedit window */
+ XIC_GUI(ic, change_preedit)((XIC)ic, PREEDIT_DONE, NULL);
+
+ return str;
}
static wchar_t*
@@ -433,12 +455,41 @@
)
{
XicCommon ic = (XicCommon)xic;
-
+ IIIMF_status st;
+ IIIMCF_text text;
+ wchar_t *wc_p = NULL;
+ int caret, len;
+ Bool useUnicode;
+
+ st = iiimcf_get_preedit_text(XIC_IIIMP(ic, context), &text, &caret);
+ if (st == IIIMF_STATUS_SUCCESS) {
+ st = iiimcf_get_text_length(text, &len);
+ if (st == IIIMF_STATUS_SUCCESS && len > 0) {
+ XICCallback *cb = &ic->core.preedit_attr.draw_callback;
+ XimCommon im = (XimCommon)ic->core.im;
+ char *str = NULL;
+ Bool useUnicode = (XIM_USE_UNICODE(im) && cb->callback &&
+ (ic->core.input_style & XIMPreeditCallbacks));
+ st = IIimpConvertToString(text, useUnicode, &str);
+ if (st == IIIMF_STATUS_SUCCESS) {
+ wc_p = (wchar_t *)Xmalloc(sizeof(wchar_t) * len);
+ if (!IIimpMbstoWcs((XimCommon)ic->core.im,
+ str, len, wc_p, len, NULL)) {
+ if (wc_p) {
+ free(wc_p); wc_p = NULL;
+ }
+ }
+ }
+ if (str) free(str);
+ }
+ }
iiimcf_reset_context(XIC_IIIMP(ic, context));
ic->core.preedit_attr.preedit_state = XIMPreeditDisable;
ChangePreeditState(ic);
+ /* to unmap preedit window */
+ XIC_GUI(ic, change_preedit)((XIC)ic, PREEDIT_DONE, NULL);
- return (wchar_t*)NULL;
+ return (wchar_t*)wc_p;
}
char*
Index: im-sdk.spec
===================================================================
RCS file: /cvs/dist/rpms/im-sdk/FC-3/im-sdk.spec,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -r1.100 -r1.101
--- im-sdk.spec 27 Jul 2005 11:18:06 -0000 1.100
+++ im-sdk.spec 27 Jul 2005 14:10:24 -0000 1.101
@@ -14,7 +14,7 @@
Epoch: 1
Version: 12.1
## for builds suffixed with the svn release please only increment the leading release number when updating
-Release: 10.FC3
+Release: 10.FC3.1
License: Distributable
Source: %{name}-src-%{srclabel}.tar.bz2
Source3: iiimecf-init.el
@@ -39,8 +39,6 @@
%endif
Patch0: im-sdk-20040203-build.patch
Patch5: im-sdk-64bit.patch
-Patch12: im-sdk-xft-ac.patch
-Patch13: im-sdk-12.1-x-xft.patch
Patch15: im-sdk-bin_dir.patch
Patch24: im-sdk-11.4-iiimsf-daemon.patch
# doesn't apply anymore
@@ -72,18 +70,24 @@
Patch55: iiimgcf-fix-crash-r2421-153020.patch
## iiimxcf
-## Patch70 has been committed in svn2037.
-Patch70: xiiimp-fix-gcc-warnings.patch
+## Patch700 has been committed in svn2037.
+Patch700: xiiimp-fix-gcc-warnings.patch
## Patch71 has been committed in svn2042.
-Patch71: htt_xbe-fix-gcc-warnings.patch
-Patch72: xiiimp.so-gcc-warnings.patch
+Patch701: htt_xbe-fix-gcc-warnings.patch
+Patch702: xiiimp.so-gcc-warnings.patch
## warning patches are in the way so cannot merge with xft patch
## TODO: merge it when tar ball is merging the trunk
-Patch73: im-sdk-12.1-x-xft-highlight.patch
-Patch74: im-sdk-htt_xbe-crash.patch
-Patch75: xiiimp-fix-double-encoded-utf8-r2272-138618.patch
-Patch76: xiiimp-fix-default-le-r2435-139811.patch
-Patch77: xiiimp-xft-statusarea-141298.patch
+Patch704: im-sdk-htt_xbe-crash.patch
+Patch705: xiiimp-fix-double-encoded-utf8-r2272-138618.patch
+Patch706: httx-status-focus-svn2500-146406.patch
+Patch707: xiiimp-close-on-reset-svn2543-146407.patch
+Patch708: httx-preedit-state-svn2544-146523.patch
+Patch709: xiiimp-preedit-area-svn2505-147458.patch
+Patch710: xiiimp-preedit-callback-svn2548-147459.patch
+Patch711: xiiimp-aux-segfault-svn2507-148765.patch
+Patch712: xiiimp-preedit-return-value-svn2549-149607.patch
+Patch713: xiiimp-pango.patch
+Patch750: xiiimp-fix-default-le-r2435-139811.patch
## iiimcf
Patch80: iiimcf-fix-deactivate-im-r2024.patch
@@ -137,6 +141,7 @@
Patch356: leif-unit-gu-inscriptfix-140337.patch
Patch357: leif-unit-latin-fixes-r2060.patch
Patch358: leif-unit-U+000A-r2484-132936.patch
+Patch359: unitle-Punjabi-missing-keys-svn2604-151477.patch
# for Sun Chinese LEs
Patch400: im-sdk-11.4-sun-le-asia.patch
Patch401: leif-sun-zh-disable.patch
@@ -379,8 +384,6 @@
%setup -q -n %{name}-%{srclabel}
%patch0 -p1
%patch5 -p1 -b .64
-%patch12 -p1 -b .xft-ac
-%patch13 -p1 -b .x-xft
%patch15 -p1 -b .bindir
%patch24 -p1 -b .daemon
#%%patch28 -p1 -b .disable-debug
@@ -406,14 +409,20 @@
%patch55 -p0 -b .fix-crash
## iiimxcf
-%patch70 -p1 -b .xiiimp-warnings
-%patch71 -p1 -b .htt_xbe-warnings
-%patch72 -p1 -b .xiiimp.so-warn
-%patch73 -p1 -b .xft-highlight
-%patch74 -p1 -b .x86_64-htt_xbe-crash
-%patch75 -p0 -b .double-encoded-utf8
-%patch76 -p1 -b .default-le
-%patch77 -p1 -b .statusarea
+%patch700 -p1 -b .xiiimp-warnings
+%patch701 -p1 -b .htt_xbe-warnings
+%patch702 -p1 -b .xiiimp.so-warn
+%patch704 -p1 -b .x86_64-htt_xbe-crash
+%patch705 -p0 -b .double-encoded-utf8
+%patch706 -p1 -b .706-status-focus
+%patch707 -p1 -b .707-close-lookup
+%patch708 -p1 -b .708-preedit-state
+%patch709 -p1 -b .709-preedit-placement
+%patch710 -p1 -b .710-preedit-cb
+%patch711 -p1 -b .711-aux-segv
+%patch712 -p1 -b .712-preedit-return
+%patch713 -p1 -b .713-pango
+%patch750 -p1 -b .750-default-le
## iiimcf
%patch80 -p0 -b .iiimcf-deactivate-im
@@ -451,6 +460,7 @@
%patch356 -p1 -b .gu_IN
%patch357 -p0 -b .european
%patch358 -p1 -b .U+000A
+%patch359 -p1 -b .punjabi
# Sun Chinese LE
## always need to be applied to build with/without -le-asia and le-korea
@@ -1109,8 +1119,24 @@
%changelog
* Wed Jul 27 2005 Akira TAGOH <tagoh at redhat.com>
-- xiiimp-xft-statusarea-141298.patch: applied to fix segfaulting in some xim
- apps (Kohji Sanpei, #141298)
+- added series of iiimxcf patches courtesy of Kohji Sanpei of IBM
+ - httx-status-focus-svn2500-146406.patch to fix status focus (#146406)
+ - add xiiimp-close-on-reset-svn2543-146407.patch to close lookup window on
+ reset (#146407)
+ - add httx-preedit-state-svn2544-146523.patch to correct pre-edit state value
+ (#146523)
+ - add xiiimp-preedit-area-svn2505-147458.patch to fix pre-edit area placement
+ (#147458)
+ - add xiiimp-preedit-callback-svn2548-147459.patch to issue with preedit
+ callbacks (#147459)
+ - add xiiimp-aux-segfault-svn2507-148765.patch to aux window issue
+ (#148765)
+ - add xiiimp-preedit-return-value-svn2549-149607.patch to fix pre-edit return
+ string (#149607)
+- add unitle-Punjabi-missing-keys-svn2604-151477.patch to fix missing keys
+ (Amanpreet Singh Alam, #151477)
+- add xiiimp-pango.patch to see pango instead for xft for status and candidate
+ windows (#158727)
- iiimgcf-fix-crash-r2421-153020.patch: applied to fix a crash issue. (#153020)
- Use %%{_target_platform} instead of %%{_arch}-%%{host_vendor}-%%{_host_os}
to run update-gtk-immodule properly.
xiiimp-fix-gcc-warnings.patch:
KeyMap.h | 2 --
XimpConv.c | 4 ++--
XimpParser.c | 2 +-
XimpRm.c | 2 +-
guiIM.h | 2 --
guiIMPre.c | 2 +-
iiimpAuth.c | 2 --
iiimpAuth.h | 2 --
iiimpAux.c | 2 --
iiimpAux.h | 2 --
iiimpAuxP.h | 2 --
iiimpColor.h | 2 --
iiimpDL.c | 2 +-
iiimpIC.c | 2 ++
iiimpIC.h | 2 --
iiimpICG.h | 2 --
iiimpIM.c | 2 +-
iiimpReq.h | 2 --
iiimpTr.h | 2 --
iiimpUtil.h | 2 --
switchIM.c | 1 +
trace_message.c | 2 --
trace_message.h | 2 --
ximp40.h | 2 --
24 files changed, 10 insertions(+), 39 deletions(-)
Index: xiiimp-fix-gcc-warnings.patch
===================================================================
RCS file: /cvs/dist/rpms/im-sdk/FC-3/xiiimp-fix-gcc-warnings.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- xiiimp-fix-gcc-warnings.patch 23 Nov 2004 04:26:50 -0000 1.1
+++ xiiimp-fix-gcc-warnings.patch 27 Jul 2005 14:10:24 -0000 1.2
@@ -67,18 +67,6 @@
#include "commonIM.h"
#include "xiiimp.h"
#include <X11/X.h>
-diff -ruN -x '*.o' -x .deps -x .libs -x '*.a' im-sdk-src-r12_1.orig/iiimxcf/xiiimp.so/iiimp/guiIMLookup.c im-sdk-src-r12_1/iiimxcf/xiiimp.so/iiimp/guiIMLookup.c
---- im-sdk-src-r12_1.orig/iiimxcf/xiiimp.so/iiimp/guiIMLookup.c 2004-10-20 18:27:37.000000000 +0900
-+++ im-sdk-src-r12_1/iiimxcf/xiiimp.so/iiimp/guiIMLookup.c 2004-10-21 04:41:23.163949570 +0900
-@@ -1038,7 +1038,7 @@
-
- wc_len = len;
- if (!(wcstr = Xmalloc(sizeof(wchar_t) * (wc_len + 1))))
-- return;
-+ return False;
-
- out_len = IIimpMbstoWcs(im, candidate, len, wcstr, wc_len, NULL);
- if (out_len == 0)
diff -ruN -x '*.o' -x .deps -x .libs -x '*.a' im-sdk-src-r12_1.orig/iiimxcf/xiiimp.so/iiimp/guiIMPre.c im-sdk-src-r12_1/iiimxcf/xiiimp.so/iiimp/guiIMPre.c
--- im-sdk-src-r12_1.orig/iiimxcf/xiiimp.so/iiimp/guiIMPre.c 2004-10-15 16:43:06.000000000 +0900
+++ im-sdk-src-r12_1/iiimxcf/xiiimp.so/iiimp/guiIMPre.c 2004-10-21 04:47:58.002873333 +0900
@@ -91,18 +79,6 @@
int j;
int m;
int text_length;
-diff -ruN -x '*.o' -x .deps -x .libs -x '*.a' im-sdk-src-r12_1.orig/iiimxcf/xiiimp.so/iiimp/guiIMSts.c im-sdk-src-r12_1/iiimxcf/xiiimp.so/iiimp/guiIMSts.c
---- im-sdk-src-r12_1.orig/iiimxcf/xiiimp.so/iiimp/guiIMSts.c 2004-10-20 18:27:37.000000000 +0900
-+++ im-sdk-src-r12_1/iiimxcf/xiiimp.so/iiimp/guiIMSts.c 2004-10-21 04:54:04.671510646 +0900
-@@ -100,7 +100,7 @@
- GC gc, int x, int y, char *str, int str_len,
- IMFeedbackList *feedback_list, int feedback_length) {
- if (fontset == NULL) return;
-- wchar_t *wcstr = 0, *wcstrp;
-+ wchar_t *wcstr = 0, *wcstrp = NULL;
- size_t wc_len = 0;
- int out_len = 0;
- XimCommon im = (XimCommon)ic->core.im;
diff -ruN -x '*.o' -x .deps -x .libs -x '*.a' im-sdk-src-r12_1.orig/iiimxcf/xiiimp.so/iiimp/iiimpAuth.c im-sdk-src-r12_1/iiimxcf/xiiimp.so/iiimp/iiimpAuth.c
--- im-sdk-src-r12_1.orig/iiimxcf/xiiimp.so/iiimp/iiimpAuth.c 2004-10-15 16:43:05.000000000 +0900
+++ im-sdk-src-r12_1/iiimxcf/xiiimp.so/iiimp/iiimpAuth.c 2004-10-21 04:41:48.172652057 +0900
@@ -306,18 +282,6 @@
#ifdef DEBUG
#define ENABLE_TRACE
#endif
-diff -ruN -x '*.o' -x .deps -x .libs -x '*.a' im-sdk-src-r12_1.orig/iiimxcf/xiiimp.so/iiimp/xfactory.h im-sdk-src-r12_1/iiimxcf/xiiimp.so/iiimp/xfactory.h
---- im-sdk-src-r12_1.orig/iiimxcf/xiiimp.so/iiimp/xfactory.h 2004-10-20 18:27:37.000000000 +0900
-+++ im-sdk-src-r12_1/iiimxcf/xiiimp.so/iiimp/xfactory.h 2004-10-21 04:46:14.662503504 +0900
-@@ -47,8 +47,6 @@
- #ifndef _XFACTORY_H
- #define _XFACTORY_H
-
--#pragma ident "@(#)xfactory.h 1.1 99/11/04 SMI"
--
- #include <X11/Xft/Xft.h>
-
- extern void XFactoryRemoveDecoration(Display *display, Window window);
diff -ruN -x '*.o' -x .deps -x .libs -x '*.a' im-sdk-src-r12_1.orig/iiimxcf/xiiimp.so/iiimp/ximp40.h im-sdk-src-r12_1/iiimxcf/xiiimp.so/iiimp/ximp40.h
--- im-sdk-src-r12_1.orig/iiimxcf/xiiimp.so/iiimp/ximp40.h 2004-10-15 16:43:05.000000000 +0900
+++ im-sdk-src-r12_1/iiimxcf/xiiimp.so/iiimp/ximp40.h 2004-10-21 04:43:32.812850651 +0900
xiiimp.so-gcc-warnings.patch:
iiimxcf/xiiimp.so/iiimp/KeyMap.c | 4 ++--
iiimxcf/xiiimp.so/iiimp/XimpConv.c | 10 ++++++----
iiimxcf/xiiimp.so/iiimp/lookup.c | 2 +-
iiimxcf/xiiimp.so/iiimp/popupIM.c | 2 +-
include/iiimp/iiimp-opcode.h | 3 ---
5 files changed, 10 insertions(+), 11 deletions(-)
Index: xiiimp.so-gcc-warnings.patch
===================================================================
RCS file: /cvs/dist/rpms/im-sdk/FC-3/xiiimp.so-gcc-warnings.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- xiiimp.so-gcc-warnings.patch 23 Nov 2004 04:26:50 -0000 1.1
+++ xiiimp.so-gcc-warnings.patch 27 Jul 2005 14:10:24 -0000 1.2
@@ -31,56 +31,6 @@
*state = XLookupNone;
return 0;
}
---- im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/guiIMLookup.c.xiiimp.so-warn 2004-11-05 23:28:36.386198159 +0900
-+++ im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/guiIMLookup.c 2004-11-05 23:28:36.439191198 +0900
-@@ -86,12 +86,12 @@
-
- if (feedback & XIMReverse) {
- if ((xftdraw != NULL) && (xftfont != NULL))
-- XftDrawString32(xftdraw, &xftcolor, xftfont, x, y, wcstrp, out_len);
-+ XftDrawString32(xftdraw, &xftcolor, xftfont, x, y, (FcChar32*) wcstrp, out_len);
- else
- XmbDrawImageString(display, win, fontset, rgc, x, y, str, len);
- } else {
- if ((xftdraw != NULL) && (xftfont != NULL))
-- XftDrawString32(xftdraw, &xftcolor, xftfont, x, y, wcstrp, out_len);
-+ XftDrawString32(xftdraw, &xftcolor, xftfont, x, y, (FcChar32*) wcstrp, out_len);
- else
- XmbDrawImageString(display, win, fontset, gc, x, y, str, len);
- }
-@@ -141,9 +141,9 @@
- SetIMColors(ic, display, win, gc, (GC)0, pfeedback, (XIMFeedback)0);
- }
- if ((xftdraw != NULL) && (xftfont != NULL)) {
-- XftDrawString32(xftdraw, &xftcolor, xftfont, x, y, wcstrp, 1);
-+ XftDrawString32(xftdraw, &xftcolor, xftfont, x, y, (FcChar32*) wcstrp, 1);
- XGlyphInfo extents;
-- XftTextExtents32(display,xftfont, wcstrp, 1, &extents);
-+ XftTextExtents32(display,xftfont, (FcChar32*) wcstrp, 1, &extents);
- x += extents.xOff;
- }
- else {
-@@ -185,9 +185,9 @@
- }
- SetIMColors(ic, display, win, gc, (GC)0, pfeedback, (XIMFeedback)0);
- if ((xftdraw != NULL) && (xftfont != NULL)) {
-- XftDrawString32(xftdraw, &xftcolor, xftfont, x, y, wcstrp, j);
-+ XftDrawString32(xftdraw, &xftcolor, xftfont, x, y, (FcChar32*) wcstrp, j);
- XGlyphInfo extents;
-- XftTextExtents32(display,xftfont, wcstrp, j, &extents);
-+ XftTextExtents32(display,xftfont, (FcChar32*) wcstrp, j, &extents);
- x += extents.xOff;
- }
- else {
-@@ -1048,7 +1048,7 @@
-
- if ((lookup->xftdraw != NULL) && (lookup->xftfont != NULL)) {
- XGlyphInfo extents;
-- XftTextExtents32(display,lookup->xftfont, candidate, out_len, &extents);
-+ XftTextExtents32(display,lookup->xftfont, (FcChar32*) candidate, out_len, &extents);
- if (lookup->maxWidth < extents.xOff) {
- lookup->maxWidth = extents.xOff;
- }
--- im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/KeyMap.c.xiiimp.so-warn 2004-05-05 03:55:05.000000000 +0900
+++ im-sdk-r12_1-svn2002/iiimxcf/xiiimp.so/iiimp/KeyMap.c 2004-11-05 23:28:36.438191329 +0900
@@ -862,12 +862,12 @@
- Previous message (by thread): rpms/policycoreutils/devel .cvsignore, 1.57, 1.58 policycoreutils-rhat.patch, 1.94, 1.95 policycoreutils.spec, 1.124, 1.125 sources, 1.60, 1.61
- Next message (by thread): rpms/jonas/devel jonas.spec,1.93,1.94
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-cvs-commits
mailing list