ubuntu14.04下解决编辑器无法输入中文

phpstorm下。

 编辑 phpstorm/bin/phpstorm.sh

在顶部加上

export XMODIFIERS=”@im=fcitx” 
export GTK_IM_MODULE=”fcitx” 
export QT_IM_MODULE=”fcitx”

ibus的话就改下ibus即可。

 

sublime_text下

1.首先需要下载gtk的lib文件

sudo apt-get install libgtk2.0-dev

2编辑文件:sublime_imfix.c

复制代码
#include <gtk/gtkimcontext.h>

void gtk_im_context_set_client_window (GtkIMContext *context, GdkWindow    *window)
{
    GtkIMContextClass *klass;
    g_return_if_fail (GTK_IS_IM_CONTEXT (context));
    klass = GTK_IM_CONTEXT_GET_CLASS (context);

    if (klass->set_client_window)
        klass->set_client_window (context, window);

    g_object_set_data(G_OBJECT(context),"window",window);

    if(!GDK_IS_WINDOW (window))
        return;

    int width = gdk_window_get_width(window);
    int height = gdk_window_get_height(window);

    if(width != 0 && height !=0)
        gtk_im_context_focus_in(context);

}

3.编译

gcc -shared -o libsublime-imfix.so sublime_imfix.c  `pkg-config --libs --cflags gtk+-2.0` -fPIC

4.然后将这个文件移动到sublime安装目录下,我的在/opt/sublime_text_2

sudo mv libsublime-imfix.so /opt/sublime_text_2/

5.编辑/usr/bin/subl文件,这是一个shell脚本

#!/bin/bash
LD_PRELOAD=/opt/sublime_text_2/libsublime-imfix.so exec /opt/sublime_text_2/sublime_text "$@"

然后执行subl基本就可以了

posted on 2016-05-03 11:17  飞羽哥哥  阅读(536)  评论(0编辑  收藏  举报

导航