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

Re: Last attempt to fix XIM

Expand Messages
  • Bram Moolenaar
    ... In Vim 5.8 there was a check for being in Normal mode. When in Normal mode, XIM was not activated. Now in 6.0 we use xim_is_active instead of this check
    Message 1 of 17 , Sep 26, 2001
      Yasuhiro Matsumoto wrote:

      > >> if (xic == NULL)
      > >> return;
      > >>
      > >>+ if (!xim_support_preeditstate)
      > >>+ return;
      > >>+
      > >> if (p_imdisable)
      > >> active = FALSE;
      > >
      > >I would prefer something here in the line of 5.8: When some flag is set,
      > >always set active to TRUE. This would mean XIM is never disabled and
      > >xim_has_focus is always TRUE (unless Vim doesn't have focus at all).
      > >The change to use "force" in xim_set_focus() is not needed then.
      > >Still, the question remains when we should set active to TRUE then. In
      > >5.8 this was used:
      > >
      > >#ifdef USE_GUI_GTK
      > > || (xim_input_style & GDK_IM_PREEDIT_POSITION)
      > >#else
      > > || (input_style & XIMPreeditPosition)
      > >#endif
      > >
      > >Would this still be usable?
      >
      > sorry i could understand because my poor englsh.
      > please explain more easy.
      > do you say that we must not use "force"?
      >
      > to back vim58, we must not check xim_is_active in xim_set_focus().

      In Vim 5.8 there was a check for being in Normal mode. When in Normal
      mode, XIM was not activated. Now in 6.0 we use xim_is_active instead of
      this check for Normal mode. xim_is_active is set when going from Normal
      mode to Insert mode and it is reset when going from Insert mode to
      Normal mode. Thus xim_is_active has the same meaning as the old
      check for being in Normal mode:

      Normal mode: xim_is_active == FALSE
      Insert mode: xim_is_active == TRUE

      This requires 'iminsert' to be 2, which is the default. Thus when using
      xim_is_active instead of checking being in Normal mode, we should get
      the same behavior.

      The code I quoted above to check "xim_input_style" or "input_style" was
      used additionally. It looks like when preediting is used, according to
      this check, XIM would remain active in Normal mode. Thus in Vim 6.0
      xim_is_active might have to be TRUE when the above check is true. But
      this should be verified.

      X = (input_style indicates preediting);
      Normal mode && X == FALSE: xim_is_active == FALSE
      Normal mode && X == TRUE: xim_is_active == TRUE
      Insert mode: xim_is_active == TRUE

      The patch for Vim 6.0ax (without other patches) could be this:

      *** ../../vim60ax.20/src/mbyte.c Wed Sep 19 16:57:43 2001
      --- mbyte.c Wed Sep 26 13:01:16 2001
      ***************
      *** 2730,2737 ****
      --- 2730,2746 ----
      if (xic == NULL)
      return;

      + /* If 'imdisable' is set, XIM is never active. */
      if (p_imdisable)
      active = FALSE;
      + else if (
      + #ifdef USE_GUI_GTK
      + (xim_input_style & GDK_IM_PREEDIT_POSITION)
      + #else
      + (input_style & XIMPreeditPosition)
      + #endif
      + )
      + active = TRUE;

      /* Remember the active state, it is needed when Vim gets keyboard focus. */
      xim_is_active = active;
      ***************
      *** 2815,2821 ****
      im_xim_send_event_imactivate();
      # endif
      #endif
      ! xim_set_focus(TRUE);
      }

      /*
      --- 2824,2830 ----
      im_xim_send_event_imactivate();
      # endif
      #endif
      ! xim_set_preedit();
      }

      /*


      Please check if this fixes your problem. Keep 'iminsert' at 2. Setting
      it to 0 should disable XIM, although with the above patch and preediting
      is used (X is TRUE) it will be enabled anyway. That is why I hesitate
      to include this, it will probably break it for some people.

      --
      A)bort, R)etry, D)o it right this time

      /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
      ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim )))
      \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
    • Yasuhiro Matsumoto
      ... Thanks. ... [snip] ... yes this fixes problem. but input_style is not real time variable. thus we can start preediting any time. and though if iminsert
      Message 2 of 17 , Sep 26, 2001
        >>sorry i could understand because my poor englsh.
        >>please explain more easy.
        >>do you say that we must not use "force"?
        >>
        >>to back vim58, we must not check xim_is_active in xim_set_focus().
        >
        >In Vim 5.8 there was a check for being in Normal mode. When in Normal
        >mode, XIM was not activated. Now in 6.0 we use xim_is_active instead of
        >this check for Normal mode. xim_is_active is set when going from Normal
        >mode to Insert mode and it is reset when going from Insert mode to
        >Normal mode. Thus xim_is_active has the same meaning as the old
        >check for being in Normal mode:
        >
        > Normal mode: xim_is_active == FALSE
        > Insert mode: xim_is_active == TRUE
        >
        >This requires 'iminsert' to be 2, which is the default. Thus when using
        >xim_is_active instead of checking being in Normal mode, we should get
        >the same behavior.
        >
        >The code I quoted above to check "xim_input_style" or "input_style" was
        >used additionally. It looks like when preediting is used, according to
        >this check, XIM would remain active in Normal mode. Thus in Vim 6.0
        >xim_is_active might have to be TRUE when the above check is true. But
        >this should be verified.
        >
        > X = (input_style indicates preediting);
        > Normal mode && X == FALSE: xim_is_active == FALSE
        > Normal mode && X == TRUE: xim_is_active == TRUE
        > Insert mode: xim_is_active == TRUE

        Thanks.

        >The patch for Vim 6.0ax (without other patches) could be this:
        [snip]
        >Please check if this fixes your problem. Keep 'iminsert' at 2. Setting
        >it to 0 should disable XIM, although with the above patch and preediting
        >is used (X is TRUE) it will be enabled anyway. That is why I hesitate
        >to include this, it will probably break it for some people.

        yes this fixes problem.
        but "input_style" is not real time variable.
        thus we can start preediting any time.
        and though if iminsert is 0, we can also do it.

        active will be TRUE anyway.

        is this ok?

        and now i can't test gtk version.
        is there who can test this with japanese xim?
        --
        Yasuhiro


        _________________________________________________________________
        Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
      • Bram Moolenaar
        ... Yes, the patch will cause the XIM to be active at all times. Even when iminsert is zero. Only setting imdisable will switch off XIM then. It would be
        Message 3 of 17 , Sep 26, 2001
          Yasuhiro Matsumoto wrote:

          > >The patch for Vim 6.0ax (without other patches) could be this:
          > [snip]
          > >Please check if this fixes your problem. Keep 'iminsert' at 2. Setting
          > >it to 0 should disable XIM, although with the above patch and preediting
          > >is used (X is TRUE) it will be enabled anyway. That is why I hesitate
          > >to include this, it will probably break it for some people.
          >
          > yes this fixes problem.
          > but "input_style" is not real time variable.
          > thus we can start preediting any time.
          > and though if iminsert is 0, we can also do it.
          >
          > active will be TRUE anyway.
          >
          > is this ok?
          >
          > and now i can't test gtk version.
          > is there who can test this with japanese xim?

          Yes, the patch will cause the XIM to be active at all times. Even when
          'iminsert' is zero. Only setting 'imdisable' will switch off XIM then.
          It would be better to find another solution, but I do not know how to
          do it.

          Since you reported this problem only for the non-GTK version, we should
          probably only use this hack for when FEAT_GUI_GTK is not defined.

          So here is the patch as I have it now. Please verify this still solves
          the problem for you. Suggestions from others are also welcome, of
          course!

          *** ../../vim60ax.20/src/mbyte.c Wed Sep 19 16:57:43 2001
          --- mbyte.c Wed Sep 26 13:42:00 2001
          ***************
          *** 2730,2737 ****
          --- 2730,2745 ----
          if (xic == NULL)
          return;

          + /* If 'imdisable' is set, XIM is never active. */
          if (p_imdisable)
          active = FALSE;
          + #ifndef FEAT_GUI_GTK
          + else if (input_style & XIMPreeditPosition)
          + /* There is a problem in switching XIM off when preediting is used,
          + * and it is not clear how this can be solved. For now, keep XIM on
          + * all the time, like it was done in Vim 5.8. */
          + active = TRUE;
          + #endif

          /* Remember the active state, it is needed when Vim gets keyboard focus. */
          xim_is_active = active;
          ***************
          *** 2815,2821 ****
          im_xim_send_event_imactivate();
          # endif
          #endif
          ! xim_set_focus(TRUE);
          }

          /*
          --- 2823,2829 ----
          im_xim_send_event_imactivate();
          # endif
          #endif
          ! xim_set_preedit();
          }

          /*

          --
          A)bort, R)etry, P)lease don't bother me again

          /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
          ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim )))
          \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
        Your message has been successfully submitted and would be delivered to recipients shortly.