這篇“Ubuntu下sublime中文無(wú)法輸入如何解決”文章的知識(shí)點(diǎn)大部分人都不太理解,所以小編給大家總結(jié)了以下內(nèi)容,內(nèi)容詳細(xì),步驟清晰,具有一定的借鑒價(jià)值,希望大家閱讀完這篇文章能有所收獲,下面我們一起來(lái)看看這篇“Ubuntu下sublime中文無(wú)法輸入如何解決”文章吧。

成都創(chuàng)新互聯(lián)公司作為成都網(wǎng)站建設(shè)公司,專注重慶網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì),有關(guān)成都企業(yè)網(wǎng)站定制方案、改版、費(fèi)用等問題,行業(yè)涉及成都自拌料攪拌車等多個(gè)領(lǐng)域,已為上千家企業(yè)服務(wù),得到了客戶的尊重與認(rèn)可。
copy下列代碼,保存為sublime_fix.c
復(fù)制代碼 代碼如下:
#include <gtk/gtk.h>#include <gdk/gdkx.h>typedef gdksegment gdkregionbox;struct _gdkregion{ long size; long numrects; gdkregionbox *rects; gdkregionbox extents;};gtkimcontext *local_context;voidgdk_region_get_clipbox (const gdkregion *region , gdkrectangle *rectangle){ g_return_if_fail (region != null); g_return_if_fail (rectangle != null); rectangle->x = region->extents.x1; rectangle->y = region->extents.y1; rectangle->width = region->extents.x2 - region->extents.x1; rectangle->height = region->extents.y2 - region->extents.y1; gdkrectangle rect; rect.x = rectangle->x; rect.y = rectangle->y; rect.width = 0; rect.height = rectangle->height; if(rectangle->width == 2 && gtk_is_im_context(local_context)) { gtk_im_context_set_cursor_location(local_context, rectangle); }}
static gdkfilterreturn event_filter (gdkxevent *xevent, gdkevent *event, gpointer im_context){ xevent *xev = (xevent *)xevent; if(xev->type == keyrelease && gtk_is_im_context(im_context)) { gdkwindow * win = g_object_get_data(g_object(im_context),"window"); if(gdk_is_window(win)) gtk_im_context_set_client_window(im_context, win); } return gdk_filter_continue;}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); if(!gdk_is_window (window)) return; g_object_set_data(g_object(context),"window",window); 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); local_context = context; } gdk_window_add_filter (window, event_filter, context);}使用下列命令編譯它
復(fù)制代碼 代碼如下:
gcc -shared -o libsublime-imfix.so sublime_fix.c `pkg-config --libs --cflags gtk+-2.0/` -fpic
添加運(yùn)行權(quán)限給libsublime-imfix.so
復(fù)制代碼 代碼如下:
chmod +x libsublime-imfix.so
將編譯后的文件libsublime-imfix.so復(fù)制到sublime的文件夾下面
在sublime安裝目錄下新建文件為sublime_sh.sh,copy內(nèi)容如下:
復(fù)制代碼 代碼如下:
#!/bin/bash sublime_home="~/software" #你的sublime安裝目錄 ld_lib="$sublime_home/libsublime-imfix.so" sh -c "ld_preload=$ld_lib $sublime_home/sublime $@"
你已經(jīng)可以通過(guò)teminal啟動(dòng)sublime了,運(yùn)行./sublime_sh.sh即可
若要通過(guò)啟動(dòng)器啟動(dòng)sublime,請(qǐng)將你sublime.desktop里面的exec路徑修改為sublime_sh.sh所在路徑
以上就是關(guān)于“Ubuntu下sublime中文無(wú)法輸入如何解決”這篇文章的內(nèi)容,相信大家都有了一定的了解,希望小編分享的內(nèi)容對(duì)大家有幫助,若想了解更多相關(guān)的知識(shí)內(nèi)容,請(qǐng)關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。
網(wǎng)頁(yè)名稱:Ubuntu下sublime中文無(wú)法輸入如何解決
當(dāng)前鏈接:http://chinadenli.net/article24/ggpoje.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站改版、網(wǎng)站設(shè)計(jì)公司、網(wǎng)站維護(hù)、外貿(mào)建站、企業(yè)建站、網(wǎng)站收錄
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)