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

Re: Last attempt to fix XIM

Expand Messages
  • Muraoka Taro
    After apply this patch, I get one problem at least. I set imi=2 and enter insert mode and activate XIM (start preediting). After input some multibyte text
    Message 1 of 17 , Sep 25, 2001
    • 0 Attachment
      After apply this patch, I get one problem at least.

      I set 'imi=2' and enter insert mode and activate XIM (start preediting).
      After input some multibyte text and then return to normal mode with hitting ESC.
      But XIM is being activated yet.

      Before this patch, XIM was deactivated (unfocused?) when return to normal mode.
      ----
      Muraoka Taro <koron@...>


      > If you see something wrong after this patch, please describe exactly
      > what the problem is, from the point of view of the user. Take into
      > account that there are many different types of XIM. If you can suggest
      > a change, please keep in mind that it should not break it for anybody
      > else.
    • Bram Moolenaar
      ... I am glad you describe the problems. That XIM doesn t work when iminsert is 0 is OK. This value of iminsert is supposed to disable XIM, so that you
      Message 2 of 17 , Sep 25, 2001
      • 0 Attachment
        Yasuhiro Matsumoto wrote:

        > It seems broken for me.
        > I wonder why need xim_is_active.
        > on vim58, it worked fine.
        >
        > I tested as below.
        >
        > 1. using preediting on vim58
        > we can use preediting correctly.
        >
        > and we could use as below in normal mode.
        > (please comparing [] to multibyte)
        >
        > "cf[]" or "r[]"
        >
        > 2. using preediting on vim60 on athena
        > if 'iminsert=0', we can' use preediting correctly.
        > (can't display preediting words)
        > if 'iminsert=2', vim begin 'insert mode' without preediting.
        > and "XIM INSERT" was shown without preediting.
        >
        > we can't use as below in normal mode.
        > (please comparing [] to multibyte)
        > "cf[]" or "r[]"
        >
        > 3. using preediting on vim60 on gtk
        > if 'iminsert=0', we can' use preediting correctly.
        > (can't display preediting words)
        > if 'iminsert=2', vim begin 'insert mode' with preediting.
        >
        > we can't use as below in normal mode.
        > (please comparing [] to multibyte)
        > "cf[]" or "r[]"

        I am glad you describe the problems. That XIM doesn't work when
        'iminsert' is 0 is OK. This value of 'iminsert' is supposed to disable
        XIM, so that you can type English directly, without having to type a key
        combination to disable it. It should also allow typing dead keys like '
        as a Vim command (but I'm not sure if that really ever works).

        In point 2. the real problem is that when 'iminsert' is 2, starting
        Insert mode should start XIM. Also, "r" and "f" commands should start
        XIM for the following character. This is done with 'iminsert' as well,
        thus this is the same problem. Both call im_set_active() to make XIM
        active. This then calls xim_set_focus(TRUE), which should activate XIM.
        I don't understand why this does not work. Does XSetICFocus() not
        really activate XIM?

        In point 3. I don't understand why Insert mode works correctly, but "f"
        and "r" do not. Perhaps this is because the cursor isn't positioned, so
        that im_set_position() is not called? Do we need to call
        xim_set_preedit() from im_set_active() perhaps? Try this:

        *** mbyte.c~ Tue Sep 25 12:21:34 2001
        --- mbyte.c Tue Sep 25 12:41:40 2001
        ***************
        *** 2825,2831 ****
        im_xim_send_event_imactivate();
        # endif
        #endif
        ! xim_set_focus(TRUE);
        }

        /*
        --- 2825,2831 ----
        im_xim_send_event_imactivate();
        # endif
        #endif
        ! xim_set_preedit();
        }

        /*

        > ------------------------------
        > if you include attached patch, vim60 work as below.
        >
        > 2. using preediting on vim60 on athena
        > if 'iminsert=0', we can use preediting correctly.
        > if 'iminsert=2', vim begin 'insert mode' without preediting.
        > and "XIM INSERT" was never shown.
        > (this cause is that we can't handling it in callback)
        >
        > we can use as below in normal mode.
        > (please comparing [] to multibyte)
        > "cf[]" or "r[]"
        >
        > 3. using preediting on vim60 on gtk
        > if 'iminsert=0', we can use preediting correctly.
        > if 'iminsert=2', vim begin 'insert mode' with preediting.
        >
        > and we can use as below in normal mode.
        > (please comparing [] to multibyte)
        > "cf[]" or "r[]"

        It looks like what you have done is to enable XIM always. The value of
        'iminsert' isn't used at all, it seems, although your explanations above
        suggest otherwise. This is not a solution, this is going in the wrong
        direction. Even in 5.8 XIM wasn't active in Normal mode.

        There is one part from 5.8 that I didn't include yet. Since you keep
        talking about preediting, perhaps this change will help:

        -------------------------
        *** mbyte.c~ Tue Sep 25 10:32:08 2001
        --- mbyte.c Tue Sep 25 12:18:41 2001
        ***************
        *** 2730,2737 ****
        --- 2730,2747 ----
        if (xic == NULL)
        return;

        + /* If 'imdisable' is set, XIM is never active. When using preediting,
        + * there are some unclear problems, always make XIM active. */
        if (p_imdisable)
        active = FALSE;
        + else if (
        + #ifdef FEAT_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;
        -------------------------

        This is a change in im_set_active(), on top of the previous patch I sent
        yesterday.

        --
        Scientists decoded the first message from an alien civilization:
        SIMPLY SEND 6 TIMES 10 TO THE 50 ATOMS OF HYDROGEN TO THE STAR
        SYSTEM AT THE TOP OF THE LIST, CROSS OFF THAT STAR SYSTEM, THEN PUT
        YOUR STAR SYSTEM AT THE BOTTOM OF THE LIST AND SEND IT TO 100 OTHER
        STAR SYSTEMS. WITHIN ONE TENTH GALACTIC ROTATION YOU WILL RECEIVE
        ENOUGH HYDROGREN TO POWER YOUR CIVILIZATION UNTIL ENTROPY REACHES ITS
        MAXIMUM! IT REALLY WORKS!

        /// 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 ///
      • Bram Moolenaar
        ... Yes, one of the things this patch does is not removing focus from XIM when leaving Insert mode. This was a change between Vim 5.8 and 6.0ax that I
        Message 3 of 17 , Sep 25, 2001
        • 0 Attachment
          Muraoka Taro wrote:

          > After apply this patch, I get one problem at least.
          >
          > I set 'imi=2' and enter insert mode and activate XIM (start preediting).
          > After input some multibyte text and then return to normal mode with
          > hitting ESC. But XIM is being activated yet.
          >
          > Before this patch, XIM was deactivated (unfocused?) when return to
          > normal mode.

          Yes, one of the things this patch does is not removing focus from XIM
          when leaving Insert mode. This was a change between Vim 5.8 and 6.0ax
          that I reversed now, in an attempt to fix the problems Yasuhiro
          Matsumoto reported.

          Can we please somehow figure out the change that makes it work for
          Yasuhiro but doesn't break it for you? Also, can you tell me if it
          worked OK for you before this patch. Then I wonder what is different
          for Yasuhiro why it doesn't work for him.

          I'm starting to believe that the patch I just sent out for calling
          xim_set_preedit() at the end of im_set_active() could be a good
          solution. In Vim 5.8 xim_set_preedit() was called more often. But I'm
          only guessing, I can't try it myself. If you want to verify this,
          please take the original Vim 6.0ax version of mbyte.c, and only change
          this:

          *** ../../vim-6.0ax/src/mbyte.c Wed Sep 19 21:36:34 2001
          --- mbyte.c Tue Sep 25 13:05:38 2001
          ***************
          *** 2815,2821 ****
          im_xim_send_event_imactivate();
          # endif
          #endif
          ! xim_set_focus(TRUE);
          }

          /*
          --- 2816,2822 ----
          im_xim_send_event_imactivate();
          # endif
          #endif
          ! xim_set_preedit();
          }

          /*

          Note that there is very little time, I don't want to delay the 6.0
          release any further.

          --
          Team-building exercises come in many forms but they all trace their roots back
          to the prison system. In your typical team-building exercise the employees
          are subjected to a variety of unpleasant situations until they become either a
          cohesive team or a ring of car jackers.
          (Scott Adams - The Dilbert principle)

          /// 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 ///
        • Muraoka Taro
          ... It works good for me. Thanks Bram!! BTW, I just realized a problem for GTK version. I set imi=2 and use r or f then type multibyte via XIM, it works
          Message 4 of 17 , Sep 25, 2001
          • 0 Attachment
            > I'm starting to believe that the patch I just sent out for calling
            > xim_set_preedit() at the end of im_set_active() could be a good
            > solution. In Vim 5.8 xim_set_preedit() was called more often. But I'm
            > only guessing, I can't try it myself. If you want to verify this,
            > please take the original Vim 6.0ax version of mbyte.c, and only change
            > this:

            It works good for me. Thanks Bram!!

            BTW, I just realized a problem for GTK version.
            I set "imi=2" and use 'r' or 'f' then type multibyte via XIM,
            it works correctry.
            But after that vim cann't accept any keyboard input.

            ...It seems be close to release 6.0,
            I suggest to make some patch for this after release.
            ----
            Muraoka Taro <koron@...>
          • Bram Moolenaar
            ... Was this problem present before this patch as well? Did it work correctly in Vim 6.0ax for you? -- If your company is not involved in something called
            Message 5 of 17 , Sep 25, 2001
            • 0 Attachment
              Muraoka Taro wrote:

              > > I'm starting to believe that the patch I just sent out for calling
              > > xim_set_preedit() at the end of im_set_active() could be a good
              > > solution. In Vim 5.8 xim_set_preedit() was called more often. But I'm
              > > only guessing, I can't try it myself. If you want to verify this,
              > > please take the original Vim 6.0ax version of mbyte.c, and only change
              > > this:
              >
              > It works good for me. Thanks Bram!!
              >
              > BTW, I just realized a problem for GTK version.
              > I set "imi=2" and use 'r' or 'f' then type multibyte via XIM,
              > it works correctry.
              > But after that vim cann't accept any keyboard input.
              >
              > ...It seems be close to release 6.0,
              > I suggest to make some patch for this after release.

              Was this problem present before this patch as well? Did it work
              correctly in Vim 6.0ax for you?

              --
              If your company is not involved in something called "ISO 9000" you probably
              have no idea what it is. If your company _is_ involved in ISO 9000 then you
              definitely have no idea what it is.
              (Scott Adams - The Dilbert principle)

              /// 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 ///
            • Muraoka Taro
              ... Yes it was. It may be since more old version. I don t use r or f command with multibyte char usually. With excepting this point, it seems vim work all
              Message 6 of 17 , Sep 25, 2001
              • 0 Attachment
                > Was this problem present before this patch as well? Did it work
                > correctly in Vim 6.0ax for you?


                Yes it was.
                It may be since more old version.
                I don't use 'r' or 'f' command with multibyte char usually.

                With excepting this point, it seems vim work all correctry for me.
                ----
                Muraoka Taro <koron@...>
              • Yasuhiro Matsumoto
                ... Yes, I guess there are two types in XIM. one of them is that it begin preediting when be called XSetICFocus. and else is that it ready for preediting when
                Message 7 of 17 , Sep 26, 2001
                • 0 Attachment
                  >I am glad you describe the problems. That XIM doesn't work when
                  >'iminsert' is 0 is OK. This value of 'iminsert' is supposed to disable
                  >XIM, so that you can type English directly, without having to type a key
                  >combination to disable it. It should also allow typing dead keys like '
                  >as a Vim command (but I'm not sure if that really ever works).
                  >
                  >In point 2. the real problem is that when 'iminsert' is 2, starting
                  >Insert mode should start XIM. Also, "r" and "f" commands should start
                  >XIM for the following character. This is done with 'iminsert' as well,
                  >thus this is the same problem. Both call im_set_active() to make XIM
                  >active. This then calls xim_set_focus(TRUE), which should activate XIM.
                  >I don't understand why this does not work. Does XSetICFocus() not
                  >really activate XIM?

                  Yes, I guess there are two types in XIM.
                  one of them is that it begin preediting when be called XSetICFocus.
                  and else is that it ready for preediting when be called XSetICFocus.

                  Japanese uses seconds.

                  >In point 3. I don't understand why Insert mode works correctly, but "f"
                  >and "r" do not. Perhaps this is because the cursor isn't positioned, so
                  >that im_set_position() is not called? Do we need to call
                  >xim_set_preedit() from im_set_active() perhaps? Try this:

                  Hmm...
                  There are still bits problem.

                  Now I am thinking that
                  vim should not work with new changes if XIM don't support XNPreeditState.
                  I hope that vim do original acts if XIM don't support.
                  How do you think about?

                  --
                  Yasuhiro



                  _________________________________________________________________
                  Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
                • Bram Moolenaar
                  ... Is there any way to find out what kind of XIM is being used? ... It is too late to change much now. I have postponed version 6.0 long enough, thus I have
                  Message 8 of 17 , Sep 26, 2001
                  • 0 Attachment
                    Yasuhiro Matsumoto wrote:

                    > Yes, I guess there are two types in XIM.
                    > one of them is that it begin preediting when be called XSetICFocus.
                    > and else is that it ready for preediting when be called XSetICFocus.
                    >
                    > Japanese uses seconds.

                    Is there any way to find out what kind of XIM is being used?

                    > >In point 3. I don't understand why Insert mode works correctly, but "f"
                    > >and "r" do not. Perhaps this is because the cursor isn't positioned, so
                    > >that im_set_position() is not called? Do we need to call
                    > >xim_set_preedit() from im_set_active() perhaps? Try this:
                    >
                    > Hmm...
                    > There are still bits problem.
                    >
                    > Now I am thinking that
                    > vim should not work with new changes if XIM don't support XNPreeditState.
                    > I hope that vim do original acts if XIM don't support.
                    > How do you think about?

                    It is too late to change much now. I have postponed version 6.0 long
                    enough, thus I have to make a best guess.

                    I suppose doing something similar to version 5.8 is the best. Please
                    check out the patches that I sent yesterday and tell me which solution
                    works best for you. If you have a better idea, perhaps with checking
                    for XNPreeditState, please show me your suggested patch.

                    Please respond right away, Vim 6.0 is just around the corner...

                    --
                    The process for understanding customers primarily involves sitting around with
                    other marketing people and talking about what you would to if you were dumb
                    enough to be a customer.
                    (Scott Adams - The Dilbert principle)

                    /// 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
                    ... sorry, I don t know. on Athena version, vim crash if check it. ... I solved this problem with below s patch. but i set iminsert=0,imsearch=0,noimcmdline
                    Message 9 of 17 , Sep 26, 2001
                    • 0 Attachment
                      >Is there any way to find out what kind of XIM is being used?

                      sorry, I don't know.
                      on Athena version, vim crash if check it.

                      >I suppose doing something similar to version 5.8 is the best. Please
                      >check out the patches that I sent yesterday and tell me which solution
                      >works best for you. If you have a better idea, perhaps with checking
                      >for XNPreeditState, please show me your suggested patch.
                      >
                      >Please respond right away, Vim 6.0 is just around the corner...

                      I solved this problem with below's patch.
                      but i set iminsert=0,imsearch=0,noimcmdline when vim started.
                      This will not work if set iminsert=2,imsearch=2,imcmdline
                      and set iminsert=0,imsearch=0,noimcmdline again.
                      (this mean our XIM never use iminsert)

                      *** mbyte.c.org Fri Sep 21 14:09:23 2001
                      --- mbyte.c Wed Sep 26 10:52:41 2001
                      ***************
                      *** 2966,2972 ****
                      XPoint over_spot;
                      int line_space;

                      ! if (!xim_has_focus)
                      {
                      /* hide XIM cursor */
                      over_spot.x = 0;
                      --- 2966,2972 ----
                      XPoint over_spot;
                      int line_space;

                      ! if (!xim_has_focus && xim_is_active)
                      {
                      /* hide XIM cursor */
                      over_spot.x = 0;
                      --

                      and if you accept that vim back vim58 when xim don't support XNPreeditState,
                      please check below's patch.
                      the xim which japanese uses set xim_support_preeditstate to FALSE.
                      but i don't know how other xim set xim_support_preeditstate to TRUE.
                      Muraoka, can you check this?

                      *** mbyte.c.org Fri Sep 21 14:09:23 2001
                      --- mbyte.c Wed Sep 26 18:27:28 2001
                      ***************
                      *** 2596,2601 ****
                      --- 2596,2602 ----
                      static int xim_is_active = FALSE; /* XIM should be active in the current
                      mode */
                      static int xim_has_focus = FALSE; /* XIM is really being used for Vim */
                      + static int xim_support_preeditstate = FALSE;
                      #ifdef FEAT_GUI_X11
                      static XIMStyle input_style;
                      static int status_area_enabled = TRUE;
                      ***************
                      *** 2730,2735 ****
                      --- 2731,2739 ----
                      if (xic == NULL)
                      return;

                      + if (!xim_support_preeditstate)
                      + return;
                      +
                      if (p_imdisable)
                      active = FALSE;

                      ***************
                      *** 2825,2838 ****
                      void
                      xim_set_focus(int focus)
                      {
                      if (xic == NULL)
                      return;

                      /*
                      * XIM only gets focus when the Vim window has keyboard focus and XIM
                      has
                      * been set active for the current mode.
                      */
                      ! if (focus && xim_is_active)
                      {
                      if (!xim_has_focus)
                      {
                      --- 2829,2849 ----
                      void
                      xim_set_focus(int focus)
                      {
                      + int force = FALSE;
                      +
                      if (xic == NULL)
                      return;

                      + if (!xim_support_preeditstate)
                      + force = TRUE;
                      + else
                      + force = xim_is_active;
                      +
                      /*
                      * XIM only gets focus when the Vim window has keyboard focus and XIM
                      has
                      * been set active for the current mode.
                      */
                      ! if (focus && force)
                      {
                      if (!xim_has_focus)
                      {
                      ***************
                      *** 2966,2972 ****
                      XPoint over_spot;
                      int line_space;

                      ! if (!xim_has_focus)
                      {
                      /* hide XIM cursor */
                      over_spot.x = 0;
                      --- 2977,2983 ----
                      XPoint over_spot;
                      int line_space;

                      ! if (!xim_has_focus && xim_support_preeditstate)
                      {
                      /* hide XIM cursor */
                      over_spot.x = 0;
                      ***************
                      *** 3441,3446 ****
                      --- 3452,3469 ----
                      return FALSE;
                      }

                      + {
                      + XVaNestedList preedit_attr;
                      + XIMPreeditState preedit_state = XIMPreeditUnKnown;
                      + preedit_attr = (XVaNestedList) XVaCreateNestedList(0,
                      + XNPreeditState, &preedit_state, NULL);
                      + if (!XGetICValues(xic, XNPreeditAttributes, preedit_attr))
                      + xim_support_preeditstate = TRUE;
                      + else
                      + xim_support_preeditstate = FALSE;
                      + XFree(preedit_attr);
                      + }
                      +
                      return TRUE;
                      }

                      ***************
                      *** 3832,3838 ****
                      if (xim_input_style & (int)GDK_IM_PREEDIT_CALLBACKS)
                      return xim_preediting;
                      #endif
                      ! return xim_has_focus;
                      }

                      #endif /* FEAT_XIM */
                      --- 3855,3864 ----
                      if (xim_input_style & (int)GDK_IM_PREEDIT_CALLBACKS)
                      return xim_preediting;
                      #endif
                      ! if (xim_support_preeditstate)
                      ! return xim_has_focus;
                      ! else
                      ! return FALSE;
                      }

                      #endif /* FEAT_XIM */
                      --
                      Yasurhio


                      _________________________________________________________________
                      Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
                    • Bram Moolenaar
                      ... Thanks for replying quickly. ... No, this is taking us in the wrong direction. It seems you are using xim_is_active as if it s used to enable XIM when it
                      Message 10 of 17 , Sep 26, 2001
                      • 0 Attachment
                        Yasuhiro Matsumoto wrote:

                        > >Is there any way to find out what kind of XIM is being used?
                        >
                        > sorry, I don't know.
                        > on Athena version, vim crash if check it.

                        Thanks for replying quickly.

                        > >I suppose doing something similar to version 5.8 is the best. Please
                        > >check out the patches that I sent yesterday and tell me which solution
                        > >works best for you. If you have a better idea, perhaps with checking
                        > >for XNPreeditState, please show me your suggested patch.
                        > >
                        > >Please respond right away, Vim 6.0 is just around the corner...
                        >
                        > I solved this problem with below's patch.
                        > but i set iminsert=0,imsearch=0,noimcmdline when vim started.
                        > This will not work if set iminsert=2,imsearch=2,imcmdline
                        > and set iminsert=0,imsearch=0,noimcmdline again.
                        > (this mean our XIM never use iminsert)

                        No, this is taking us in the wrong direction. It seems you are using
                        xim_is_active as if it's used to enable XIM when it is FALSE. Your
                        change to have im_get_status() always return FALSE indicates this as
                        well. This not a useful solution, because it looks too much like it
                        will break for people in another situation.

                        I would prefer going in the direction of keeping XIM enabled at all
                        times. This means 'iminsert' is 2 and stays at 2 all the time.

                        > and if you accept that vim back vim58 when xim don't support XNPreeditState,
                        > please check below's patch.
                        > the xim which japanese uses set xim_support_preeditstate to FALSE.
                        > but i don't know how other xim set xim_support_preeditstate to TRUE.
                        > Muraoka, can you check this?
                        [...]
                        > 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?

                        --
                        Contrary to popular belief, it's often your clothing that gets promoted, not
                        you.
                        (Scott Adams - The Dilbert principle)

                        /// 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
                        ... 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
                        Message 11 of 17 , Sep 26, 2001
                        • 0 Attachment
                          >> 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().
                          --
                          Yasurhio



                          _________________________________________________________________
                          Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
                        • Yasuhiro Matsumoto
                          ... oops... sorry i could not understand because my poor englsh. ~~~ please explain more easy. do you say that we must not use force ? to back vim58, we must
                          Message 12 of 17 , Sep 26, 2001
                          • 0 Attachment
                            >> 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?

                            oops...

                            sorry i could not 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().
                            --
                            Yasurhio



                            _________________________________________________________________
                            Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
                          • 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 13 of 17 , Sep 26, 2001
                            • 0 Attachment
                              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 14 of 17 , Sep 26, 2001
                              • 0 Attachment
                                >>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 15 of 17 , Sep 26, 2001
                                • 0 Attachment
                                  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.