Ubuntuでmatlabのkey inputが出来なくなる件

Ubuntu 10.04LTS 64bitでMatlabとSPMをつかっていますがSPMを使っている時にしばしば(特に解析後のデータを見るときに)GUIにkeyboard inputが入らなくなる問題が発生します。マウスの入力には問題は生じません。この問題は高頻度で発生し、その度にmatlabの再起動をしなければならず、解決方法を調べていました。


Ubuntuのsupport forumではこうなった場合はAlt + F4すれば入力が戻ると言うコメントもありますが、matlabがらみでkeyinputの問題が出た場合はAlt + F4では回復出来ません。


JVMJAVA)が問題で、jvmのupdateをしたらと言うコメントもありましたが、これでも解決には至りません。


先日、たまたまMatlab Centralでmatlabでのkeyinputに関するスレッドを見つけて試してみたら、ついに解決に至りました。
http://www.mathworks.com/matlabcentral/newsreader/view_thread/290037


諸悪の根源はwikipedia:iBusのようです。

Subject: Keyboard stops working (Linux)
From: Matthias
Date: 3 Sep, 2010 09:42:06
Message: 14 of 15

"Jackson Tan" wrote in message ...
> Just to throw in a comment that I'm facing the same problem as well. I'm using R2010a on Ubuntu 10.04. Happened numerous times.
>
> MatLab stops taking in keyboard inputs even though it is obviously working with other applications. MatLab is not busy either, since mouse buttons work. I'm not certain what triggers it, but I think it is probably windows/desktop switching (i.e. outside MatLab).
>
> Puzzling, and irritating (especially when re-running the script will take several minutes and stretch my computer).
>
> Jackson

Hey,

I contacted support and they pointed out the following known issue with linux and java (Matlab uses Java for the GUI), which interestingly specifically also related to IBus:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6506617

After disabling IBus, Matlab ran problem free all day yesterday.

I also updated java to:
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01, mixed mode)

I will test over the next week whether the java update, with and without IBus running, resolves the issue.

Matlab Newsletterより


と言うことです。
iBusと言うのはコンピュータに文字を入力するためのソフトウェアを管理するソフトなのですが(日本語など英語以外の言語の入力には必須)、これがJavaとからむと問題が起こるとの事です。iBusを止めるだけで問題が解決します。


解決法は簡単でシェルから

killall ibus-daemon

と入力すればOKです。


とはいえ、毎回シェルから入力するのも面倒なので、matlabの起動用のシェルスクリプト(\"matlab folder"\bin\matlab にある)に書き足せば毎回入力する面倒は省けます。ただし、iBusを止めてしまうと日本語が使えなくなってしまうので、再び使いたいときはシェルから

ibus-daemon

と打てば、再び使えるようになります。