Bug#290469: A OverTheSpot patch for libgtk2.0-0
Tetralet
Tetralet <tetralet@pchome.com.tw>, 290469@bugs.debian.org
Fri, 14 Jan 2005 18:08:19 +0800
This is a multi-part MIME message sent by reportbug.
--===============1222417086==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Package: libgtk2.0-0
Version: 2.4.4-2
Severity: wishlist
Tags: patch
Hi,
The OverTheSpot mode of XIM is the most common input method for Chinese/Japanese users.
but it is a pity that gtk2+ library don't support it,
so that all the gtk2+ based applications, like Mozilla, Firefox, Thunderbird, Gaim, and OpenOffice.org, can not support the OverTheSpot mode.
The attached file is a patch of libgtk2.0-0 package to make gtk2+ library support OverTheSpot mode.
It is written by eliu (Vampire at Wicked Empire) <cp76@csie.nctu.edu.tw>.
After some testing, we feel that this patch is stable enough to update to the upstream.
Please consider to apply this.
Thanks.
-- System Information:
Debian Release: 3.1
APT prefers testing
APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.8-1-686
Locale: LANG=C, LC_CTYPE=zh_TW.UTF-8
Versions of packages libgtk2.0-0 depends on:
ii libatk1.0-0 1.8.0-3 The ATK accessibility toolkit
ii libc6 2.3.2.ds1-16 GNU C Library: Shared libraries an
ii libfontconfig1 2.2.3-4.firefly generic font configuration library
ii libfreetype6 2.1.7-2.2 FreeType 2 font engine, shared lib
ii libglib2.0-0 2.4.7-1 The GLib library of C routines
ii libgtk2.0-0 2.4.4-2 The GTK+ graphical user interface
ii libgtk2.0-bin 2.4.4-2 The programs for the GTK+ graphica
ii libgtk2.0-common 2.4.4-2 Common files for the GTK+ graphica
ii libjpeg62 6b-9 The Independent JPEG Group's JPEG
ii libpango1.0-0 1.6.0-3 Layout and rendering of internatio
ii libpng12-0 1.2.8rel-1 PNG library - runtime
ii libtiff4 3.6.1-1.1 Tag Image File Format library
ii libx11-6 4.3.0.dfsg.1-6 X Window System protocol client li
ii libxcursor1 1.1.3-1 X cursor management library
ii libxext6 4.3.0.dfsg.1-6 X Window System miscellaneous exte
ii libxft2 2.1.2-6.firefly FreeType-based font drawing librar
ii libxi6 4.3.0.dfsg.1-6 X Window System Input extension li
ii libxrandr2 4.3.0.dfsg.1-4 X Window System Resize, Rotate and
ii libxrender1 0.8.3-7 X Rendering Extension client libra
ii xlibs 4.3.0.dfsg.1-4 X Window System client libraries m
ii zlib1g 1:1.2.1.1-5 compression library - runtime
-- no debconf information
--===============1222417086==
Content-Type: text/x-c; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="gtkimcontextxim.c.patch"
diff -uNr gtk+-2.4.13.orig/modules/input/gtkimcontextxim.c gtk+-2.4.13/modules/input/gtkimcontextxim.c
--- gtk+-2.4.13.orig/modules/input/gtkimcontextxim.c 2004-11-22 05:00:27.000000000 +0800
+++ gtk+-2.4.13/modules/input/gtkimcontextxim.c 2004-11-22 05:02:51.000000000 +0800
@@ -179,7 +179,7 @@
XIMPreeditArea | XIMPreeditNothing | XIMPreeditNone)
#define STATUS_MASK (XIMStatusCallbacks | XIMStatusArea | \
XIMStatusNothing | XIMStatusNone)
-#define ALLOWED_MASK (XIMPreeditCallbacks | XIMPreeditNothing | XIMPreeditNone | \
+#define ALLOWED_MASK (XIMPreeditCallbacks | XIMPreeditNothing | XIMPreeditNone | XIMPreeditPosition | \
XIMStatusCallbacks | XIMStatusNothing | XIMStatusNone)
static XIMStyle
@@ -263,6 +263,10 @@
NULL);
if (preedit_style == GTK_IM_PREEDIT_CALLBACK)
info->preedit_style_setting = XIMPreeditCallbacks;
+#if 0
+ else if (preedit_style == GTK_IM_PREEDIT_POSITION)
+ info->preedit_style_setting = XIMPreeditpPosition;
+#endif
else if (preedit_style == GTK_IM_PREEDIT_NOTHING)
info->preedit_style_setting = XIMPreeditNothing;
else if (preedit_style == GTK_IM_PREEDIT_NONE)
@@ -806,7 +810,7 @@
return;
spot.x = area->x;
- spot.y = area->y;
+ spot.y = area->y + area->height;
preedit_attr = XVaCreateNestedList (0,
XNSpotLocation, &spot,
@@ -1412,6 +1416,36 @@
else
im_style |= XIMStatusNothing;
+ XFontSet fontset = NULL;
+
+ if ((context_xim->im_info->style & PREEDIT_MASK) == XIMPreeditPosition) {
+ XPoint spot;
+ spot.x = spot.y = 0;
+ XRectangle rect;
+ rect.x = rect.y = 0;
+ rect.width = rect.height = 32;
+
+ int missing_charsetcount;
+ char **missing_charsetlist, *def_string;
+
+ fontset = XCreateFontSet(GDK_DISPLAY(),
+ "10x20,10x20",
+ &missing_charsetlist,
+ &missing_charsetcount,
+ &def_string);
+
+ list1 = XVaCreateNestedList(0,
+ XNArea, &rect,
+ XNSpotLocation, &spot,
+ XNForeground, 0,
+ XNBackground, 0,
+ XNFontSet, fontset,
+ NULL);
+
+ im_style = XIMPreeditPosition| XIMStatusNothing;
+ name1 = XNPreeditAttributes;
+ }
+
xic = XCreateIC (context_xim->im_info->im,
XNInputStyle, im_style,
XNClientWindow, GDK_DRAWABLE_XID (context_xim->client_window),
--===============1222417086==--