• sublime linux下无法输入中文


     

    cd ~
    vim  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);
    }
    

      开始编译,编译需要安装一下依赖,

    sudo apt-get install libgtk2.0-dev libglade2-dev firefox-dev libchm-dev libssl-dev
    

      编译

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

      libsublime-imfix.so拷贝到sublime_text所在安装文件夹

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

      如果不知道可以,updatedb 然后 locate sublime_text查看路径。

    vim修改 /usr/bin/subl文件
    
    #!/bin/sh exec /opt/sublime_text/sublime_text "$@"
    为
    #!/bin/sh LD_PRELOAD=/opt/sublime_text/libsublime-imfix.so exec /opt/sublime_text/sublime_text "$@"
    

      

    sudo vim  /usr/share/applications/sublime_text.desktop
    将[Desktop Entry]中的字符串
    Exec=/opt/sublime_text/sublime_text %F
    修改为
    Exec=bash -c "LD_PRELOAD=/opt/sublime_text/libsublime-imfix.so exec /opt/sublime_text/sublime_text %F"
    将[Desktop Action Window]中的字符串
    Exec=/opt/sublime_text/sublime_text -n
    修改为
    Exec=bash -c "LD_PRELOAD=/opt/sublime_text/libsublime-imfix.so exec /opt/sublime_text/sublime_text -n"
    将[Desktop Action Document]中的字符串
    Exec=/opt/sublime_text/sublime_text --command new_file
    修改为
    Exec=bash -c "LD_PRELOAD=/opt/sublime_text/libsublime-imfix.so exec /opt/sublime_text/sublime_text --command new_file"
    注意:
    修改时请注意双引号"",否则会导致不能打开带有空格文件名的文件。
    此处仅修改了/usr/share/applications/sublime-text.desktop,但可以正常使用了。
    opt/sublime_text/目录下的sublime-text.desktop可以修改,也可不修改。
    

      

  • 相关阅读:
    Delphi 枚举所有进程
    从零开始学JAVA(07)-使用SpringMVC4写helloworld
    Delphi下OpenGL2d绘图(06)-画图(多窗口、多视图、多个DC)
    Delphi下OpenGL2d绘图(05)-画图片Bmp
    Delphi下OpenGL2d绘图(04)-画四边形
    Windows下重置MySQL密码【MYSQL】
    HTML5 WEB Storage
    相关转载
    基本的查询流【MSSQL】
    查询编辑器便捷特性【MSSQL】
  • 原文地址:https://www.cnblogs.com/yangxunwu1992/p/5746038.html
Copyright © 2020-2023  润新知