Re: Apple X11 + Japanese input method (kotoeri)
Re: Apple X11 + Japanese input method (kotoeri)
- Subject: Re: Apple X11 + Japanese input method (kotoeri)
- From: Ken Thomases <email@hidden>
- Date: Wed, 26 Apr 2006 06:51:11 -0500
Hi,
The pthreads library supports both recursive and non-recursive
mutexes. A recursive mutex is one which a given thread may lock
multiple times without self-deadlocking. It appears the XLockDisplay
is using a non-recursive mutex. (Non-recursive mutexes are the
default because support for recursive locking is more expensive.)
However, XLockDisplay is documented as being recursive, so this is a
bug.
-Ken
On Apr 25, 2006, at 4:46 PM, Dave Williss wrote:
Partial solution found...
This is only a problem if the program called XInitTreads() . If not,
XLockDisplay
does nothing and it just works.
If you initialize X Threads (which we really want), then the
problem is that
XFilterEvent called XLockDisplay before calling
XimProtoKeypressFilter.
When that eventually leads to a call to XGetWindowAttributes, that
also
tries to call XLockDisplay. The display is already locked, and the
pthread_mutex doesn't seem to care that the thread asking for the lock
is the one that has it locked, causing the thread to block forever.
I don't know if this is a flaw in X11, ptreads, or the
semaphore_wait_signal_trap that pthread_mutex_lock is based on.
I am told by a coworker that the Windows implementation of
mutex keeps track of the fact that "this" thread already has the
mutex and just increments a refcount.
----- Original Message ----- From: "Dave Williss"
<email@hidden>
To: <email@hidden>
Sent: Tuesday, April 25, 2006 1:05 PM
Subject: Re: Apple X11 + Japanese input method (kotoeri)
I am having trouble getting kinput2 to work under Mac OS 10.4
Here's what I do...
_Xsetlocale(LC_CTYPE, "ja_JP.SJIS"); // also tried ja_JP,
ja, ja_JP.eucJP, ja_JP.EUC
Note, if I use setlocale instead of _Xsetlocale, XOpenIM returns
NULL. Not sure why, but not important now.
if (XSupportsLocale()) { // returns true
XSetLocaleModifiers("@im=kinput2");
xim = XOpenIM(display, 0, 0, 0);
... (initialize some structures like PStartCB )
XVaNestedList preedit_attr = XVaCreateNestedList (0,
XNPreeditStartCallback, &PStartCB,
.. (I set up others, but omit from email)
NULL);
// status_attr is setup similar to preedit_attr
xic = XCreateIC(xim,
XNClientWindow, XtWindow(w),
XNInputStyle, XIMPreeditCallbacks|XIMStatusCallbacks,
XNPreeditAttributes, preedit_attr,
XNStatusAttributes, status_attr,
NULL);
// verified that XtWindow(w) is not 0, xic returns a valid
pointer
// I've also tried XIMPreeditNothing and XIMStatusNothing
with no callbacks
}
At this point, everything seems OK until the user hits Shift-Space
to activeate the IME. Then the program locks up. If I hit break
in gdb, I see that it's in...
#0 semaphore_wait_signal_trap
#1 pthread_mutex_lock
#2 _XLockDisplay
#3 _XGetWindowAttributes
#4 _XimGetWindowEventmask
#5 _XimTriggerNotify
#6 _XimOnKeyCheck
#7 _XimProtoKeypressFilter
#8 XFilterEvent
#9 _XtDefaultDispatcher
#10 XtDispatchEvent <-- in my main event loop
That's it. I don't have an X11 library built for debugging, so I
can't trace through it.
----- Original Message ----- From: "P G" <email@hidden>
To: "Toshimitsu Tanaka" <email@hidden>
Cc: <email@hidden>
Sent: Sunday, April 16, 2006 6:59 AM
Subject: Re: Apple X11 + Japanese input method (kotoeri)
Toshimitsu Tanaka wrote:
Hi,
Try kinput2.MacIM.
The kotoeri is used with X11 for Mac OS X. (Japanese text)
http://www.sol.dti.ne.jp/~kikuyan/macosx/x11kotoeri.html
On 2006/04/16, at 20:35, P G wrote:
Hello All,
I have put in a LOT of effort trying to get the X11 preference
"Use system keyboard layout" to work.. finally with success for
English and French. (It seems I should have started off with
the system's "xinitrc" file when creating my own local one, as
it contains some bits needed to make this work.)
However, I cannot get the "kotoeri" input method to activate
when running X applications. It works fine for native Apple
applications. In X, though, the correct Latin key mappings for
the Japanese keyboard do get activated, but the input method
does not... all grayed out.
I am using the Gnome desktop environment installed from
DarwinPorts. Is there something I need to do there in order to
make this work? Note that the current port does not work with
any of the keyboard or international options... they crash.
Individual applications do allow selection of "Default" or "X
input method", however, but these have no effect for my problem.
Any help is much appreciated!
--
Toshimitsu Tanaka
email@hidden
http://toshi3.cocolog-nifty.com/blog/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
X11-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription: http://
This email sent to email@hidden
Thank you very much for the reply. Are you saying that it is
expected behavior that "kotoeri" does not work in X11?
I will try installing "kinput2" now... It will be a good test of
my Japanese reading skills... :-)
Thanks again!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
X11-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription: http://lists.apple.com/
mailman/options/x11-users/email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
X11-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription: http://lists.apple.com/
mailman/options/x11-users/email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
X11-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription: http://lists.apple.com/
mailman/options/x11-users/email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
X11-users mailing list (email@hidden)
This email sent to email@hidden