CFT: Adobe Reader 8 + SCIM/UIM

Nikola Lečić nikola.lecic at
Mon Jan 14 09:04:30 PST 2008

I tried to follow all your tests and to check what binary is loaded
in what case. Below are my observations. Then I tested your diff,
comments included. Finally, please find the modified
ADOBE_VER-dependent version of that patch that served me perfectly.

Note: Sometimes I wasn't sure if the analyses in your post assumed that
there was no linux present in the system. Without linux, there is no way for me to get acroread8+SCIM to work for me.

Therefore, I did all tests both with and without linux and
included separate comments.

BTW, I think that in the diff you obviously meant

-	case GTK_IM_MODULE in
+	case ${GTK_IM_MODULE} in

On Mon, 14 Jan 2008 02:37:13 +0900 (JST)
Hiroki Sato <hrs at> wrote:

> Nikola Lečić <nikola.lecic at> wrote
>   in <20080108095126.2efc4557 at>:
> ni> 3. Now acroread7 doesn't work (for me at least), with all
> ni> SCIM-related environment variables schemes. It just returns me
> ni> back to the shell prompt without any error message;
> ni> 
> ni> 4. However, if I use the environment scheme I suggested in my
> ni> previous mail and change GTK_IM_MODULE/XMODIFIERS in acroread7
> ni> startup script as proposed, all applications work, and SCIM in
> ni> them.
>  From further investigation, the cause of this problem turns out to be
>  as follows:
>  a) When GTK_IM_MODULE=xim and one runs a Linux binary that uses
>     linux-gtk2 library, the binary uses in linux-gtk2 and it
>     works.

The same here, if XMODIFIERS=@im=SCIM (if one actually wants SCIM, of

>  b) When GTK_IM_MODULE=scim (or other than xim) and one runs a Linux
>     binary that uses linux-gtk2 library, the binary tries to load the
>     corresponding immodule file.  If the corresponding file is found
>     in /usr/compat/linux/usr/lib/gtk-2.0 (i.e. Linux binary), it is
>     loaded and should work fine.  If the corresponding file is found
>     in /usr/local/lib/gtk-2.0 (i.e. FreeBSD native binary), it is
>     loaded but does not work.  In the latter case, if the loading
>     fails gracefully, it falls back into loading

I can confirm this, in both cases. (However, as you confirmed, the
presence of linux will crash acroread7.)
>  c) acroread7 works only with and loading FreeBSD binary
>     fails gracefully.  This means setting GTK_IM_MODULE=scim falls
>     back into GTK_IM_MODULE=xim automatically. (probably this is the
>     reason why GTK_IM_MODULE=scim + QT_IM_MODULE=scim +
>     XMODIFIERS=@im=SCIM works.)

With GTK_IM_MODULE=scim acroread7 will (according to b)) try to load from /usr/compat/linux/usr/lib/gtk-2.0, which will cause a
crash. However, yes, if acroread7 loads linux, SCIM will work.

>  d) acroread8 works with both and as far as I can
>     check, and loading FreeBSD binary makes the process get hosed.

Not exactly so for me (if SCIM is the goal).

* With (_and only with_) linux _and_ GTK_IM_MODULE=scim,
  acroread8+SCIM works.
* Without linux no GTK_IM_MODULE settings helps.

>  So, the individual cases can be classified as follows:
>  - acroread7 + GTK_IM_MODULE=xim + XMODIFIERS=@im=SCIM
>    -> should work.  @im=foo other than SCIM also works.

The same here: acroread7 loads linux In this case, with
XMODIFIERS=@im=SCIM, acroread7+SCIM works.

(BTW, SCIM won't work with GTK_IM_MODULE=xim + XMODIFIERS=@im=XIM
anywhere (but such values imply that one doesn't want SCIM, I think.)

>  - acroread7 + GTK_IM_MODULE=scim
>    -> should work.  Even if FreeBSD native exists it is
>       always ignored and XIM is used.  Note that if Linux
>       exists it prevents the acroread7 from working, but there is no
>       port of in the Ports Collection now.

* With linux yes, it crashes acroread7 (as reported).
* Without linux the same here, it works.

>  - acroread8 + GTK_IM_MODULE=xim + XMODIFIERS=@im=SCIM
>    -> should work.  @im=foo other than SCIM also works.

Not for me. Linux must be present, and GTK_IM_MODULE must be
changed to scim. Otherwise, acroread8 will load linux and SCIM
won't work. XMODIFIERS doesn't matter in this case.

(Again, I think that xim/XIM isn't preferable combination for SCIM user,
as stated above.)
>  - acroread8 + GTK_IM_MODULE=scim
>    -> does not work unless Linux exists.  If FreeBSD native
> exists the acroread8 process gets hosed (no fall-back
>       happens).

* With linux present, yes, it works.
* Without linux, nothing bad happens. acroread8 just loads
  Linux and SCIM won't work.
>  So, the safest way to loading Linux version of is setting
>  GTK_IM_MODULE=xim forcibly.  And if setting XMODIFIERS properly there
>  should be little difference in its behavior from the user's point of
>  view.

Forced GTK_IM_MODULE=xim will always cause linux to be loaded,
but this is why acroread8+SCIM never works for me with the diff included
with your previous mail...

>  I pondered over adding ports of the Linux immodules in my previous
>  post or a hack for GTK_IM_MODULE variable into print/acroreadwrapper,
>  but I think changing acroreadwrapper is better.  A patch for
>  acroreadwrapper that sets GTK_IM_MODULE=xim forcibly and sets
>  XMODIFIERS=@im=foo according to GTK_IM_MODULE, has been attached.

... and that's why this confuses me: do you mean that you get
acroread8+SCIM working without linux

>  However, in your post you said when GTK_IM_MODULE=xim +
>  XMODIFIERS=@im=SCIM, the behavior is bad.  Could you elaborate it?  I
>  could not reproduce it.

That statement was a part of description of global effects that various
SCIM-related variables have. GTK_IM_MODULE=xim + XMODIFIERS=@im=SCIM is
explained in SCIM documentation:

as the "the least optimal approach". For me, it has one bad and one good

  * switching among various SCIM keyboard layouts works normally only if
    "Share the same input method among all applications" is set in
    SCIM-setup, and even then not always perfectly. Otherwise, keyboard
    icon will usually be out of synchronisation with actually active
    keyboard layout in a given window, when the focus change;

  * good side is that it's currently the only way known to me to get the
    most complex keystroke rules of scim-kmfl-imengine working in
    OpenOffice, but this is another thing. (I'm investigating this and
    I'm sure there's a better solution.)

Therefore I try to avoid xim/SCIM scheme.

Now, to sum up what works for me. This list is the conditio sine qua
non (after as much testing as I could do):

1. The only way to get SCIM working in acroread8 is to load linux

2. GTK_IM_MODULE=scim + the presence of linux will crash

3. However, this can be easily avoided by setting GTK_IM_MODULE=xim
   if ADOBE_VER=7.

4. acroread8 always loads linux version of GTK_IM_MODULE if it exists.
   XMODIFIERS are not important in such cases.

Therefore the proposed diff is not functional for me.

IMHO 1-4 means that hack of GTK_IM_MODULE must be ADOBE_VER-dependent.
I included the modified version of your patch, which is the optimal
solution for me. (I repeat, always with linux, i.e. with
textproc/lunux-scim-libs port.) With this patch, SCIM works in both
acroread7 and acroread8 with any possible environmental settings. I'd
say it doesn't break anything for XIM users. I didn't test UIM.

--- acroreadwrapper.diff begins here ---
Index: Makefile
RCS file: /eris/cvsroot/ports/print/acroreadwrapper/Makefile,v
retrieving revision 1.9
diff -u -r1.9 Makefile
--- Makefile	4 Jan 2008 20:20:20 -0000	1.9
+++ Makefile	14 Jan 2008 15:05:56 -0000
@@ -6,7 +6,7 @@
 PORTNAME=	acroreadwrapper
-PORTVERSION=	0.0.20071020
+PORTVERSION=	0.0.20080110
 MASTER_SITES=	# empty
 DISTFILES=	# empty
@@ -29,7 +29,7 @@
-PLUGINDIR=	lib/browser_linux_plugins
+PLUGINDIR=	lib/npapi/linux-acroread
Index: files/
RCS file: /eris/cvsroot/ports/print/acroreadwrapper/files/,v
retrieving revision 1.5
diff -u -r1.5
--- files/	4 Jan 2008 20:20:20 -0000	1.5
+++ files/	14 Jan 2008 16:15:21 -0000
@@ -1,4 +1,4 @@
 # $FreeBSD: ports/print/acroreadwrapper/files/,v 1.4 2007/09/23 18:28:46 hrs Exp $
 # environment variables:
@@ -13,6 +13,14 @@
 #     When this script is invoked as "acroread7" and "acroread8",
 #     ADOBE_VER is automatically set.
+#     This script sets GTK_IM_MODULE as "xim" by default because
+#     immodules other than xim require the corresponding module files
+#     in Linux binary, not FreeBSD native versions (if a FreeBSD
+#     native immodule library exists and the corresponding Linux
+#     library does not, Adobe Reader attempts to load the FreeBSD
+#     binary and it will fail).  If $ADOBE_DISABLEIMMODULEHACK is
+#     defined as "YES", this behavior is disabled.
 ADOBE_LANG=`echo "${ADOBE_LANG}" | tr a-z A-Z`
@@ -63,7 +71,6 @@
 case ${ADOBE_LANG} in
 CHS) : ${GDK_USE_XFT:=0}; export GDK_USE_XFT ;;
 CHT) : ${GDK_USE_XFT:=0}; export GDK_USE_XFT ;;
-JPN) : ${GTK_IM_MODULE:=xim}; export GTK_IM_MODULE ;;
 KOR) : ${GDK_USE_XFT:=0}; export GDK_USE_XFT ;;
@@ -81,6 +88,32 @@
+[Yy][Ee][Ss])	;; # do nothing
+	case ${ADOBE_VER} in
+	7)
+		case ${GTK_IM_MODULE} in
+		""|xim)	;; # do nothing
+		scim)
+		;;
+		esac
+	;;
+	8)
+		case ${XMODIFIERS} in
+		@im=SCIM) GTK_IM_MODULE=scim; export GTK_IM_MODULE ;;
+		*) ;; # do nothing
+		esac
+	;;
+	esac
+	case ${GTK_IM_MODULE} in
+		""|xim|scim) ;; # do nothing
+	esac
 case ${ADOBE_VER} in
@@ -98,15 +131,15 @@
 	echo "installing PDF plugin..."
 	echo "%%PREFIX%%/${ACROBASE}/${ADOBE_LANG}/Browser/intellinux/ -> %%PREFIX%%/%%PLUGINDIR%%/"
-	mkdir -p /../%%PREFIX%%/%%PLUGINDIR%%
+	mkdir -p %%PREFIX%%/%%PLUGINDIR%%
 	ln -s -f %%PREFIX%%/${ACROBASE}/${ADOBE_LANG}/Browser/intellinux/ \
-	/../%%PREFIX%%/%%PLUGINDIR%%/
 	exit 0
 	echo "deinstalling PDF plugin..."
-	rm -f /../%%PREFIX%%/%%PLUGINDIR%%/
-	rmdir /../%%PREFIX%%/%%PLUGINDIR%% 2> /dev/null || true
+	rm -f %%PREFIX%%/%%PLUGINDIR%%/
+	rmdir %%PREFIX%%/%%PLUGINDIR%% > /dev/null 2>&1 || true
 	exit 0
--- acroreadwrapper.diff ends here ---

Best regards.
Nikola Lečić :: Никола Лечић

More information about the freebsd-ports mailing list