diff options
-rw-r--r-- | .SRCINFO | 44 | ||||
-rw-r--r-- | PKGBUILD | 62 | ||||
-rw-r--r-- | sublime_text_3_imfix.c | 263 |
3 files changed, 32 insertions, 337 deletions
@@ -1,6 +1,8 @@ +# Generated by makepkg 5.0.0 +# Tue Feb 9 09:24:32 UTC 2016 pkgbase = sublime-text-dev-imfix - pkgver = 3.3083 - pkgrel = 2 + pkgver = 3.3103 + pkgrel = 1 url = http://www.sublimetext.com/3 install = sublime_text_3_imfix.install changelog = README.md @@ -11,41 +13,23 @@ pkgbase = sublime-text-dev-imfix depends = gtk2 depends = libpng optdepends = gksu: sudo-save support - provides = sublime-text-dev=3.3083 + provides = sublime-text-dev=3.3103 provides = sublime-text-nightly conflicts = sublime-text-dev conflicts = sublime-text-nightly - noextract = Default.zh_CN.sublime-package - noextract = Default.zh_TW.sublime-package options = !strip - source = https://raw.githubusercontent.com/Firef0x/SublimeText-i18n-zh/master/dist/any/zh_CN/Default.zh_CN.sublime-package - source = https://raw.githubusercontent.com/Firef0x/SublimeText-i18n-zh/master/dist/any/zh_TW/Default.zh_TW.sublime-package - source = https://raw.githubusercontent.com/Firef0x/SublimeText-i18n-zh/master/dist/any/desktop/sublime_text_3.desktop - source = https://raw.githubusercontent.com/Firef0x/SublimeText-i18n-zh/master/dist/any/desktop/sublime_text_3_imfix.desktop + source = SublimeText-i18n-zh-master.zip::https://github.com/farseerfc/SublimeText-i18n-zh/archive/master.zip source = LICENSE - source = https://raw.githubusercontent.com/Firef0x/SublimeText-i18n-zh/master/dist/any/zh_CN/LICENSE.zh_CN - source = https://raw.githubusercontent.com/Firef0x/SublimeText-i18n-zh/master/dist/any/zh_TW/LICENSE.zh_TW - source = sublime_text_3_imfix.c source = sublime_text_3.sh source = sublime_text_3_imfix.sh - md5sums = b21c75fd6922ed383bf4b5ec0b62adb6 - md5sums = c13cc732b9007b205b2a6761f82f6564 - md5sums = 208a4b2ee9c8740e0d022b8050cedcbc - md5sums = 540175c597fdb98364c944551a4d08f1 - md5sums = ee96c697ef707e92077d0c55ec14922a - md5sums = f7e48316f800b0e1e0153111b1c80302 - md5sums = 6d473f472e643abe3549730b9fbd2b10 - md5sums = b436432a6223795c14d4aeb91423ab91 - md5sums = fa22069242e91e9a7a9dc4023ebf9bf5 - md5sums = 7be7d93a1062a9975f34661d66b72ff0 - source_i686 = http://c758482.r82.cf2.rackcdn.com/sublime_text_3_build_3083_x32.tar.bz2 - source_i686 = https://raw.githubusercontent.com/Firef0x/SublimeText-i18n-zh/master/dist/i686/sublime_text.i686 - md5sums_i686 = d1be10594fe7093b1b43a888a48c838f - md5sums_i686 = 9e65dda3f3760bf80915f755f2183519 - source_x86_64 = http://c758482.r82.cf2.rackcdn.com/sublime_text_3_build_3083_x64.tar.bz2 - source_x86_64 = https://raw.githubusercontent.com/Firef0x/SublimeText-i18n-zh/master/dist/x86_64/sublime_text.x86_64 - md5sums_x86_64 = 5da998bea29f9ca02a60d2b3cfc46fea - md5sums_x86_64 = 901cd838b215f814e2f260a3bdfb6179 + sha512sums = dcdbe5c4aeea56c66f284ca0bd7bc9ff1b31e3e5f63cdc5ae694b90252a6606564e7defa5ad317025b11faa59f962a4d9cc2b3d4355ebd02edbced715892d6f4 + sha512sums = 54b356867e6699fe88130c183ec76ea631f4afeab1a15f37e9ecd460f726bc7c80f056fd57637c24a67b865522e9d3bb5156414fe3cc5d091be9e1f21ef0f31f + sha512sums = 32023ae446a981cbf22c1e7c056d1bec76b1a8c4cba1a625d8314331c947ff3d12adaa24f267794f270de76a1170d19405a57100db1054760bfeeb29950bb5a0 + sha512sums = 3ed8d47663d6e825ff3321155a65e1afa691fea541b96500d11ac763c55741db5712a307f6695fdf5f6d09a71d195efea494736026612bac5d0e410bc1e43c1f + source_i686 = https://download.sublimetext.com/sublime_text_3_build_3103_x32.tar.bz2 + sha512sums_i686 = 1ed5225be25208a2cd35a0ed6819aa01fd8253c40cf28b1f9408cceb86c67191afcd7cb519f1c04b8c6f0d0fd700a7de83447d343709da679901d22df2f910bf + source_x86_64 = http://download.sublimetext.com/sublime_text_3_build_3103_x64.tar.bz2 + sha512sums_x86_64 = b51f25c376c06b4261d9e797fb0374532d2fdf86c96af5a7cf0847cb6f7514a7ceda894a4e9b5c63efe0053f6651f52dced9f438a319ddc4991524199a5b65bc pkgname = sublime-text-dev-imfix pkgdesc = Sophisticated text editor for code, HTML and prose, development build with Fcitx input method support @@ -5,8 +5,8 @@ # Contributor : ska <skatiger (at} gmail {dot) com> (From sublime-text-imfix) pkgname=('sublime-text-dev-imfix' 'sublime-text-dev-zh-cn' 'sublime-text-dev-zh-tw') -pkgver=3.3083 -pkgrel=2 +pkgver=3.3103 +pkgrel=1 arch=('i686' 'x86_64') url="http://www.sublimetext.com/3" license=('custom') @@ -19,44 +19,30 @@ changelog=README.md _pkgname=sublime_text_3 _pkgname1="${_pkgname}_imfix" -_rplexe=0 +_branchname="SublimeText-i18n-zh-master" install=${_pkgname1}.install -noextract=("Default.zh_CN.sublime-package" - "Default.zh_TW.sublime-package") -source=("https://raw.githubusercontent.com/Firef0x/SublimeText-i18n-zh/master/dist/any/zh_CN/Default.zh_CN.sublime-package" - "https://raw.githubusercontent.com/Firef0x/SublimeText-i18n-zh/master/dist/any/zh_TW/Default.zh_TW.sublime-package" - "https://raw.githubusercontent.com/Firef0x/SublimeText-i18n-zh/master/dist/any/desktop/${_pkgname}.desktop" - "https://raw.githubusercontent.com/Firef0x/SublimeText-i18n-zh/master/dist/any/desktop/${_pkgname1}.desktop" +source=("${_branchname}.zip::https://github.com/farseerfc/SublimeText-i18n-zh/archive/master.zip" "LICENSE" - "https://raw.githubusercontent.com/Firef0x/SublimeText-i18n-zh/master/dist/any/zh_CN/LICENSE.zh_CN" - "https://raw.githubusercontent.com/Firef0x/SublimeText-i18n-zh/master/dist/any/zh_TW/LICENSE.zh_TW" - "${_pkgname1}.c" "${_pkgname}.sh" "${_pkgname1}.sh") -source_i686=("http://c758482.r82.cf2.rackcdn.com/${_pkgname}_build_${pkgver:2}_x32.tar.bz2" - "https://raw.githubusercontent.com/Firef0x/SublimeText-i18n-zh/master/dist/i686/sublime_text.i686") -source_x86_64=("http://c758482.r82.cf2.rackcdn.com/${_pkgname}_build_${pkgver:2}_x64.tar.bz2" - "https://raw.githubusercontent.com/Firef0x/SublimeText-i18n-zh/master/dist/x86_64/sublime_text.x86_64") - -md5sums=('b21c75fd6922ed383bf4b5ec0b62adb6' - 'c13cc732b9007b205b2a6761f82f6564' - '208a4b2ee9c8740e0d022b8050cedcbc' - '540175c597fdb98364c944551a4d08f1' - 'ee96c697ef707e92077d0c55ec14922a' - 'f7e48316f800b0e1e0153111b1c80302' - '6d473f472e643abe3549730b9fbd2b10' - 'b436432a6223795c14d4aeb91423ab91' - 'fa22069242e91e9a7a9dc4023ebf9bf5' - '7be7d93a1062a9975f34661d66b72ff0') -md5sums_i686=('d1be10594fe7093b1b43a888a48c838f' - '9e65dda3f3760bf80915f755f2183519') -md5sums_x86_64=('5da998bea29f9ca02a60d2b3cfc46fea' - '901cd838b215f814e2f260a3bdfb6179') +source_i686=("https://download.sublimetext.com/${_pkgname}_build_${pkgver:2}_x32.tar.bz2") +source_x86_64=("http://download.sublimetext.com/${_pkgname}_build_${pkgver:2}_x64.tar.bz2") + +sha512sums=('dcdbe5c4aeea56c66f284ca0bd7bc9ff1b31e3e5f63cdc5ae694b90252a6606564e7defa5ad317025b11faa59f962a4d9cc2b3d4355ebd02edbced715892d6f4' + '54b356867e6699fe88130c183ec76ea631f4afeab1a15f37e9ecd460f726bc7c80f056fd57637c24a67b865522e9d3bb5156414fe3cc5d091be9e1f21ef0f31f' + '32023ae446a981cbf22c1e7c056d1bec76b1a8c4cba1a625d8314331c947ff3d12adaa24f267794f270de76a1170d19405a57100db1054760bfeeb29950bb5a0' + '3ed8d47663d6e825ff3321155a65e1afa691fea541b96500d11ac763c55741db5712a307f6695fdf5f6d09a71d195efea494736026612bac5d0e410bc1e43c1f') +sha512sums_i686=('1ed5225be25208a2cd35a0ed6819aa01fd8253c40cf28b1f9408cceb86c67191afcd7cb519f1c04b8c6f0d0fd700a7de83447d343709da679901d22df2f910bf') +sha512sums_x86_64=('b51f25c376c06b4261d9e797fb0374532d2fdf86c96af5a7cf0847cb6f7514a7ceda894a4e9b5c63efe0053f6651f52dced9f438a319ddc4991524199a5b65bc') build() { - gcc -shared -o libsublime-imfix.so `pkg-config --libs --cflags gtk+-2.0` -fPIC ${_pkgname1}.c + cp "${srcdir}/${_branchname}/dist/any/desktop/"* . + cp "${srcdir}/${_branchname}/dist/any/zh_CN/"* . + cp "${srcdir}/${_branchname}/dist/any/zh_TW/"* . + cp "${srcdir}/${_branchname}/src/fix/imfix/sublime_imfix.c" . + gcc -shared -o libsublime-imfix.so `pkg-config --libs --cflags gtk+-2.0` -fPIC sublime_imfix.c } _package_common() { @@ -103,12 +89,6 @@ package_sublime-text-dev-imfix() { package_sublime-text-dev-zh-cn() { pkgdesc="Sophisticated text editor for code, HTML and prose, development build with Simplified Chinese translation and Fcitx input method support" - if [ ${_rplexe} -eq 1 ]; then - rm "${_pkgname}/sublime_text" - install -Dm755 sublime_text.${CARCH} \ - ${_pkgname}/sublime_text - fi - rm "${_pkgname}/Packages/Default.sublime-package" install -Dm644 Default.zh_CN.sublime-package \ ${_pkgname}/Packages/Default.sublime-package @@ -122,12 +102,6 @@ package_sublime-text-dev-zh-cn() { package_sublime-text-dev-zh-tw() { pkgdesc="Sophisticated text editor for code, HTML and prose, development build with Traditional Chinese translation and Fcitx input method support" - if [ ${_rplexe} -eq 1 ]; then - rm "${_pkgname}/sublime_text" - install -Dm755 sublime_text.${CARCH} \ - ${_pkgname}/sublime_text - fi - rm "${_pkgname}/Packages/Default.sublime-package" install -Dm644 Default.zh_TW.sublime-package \ ${_pkgname}/Packages/Default.sublime-package diff --git a/sublime_text_3_imfix.c b/sublime_text_3_imfix.c deleted file mode 100644 index 9a90f1f3d755..000000000000 --- a/sublime_text_3_imfix.c +++ /dev/null @@ -1,263 +0,0 @@ -/* -sublime-imfix.c -Use LD_PRELOAD to interpose some function to fix sublime input method support for linux. -By Cjacker Huang <jianzhong.huang at i-soft.com.cn> -By whitequark@whitequark.org - -How to compile: -gcc -shared -o libsublime-imfix.so sublime_imfix.c `pkg-config --libs --cflags gtk+-2.0` -fPIC -How to use: -LD_PRELOAD=./libsublime-imfix.so sublime_text - -Changes: -2014 06-09 -1, Fix cursor position update for sublime text 3. -2, Combine the codes from whitequark(fix for xim immodule) and add cursor update support for XIM immodule. -*/ - -/*for RTLD_NEXT*/ -#define _GNU_SOURCE - -#include <gtk/gtk.h> -#include <gdk/gdkx.h> -#include <assert.h> -#include <dlfcn.h> -#include <stdio.h> -#include <string.h> -#include <gtk/gtk.h> -#include <X11/Xlib.h> -#include <X11/Xutil.h> - -#ifdef VERBOSE -#define DEBUG(fmt, ...) do { \ - FILE* err = fopen("/tmp/libsublime-immethod-fix.log", "a"); \ - if (err) { \ - fprintf(err, fmt, __VA_ARGS__); \ - fclose(err); \ - } \ - } while(0) -#else -#define DEBUG(fmt, ...) -#endif - - -typedef GdkSegment GdkRegionBox; - -struct _GdkRegion -{ - long size; - long numRects; - GdkRegionBox *rects; - GdkRegionBox extents; -}; - -GtkIMContext *local_context; - - -//this func is interposed to support cursor position update. -void -gdk_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 width is 2 in sublime text 2 - //And is 1 in sublime text 3. - //Maybe sometimes we will make a mistake, but for most of the time, it should be the caret. - if((rectangle->width == 2 || rectangle->width == 1) && GTK_IS_IM_CONTEXT(local_context)) { - gtk_im_context_set_cursor_location(local_context, rectangle); - } -} - -//this is needed, for example, if you input something in file dialog and return back the edit area -//context will lost, so here we set it again. -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); - - //below is our interposed codes to save the context to local_context. - 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; - } - //only add this event_filter when using 'fcitx' immodule. - //for xim immodule, this function is as same as original from gtk2. - const gchar * immodule = g_getenv("GTK_IM_MODULE"); - if(immodule && !strcmp(immodule, "fcitx")) { - gdk_window_add_filter (window, event_filter, context); - } -} - - -/*below codes is from whitequark, fix for xim immodule*/ - -/* See gtkimcontextxim.c */ -GType gtk_type_im_context_xim = 0; - -#define GTK_TYPE_IM_CONTEXT_XIM (gtk_type_im_context_xim) -#define GTK_IM_CONTEXT_XIM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_IM_CONTEXT_XIM, GtkIMContextXIM)) -#define GTK_IM_CONTEXT_XIM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_IM_CONTEXT_XIM, GtkIMContextXIMClass)) -#define GTK_IS_IM_CONTEXT_XIM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_IM_CONTEXT_XIM)) -#define GTK_IS_IM_CONTEXT_XIM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IM_CONTEXT_XIM)) -#define GTK_IM_CONTEXT_XIM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_IM_CONTEXT_XIM, GtkIMContextXIMClass)) - -typedef struct _GtkIMContextXIM GtkIMContextXIM; -typedef struct _GtkIMContextXIMClass GtkIMContextXIMClass; - -struct _GtkIMContextXIMClass -{ - GtkIMContextClass parent_class; -}; - -typedef struct _StatusWindow StatusWindow; -typedef struct _GtkXIMInfo GtkXIMInfo; - -struct _GtkIMContextXIM -{ - GtkIMContext object; - - GtkXIMInfo *im_info; - - gchar *locale; - gchar *mb_charset; - - GdkWindow *client_window; - GtkWidget *client_widget; - - /* The status window for this input context; we claim the -* * status window when we are focused and have created an XIC -* */ - StatusWindow *status_window; - - gint preedit_size; - gint preedit_length; - gunichar *preedit_chars; - XIMFeedback *feedbacks; - - gint preedit_cursor; - - XIMCallback preedit_start_callback; - XIMCallback preedit_done_callback; - XIMCallback preedit_draw_callback; - XIMCallback preedit_caret_callback; - - XIMCallback status_start_callback; - XIMCallback status_done_callback; - XIMCallback status_draw_callback; - - XIMCallback string_conversion_callback; - - XIC ic; - - guint filter_key_release : 1; - guint use_preedit : 1; - guint finalizing : 1; - guint in_toplevel : 1; - guint has_focus : 1; -}; - -static GClassInitFunc orig_gtk_im_context_xim_class_init; -static GType (*orig_g_type_module_register_type)(GTypeModule *, - GType, const gchar *, - const GTypeInfo *, GTypeFlags); -static gboolean (*orig_gtk_im_context_xim_filter_keypress)(GtkIMContext *context, - GdkEventKey *event); - -static gboolean -hook_gtk_im_context_xim_filter_keypress(GtkIMContext *context, GdkEventKey *event) { - GtkIMContextXIM *im_context_xim = GTK_IM_CONTEXT_XIM(context); - if (!im_context_xim->client_window) { - DEBUG("im_context_xim == %p\n", im_context_xim); - DEBUG("event->window == %p\n", event->window); - - gtk_im_context_set_client_window(context, event->window); - } - - return orig_gtk_im_context_xim_filter_keypress(context, event); -} - -static void -hook_gtk_im_context_xim_class_init (GtkIMContextXIMClass *class) { - orig_gtk_im_context_xim_class_init(class, NULL); /* wat? */ - - GtkIMContextClass *im_context_class = GTK_IM_CONTEXT_CLASS (class); - - assert(!orig_gtk_im_context_xim_filter_keypress); - orig_gtk_im_context_xim_filter_keypress = im_context_class->filter_keypress; - im_context_class->filter_keypress = hook_gtk_im_context_xim_filter_keypress; - DEBUG("orig_gtk_im_context_xim_filter_keypress: %p\n", - orig_gtk_im_context_xim_filter_keypress); -} - -GType -g_type_module_register_type (GTypeModule *module, - GType parent_type, - const gchar *type_name, - const GTypeInfo *type_info, - GTypeFlags flags) { - if (!orig_g_type_module_register_type) { - orig_g_type_module_register_type = dlsym(RTLD_NEXT, "g_type_module_register_type"); - assert(orig_g_type_module_register_type); - } - - if (type_name && !strcmp(type_name, "GtkIMContextXIM")) { - assert(!orig_gtk_im_context_xim_class_init); - orig_gtk_im_context_xim_class_init = type_info->class_init; - - assert(sizeof(GtkIMContextXIM) == type_info->instance_size); - - const GTypeInfo hook_im_context_xim_info = - { - type_info->class_size, - type_info->base_init, - type_info->base_finalize, - (GClassInitFunc) hook_gtk_im_context_xim_class_init, - type_info->class_finalize, - type_info->class_data, - type_info->instance_size, - type_info->n_preallocs, - type_info->instance_init, - }; - - DEBUG("orig_gtk_im_context_xim_class_init: %p\n", orig_gtk_im_context_xim_class_init); - - gtk_type_im_context_xim = - orig_g_type_module_register_type(module, parent_type, type_name, - &hook_im_context_xim_info, flags); - - return gtk_type_im_context_xim; - } - - return orig_g_type_module_register_type(module, parent_type, type_name, type_info, flags); -} |