Loading ...
Sorry, an error occurred while loading the content.

vim-5.7: On-The-Spot patch for gtk+ gui (Re: Patch 5.6.037 causes..)

Expand Messages
  • Sung-Hyun Nam
    ... I includes the On-The-Spot patch for gtk+ gui version made by Chi-Deok Hwang. I see it is worse than mozilla s on-the-spot feature. Screen flickers because
    Message 1 of 1 , Jun 26, 2000
    • 0 Attachment
      Sung-Hyun Nam wrote:
      > Takuhiro Nishioka wrote:
      > >
      > > Wow, that will be great! Please send me it. And if
      > > possible, please send the patch to this mailing list so
      > > that other can test.
      >
      > I hope Hwang send it to list, because I don't know well about it.
      > I cannot explain anything if someone want to comment about it...

      I includes the On-The-Spot patch for gtk+ gui version made by Chi-Deok
      Hwang. I see it is worse than mozilla's on-the-spot feature.

      Screen flickers because gvim draws a word 3 or 4 times.
      Though I use this patch a while without any problem,
      I think it is more critical than lack of feature.
      How can it be avoided?

      regards,

      namsh

      diff -u -u -r1.18 gui_gtk_x11.c
      --- ./src/gui_gtk_x11.c 2000/06/24 14:42:53 1.18
      +++ ./src/gui_gtk_x11.c 2000/06/24 14:48:52
      @@ -522,6 +522,11 @@
      len = event->length;
      state = event->state;
      g_assert(len <= sizeof(string));
      +#ifdef USE_XIM
      + if (xim_queue_key_press_event(event)) {
      + return TRUE;
      + }
      +#endif

      #ifdef HANGUL_INPUT
      if (event->keyval == GDK_space && (state & GDK_SHIFT_MASK))
      @@ -1107,6 +1112,10 @@
      if (event->type != GDK_BUTTON_PRESS)
      return FALSE;

      +#ifdef USE_XIM
      + xim_reset();
      +#endif
      +
      x = event->x;
      y = event->y;

      @@ -2521,6 +2530,7 @@
      return;

      #if defined(USE_FONTSET) && defined(MULTI_BYTE)
      +
      if (gui.fontset)
      {
      if (col > 0 && mb_isbyte1(LinePointers[row], col - 1))
      @@ -2529,12 +2539,14 @@
      len--;
      s++;
      }
      + if (len <= 0) return;
      if (len == 1 && IsLeadByte(*s))
      len = 2;
      }
      #endif

      gc = gdk_gc_new(gui.drawarea->window);
      +
      gdk_gc_set_exposures(gc, gui.visibility != GDK_VISIBILITY_UNOBSCURED);

      if (flags & DRAW_TRANSP) {
      diff -u -u -r1.14 multbyte.c
      --- ./src/multbyte.c 2000/06/10 15:32:10 1.14
      +++ ./src/multbyte.c 2000/06/24 14:48:52
      @@ -797,6 +797,8 @@
      GdkIMStyle supported_style = GDK_IM_PREEDIT_NONE |
      GDK_IM_PREEDIT_NOTHING |
      GDK_IM_PREEDIT_POSITION |
      + GDK_IM_PREEDIT_CALLBACKS |
      + /*GDK_IM_STATUS_CALLBACKS | */
      GDK_IM_STATUS_AREA |
      GDK_IM_STATUS_NONE |
      GDK_IM_STATUS_NOTHING;
      @@ -824,6 +826,138 @@
      }
      }

      +#include <gdk/gdkx.h>
      +
      +static void
      +preedit_start_cbproc(XIC xic, XPointer client_data, XPointer call_data)
      +{
      +}
      +
      +static void
      +xim_back_delete(int n)
      +{
      + char str[3];
      + str[0] = CSI;
      + str[1] = 'k';
      + str[2] = 'b';
      + while(n-- > 0) {
      + add_to_input_buf(str, 3);
      + }
      +}
      +
      +static GSList *key_press_event_queue = NULL;
      +static int preedit_buf_len = 0;
      +gint do_draw_queue = 0;
      +
      +static void
      +preedit_draw_cbproc(XIC xic, XPointer client_data, XPointer call_data)
      +{
      + XIMPreeditDrawCallbackStruct *draw_data = (XIMPreeditDrawCallbackStruct *)call_data;
      + XIMText *text = (XIMText *)draw_data->text;
      + GdkWChar *wstr = NULL;
      + char *src;
      + GSList *event_queue;
      + extern int draw_queue_flush(void);
      + if (draw_data->chg_length > 0) {
      + xim_back_delete(draw_data->chg_length);
      + preedit_buf_len -= draw_data->chg_length;
      + }
      + if (text && (src=text->string.multi_byte)) {
      + int len = strlen(src);
      + wstr = g_new(GdkWChar, len);
      + preedit_buf_len += gdk_mbstowcs(wstr, src, len);
      + g_free(wstr);
      + add_to_input_buf(src, len);
      + }
      + event_queue = key_press_event_queue;
      + while (event_queue) {
      + GdkEvent *ev = event_queue->data;
      + gboolean *ret;
      + gtk_signal_emit_by_name((GtkObject*)gui.mainwin, "key_press_event", ev, &ret);
      + gdk_event_free(ev);
      + event_queue = event_queue->next;
      + }
      + if (key_press_event_queue) {
      + g_slist_free(key_press_event_queue);
      + key_press_event_queue = NULL;
      + }
      + if (gtk_main_level() > 0)
      + gtk_main_quit();
      + return;
      +}
      +
      +
      +static void
      +preedit_caret_cbproc(XIC xic, XPointer client_data, XPointer call_data)
      +{
      +}
      +
      +static void
      +preedit_done_cbproc(XIC xic, XPointer client_data, XPointer call_data)
      +{
      +}
      +
      +void
      +xim_reset(void)
      +{
      + char * text;
      + if (!xic) return;
      + text = XmbResetIC(((GdkICPrivate*)xic)->xic);
      + if (!(xim_input_style & GDK_IM_PREEDIT_CALLBACKS))
      + {
      + add_to_input_buf(text, strlen(text));
      + }
      + else
      + preedit_buf_len = 0;
      + if (text) XFree(text);
      +}
      +
      +int
      +xim_need_queue(void)
      +{
      + return do_draw_queue;
      +}
      +
      +int
      +xim_queue_key_press_event(GdkEvent *ev)
      +{
      + if (preedit_buf_len <= 0) return FALSE;
      + key_press_event_queue = g_slist_append(key_press_event_queue,
      + gdk_event_copy(ev));
      + return TRUE;
      +}
      +
      +static void
      +preedit_callback_setup(GdkIC *ic)
      +{
      + XIC xxic;
      + XVaNestedList preedit_attr;
      + XIMCallback preedit_start_cb;
      + XIMCallback preedit_draw_cb;
      + XIMCallback preedit_caret_cb;
      + XIMCallback preedit_done_cb;
      + xxic = ((GdkICPrivate*)xic)->xic;
      + preedit_start_cb.callback = (XIMProc)preedit_start_cbproc;
      + preedit_draw_cb.callback = (XIMProc)preedit_draw_cbproc;
      + preedit_caret_cb.callback = (XIMProc)preedit_caret_cbproc;
      + preedit_done_cb.callback = (XIMProc)preedit_done_cbproc;
      + preedit_attr = XVaCreateNestedList (0,
      + XNPreeditStartCallback, &preedit_start_cb,
      + XNPreeditDrawCallback, &preedit_draw_cb,
      + XNPreeditCaretCallback, &preedit_caret_cb,
      + XNPreeditDoneCallback, &preedit_done_cb,
      + XNPreeditStartCallback, &preedit_start_cb, 0);
      + XSetICValues (xxic, XNPreeditAttributes, preedit_attr, 0);
      + XFree(preedit_attr);
      +}
      +
      +static void
      +reset_state_setup(GdkIC *ic)
      +{
      + /* don't change the input context when we call reset */
      + XSetICValues(((GdkICPrivate*)ic)->xic, XNResetState, XIMPreserveState, 0);
      +}
      +
      void
      xim_init()
      {
      @@ -896,7 +1030,11 @@
      attr->status_area.height = gui.char_height;
      attr->status_fontset = gui.fontset;
      }
      + } else if ((xim_input_style & GDK_IM_STATUS_MASK) == GDK_IM_STATUS_CALLBACKS)
      + {
      + /* FIXME */
      }
      +
      #endif

      xic = gdk_ic_new(attr, attrmask);
      @@ -908,6 +1046,9 @@
      mask = gdk_window_get_events(widget->window);
      mask |= gdk_ic_get_events(xic);
      gdk_window_set_events(widget->window, mask);
      + if (xim_input_style & GDK_IM_PREEDIT_CALLBACKS)
      + preedit_callback_setup(xic);
      + reset_state_setup(xic);
      }
      }
      }
    Your message has been successfully submitted and would be delivered to recipients shortly.