Fix Ubuntu 14.04.1 next sublime text3 3065 China input problem

Source: Internet
Author: User
Tags gtk

You see today sublime Text3 I used to have no 3059 of it has support 3065 that. Therefore, in order to support SUBL on the implementation of Chinese input method, the following steps to my record for everyone to use


There is a complete tutorial: http://www.360doc.com/content/14/0329/08/13087748_364608018.shtml#


But I need to put the inside

The sublime_imfix.c file is replaced by the following one, which has been used in person.


/*sublime-imfix.cuse ld_preload to interpose some function to fix sublime Input method support for Linux. by Cjacker huanggcc-shared-o libsublime-imfix.so sublime-imfix.c ' pkg-config--libs--cflags gtk+-2.0 '-fPICLD_PRELOAD= ./libsublime-imfix.so subl*/#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; The caret widthis 2;  Maybe sometimes we'll make a mistake, but for most of the time, it should is the caret. if (rectangle->width = = 2 && gtk_is_im_context (Local_context)) {gtk_im_context_set_cursor_location (local  _context, rectangle); }}//this is needed, for example, if your input something in file dialog and return back the edit Area//context would lost, s o Here we set it again.static gdkfilterreturn event_filter (gdkxevent *xevent, gdkevent *event, Gpointer im_context) {X    Event *xev = (XEvent *) XEvent; if (Xev->type = = Keyrelease && gtk_is_im_context (im_context)) {Gdkwindow * win = G_object_get_data (G_OBJE       CT (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);}


Copyright notice: This article Bo Master original article. Blog, not reproduced without consent.

Fix Ubuntu 14.04.1 next sublime text3 3065 China input problem

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.