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

Re: Vim can't start preedit with some XIM on gtk2. [update]

Expand Messages
  • Yasuhiro Matsumoto
    ... Some XIM seems don t use im_synthesize_keypress(). Thus, xim_reset shouldn t used it. This patch work fine on my environment. Thanks. ... ***************
    Message 1 of 6 , Apr 24, 2003
    • 0 Attachment
      >Vim can't start preedit with some XIM on gtk2.
      >I use kinput2 version 3.0
      >
      >I notice that gtk2's behavior is not same as gtk's one.
      >following patch make the same as gtk's behavior.
      >(if imactivatekey is not set, the behaviror depend on XIM serevr)
      >
      >on my environment, it seems ok to me.
      >Bram, please check and include.

      Some XIM seems don't use im_synthesize_keypress().
      Thus, xim_reset shouldn't used it.
      This patch work fine on my environment.

      Thanks.

      *** src/mbyte.c~ Tue Apr 22 00:25:21 2003
      --- src/mbyte.c Thu Apr 24 18:39:45 2003
      ***************
      *** 2968,2973 ****
      --- 2968,2991 ----
      }

      /*
      + * Callback invoked after start to the preedit.
      + */
      + static void
      + im_preedit_start_cb(GtkIMContext *context, gpointer data)
      + {
      + im_is_active = TRUE;
      + }
      +
      + /*
      + * Callback invoked after end to the preedit.
      + */
      + static void
      + im_preedit_end_cb(GtkIMContext *context, gpointer data)
      + {
      + im_is_active = FALSE;
      + }
      +
      + /*
      * Callback invoked after changes to the preedit string. If the preedit
      * string was empty before, remember the preedit start column so we know
      * where to apply feedback attributes. Delete the previous preedit string
      ***************
      *** 3180,3185 ****
      --- 3198,3207 ----
      G_CALLBACK(&im_commit_cb), NULL);
      g_signal_connect(G_OBJECT(xic), "preedit_changed",
      G_CALLBACK(&im_preedit_changed_cb), NULL);
      + g_signal_connect(G_OBJECT(xic), "preedit_start",
      + G_CALLBACK(&im_preedit_start_cb), NULL);
      + g_signal_connect(G_OBJECT(xic), "preedit_end",
      + G_CALLBACK(&im_preedit_end_cb), NULL);

      gtk_im_context_set_client_window(xic, gui.drawarea->window);
      }
      ***************
      *** 3319,3325 ****
      * every mode switch, which causes a quite noticable delay even on
      * my rather fast box...
      */
      ! im_synthesize_keypress(GDK_Escape, 0U);

      gtk_im_context_reset(xic);
      /*
      --- 3341,3347 ----
      * every mode switch, which causes a quite noticable delay even on
      * my rather fast box...
      */
      ! add_to_input_buf(ESC_STR, strlen(ESC_STR));

      gtk_im_context_reset(xic);
      /*
      ***************
      *** 3338,3343 ****
      --- 3360,3370 ----
      im_synthesize_keypress(im_activatekey_keyval, im_activatekey_state);
      g_signal_handler_unblock(xic, im_commit_handler_id);
      }
      + else
      + {
      + im_shutdown();
      + xim_init();
      + }
      }

      preedit_start_col = MAXCOL;
      ***************
      *** 3384,3390 ****
      /* Don't filter events through the IM context if IM isn't active
      * right now. Unlike with GTK+ 1.2 we cannot rely on the IM module
      * not doing anything before the activation key was sent. */
      ! if (im_is_active)
      return gtk_im_context_filter_keypress(xic, event);
      }

      --- 3411,3417 ----
      /* Don't filter events through the IM context if IM isn't active
      * right now. Unlike with GTK+ 1.2 we cannot rely on the IM module
      * not doing anything before the activation key was sent. */
      ! if (im_activatekey_keyval == GDK_VoidSymbol || im_is_active)
      return gtk_im_context_filter_keypress(xic, event);
      }

      --

      - Yasuhiro



      _________________________________________________________________
      Add photos to your e-mail with MSN 8. Get 2 months FREE*.
      http://join.msn.com/?page=features/featuredemail
    • Bram Moolenaar
      ... OK. But perhaps the comment that explains why im_synthesize_keypress() was used needs to be changed now? -- CVS sux, men don t like commitment /// Bram
      Message 2 of 6 , Apr 24, 2003
      • 0 Attachment
        Yasuhiro Matsumoto wrote:

        > >Vim can't start preedit with some XIM on gtk2.
        > >I use kinput2 version 3.0
        > >
        > >I notice that gtk2's behavior is not same as gtk's one.
        > >following patch make the same as gtk's behavior.
        > >(if imactivatekey is not set, the behaviror depend on XIM serevr)
        > >
        > >on my environment, it seems ok to me.
        > >Bram, please check and include.
        >
        > Some XIM seems don't use im_synthesize_keypress().
        > Thus, xim_reset shouldn't used it.
        > This patch work fine on my environment.

        OK. But perhaps the comment that explains why im_synthesize_keypress()
        was used needs to be changed now?

        --
        CVS sux, men don't like commitment

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
        \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
        \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///
      • Yasuhiro Matsumoto
        ... ok, and I had mistake. (I called useless add_to_input_buf().) I changed the comment. Thanks. ... *************** ... } /* + * Callback invoked after start
        Message 3 of 6 , Apr 24, 2003
        • 0 Attachment
          >> >Vim can't start preedit with some XIM on gtk2.
          >> >I use kinput2 version 3.0
          >> >
          >> >I notice that gtk2's behavior is not same as gtk's one.
          >> >following patch make the same as gtk's behavior.
          >> >(if imactivatekey is not set, the behaviror depend on XIM serevr)
          >> >
          >> >on my environment, it seems ok to me.
          >> >Bram, please check and include.
          >>
          >>Some XIM seems don't use im_synthesize_keypress().
          >>Thus, xim_reset shouldn't used it.
          >>This patch work fine on my environment.
          >
          >OK. But perhaps the comment that explains why im_synthesize_keypress()
          >was used needs to be changed now?

          ok, and I had mistake.
          (I called useless add_to_input_buf().)
          I changed the comment.

          Thanks.

          *** src/mbyte.c~ Tue Apr 22 00:25:21 2003
          --- src/mbyte.c Thu Apr 24 19:44:44 2003
          ***************
          *** 2968,2973 ****
          --- 2968,2991 ----
          }

          /*
          + * Callback invoked after start to the preedit.
          + */
          + static void
          + im_preedit_start_cb(GtkIMContext *context, gpointer data)
          + {
          + im_is_active = TRUE;
          + }
          +
          + /*
          + * Callback invoked after end to the preedit.
          + */
          + static void
          + im_preedit_end_cb(GtkIMContext *context, gpointer data)
          + {
          + im_is_active = FALSE;
          + }
          +
          + /*
          * Callback invoked after changes to the preedit string. If the preedit
          * string was empty before, remember the preedit start column so we know
          * where to apply feedback attributes. Delete the previous preedit string
          ***************
          *** 3180,3185 ****
          --- 3198,3207 ----
          G_CALLBACK(&im_commit_cb), NULL);
          g_signal_connect(G_OBJECT(xic), "preedit_changed",
          G_CALLBACK(&im_preedit_changed_cb), NULL);
          + g_signal_connect(G_OBJECT(xic), "preedit_start",
          + G_CALLBACK(&im_preedit_start_cb), NULL);
          + g_signal_connect(G_OBJECT(xic), "preedit_end",
          + G_CALLBACK(&im_preedit_end_cb), NULL);

          gtk_im_context_set_client_window(xic, gui.drawarea->window);
          }
          ***************
          *** 3318,3325 ****
          * recreate it. But that means loading/unloading the IM module on
          * every mode switch, which causes a quite noticable delay even on
          * my rather fast box...
          */
          ! im_synthesize_keypress(GDK_Escape, 0U);

          gtk_im_context_reset(xic);
          /*
          --- 3340,3352 ----
          * recreate it. But that means loading/unloading the IM module on
          * every mode switch, which causes a quite noticable delay even on
          * my rather fast box...
          + *
          + * Moreover, there are some XIM which cannot respond to
          + * im_synthesize_keypress(). we hope that they reset by
          + * xim_shutdown().
          */
          ! if (im_activatekey_keyval != GDK_VoidSymbol && im_is_active)
          ! im_synthesize_keypress(GDK_Escape, 0U);

          gtk_im_context_reset(xic);
          /*
          ***************
          *** 3338,3343 ****
          --- 3365,3375 ----
          im_synthesize_keypress(im_activatekey_keyval, im_activatekey_state);
          g_signal_handler_unblock(xic, im_commit_handler_id);
          }
          + else
          + {
          + im_shutdown();
          + xim_init();
          + }
          }

          preedit_start_col = MAXCOL;
          ***************
          *** 3384,3390 ****
          /* Don't filter events through the IM context if IM isn't active
          * right now. Unlike with GTK+ 1.2 we cannot rely on the IM module
          * not doing anything before the activation key was sent. */
          ! if (im_is_active)
          return gtk_im_context_filter_keypress(xic, event);
          }

          --- 3416,3422 ----
          /* Don't filter events through the IM context if IM isn't active
          * right now. Unlike with GTK+ 1.2 we cannot rely on the IM module
          * not doing anything before the activation key was sent. */
          ! if (im_activatekey_keyval == GDK_VoidSymbol || im_is_active)
          return gtk_im_context_filter_keypress(xic, event);
          }

          --

          - Yasuhiro


          _________________________________________________________________
          Add photos to your messages with MSN 8. Get 2 months FREE*.
          http://join.msn.com/?page=features/featuredemail
        • Bram Moolenaar
          ... Thanks, I ll include this version of the patch. -- hundred-and-one symptoms of being an internet addict: 51. You put a pillow case over your laptop so your
          Message 4 of 6 , Apr 24, 2003
          • 0 Attachment
            Yasuhiro Matsumoto wrote:

            > >> >Vim can't start preedit with some XIM on gtk2.
            > >> >I use kinput2 version 3.0
            > >> >
            > >> >I notice that gtk2's behavior is not same as gtk's one.
            > >> >following patch make the same as gtk's behavior.
            > >> >(if imactivatekey is not set, the behaviror depend on XIM serevr)
            > >> >
            > >> >on my environment, it seems ok to me.
            > >> >Bram, please check and include.
            > >>
            > >>Some XIM seems don't use im_synthesize_keypress().
            > >>Thus, xim_reset shouldn't used it.
            > >>This patch work fine on my environment.
            > >
            > >OK. But perhaps the comment that explains why im_synthesize_keypress()
            > >was used needs to be changed now?
            >
            > ok, and I had mistake.
            > (I called useless add_to_input_buf().)
            > I changed the comment.

            Thanks, I'll include this version of the patch.

            --
            hundred-and-one symptoms of being an internet addict:
            51. You put a pillow case over your laptop so your lover doesn't see it while
            you are pretending to catch your breath.

            /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
            /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
            \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
            \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///
          • Yasuhiro Matsumoto
            The code can t re-start preediting with ATOK(japanese XIM). Following are newet. namsh, The problem is happen from before? or my patch? and try to set
            Message 5 of 6 , Apr 24, 2003
            • 0 Attachment
              The code can't re-start preediting with ATOK(japanese XIM).
              Following are newet.

              namsh, The problem is happen from before?
              or my patch?
              and try to set imactivatekey empty.

              Thanks.

              *** src/mbyte.c~ Tue Apr 22 00:25:21 2003
              --- src/mbyte.c Fri Apr 25 09:27:33 2003
              ***************
              *** 2968,2973 ****
              --- 2968,2991 ----
              }

              /*
              + * Callback invoked after start to the preedit.
              + */
              + static void
              + im_preedit_start_cb(GtkIMContext *context, gpointer data)
              + {
              + im_is_active = TRUE;
              + }
              +
              + /*
              + * Callback invoked after end to the preedit.
              + */
              + static void
              + im_preedit_end_cb(GtkIMContext *context, gpointer data)
              + {
              + im_is_active = FALSE;
              + }
              +
              + /*
              * Callback invoked after changes to the preedit string. If the preedit
              * string was empty before, remember the preedit start column so we know
              * where to apply feedback attributes. Delete the previous preedit string
              ***************
              *** 3180,3185 ****
              --- 3198,3207 ----
              G_CALLBACK(&im_commit_cb), NULL);
              g_signal_connect(G_OBJECT(xic), "preedit_changed",
              G_CALLBACK(&im_preedit_changed_cb), NULL);
              + g_signal_connect(G_OBJECT(xic), "preedit_start",
              + G_CALLBACK(&im_preedit_start_cb), NULL);
              + g_signal_connect(G_OBJECT(xic), "preedit_end",
              + G_CALLBACK(&im_preedit_end_cb), NULL);

              gtk_im_context_set_client_window(xic, gui.drawarea->window);
              }
              ***************
              *** 3318,3325 ****
              * recreate it. But that means loading/unloading the IM module on
              * every mode switch, which causes a quite noticable delay even on
              * my rather fast box...
              */
              ! im_synthesize_keypress(GDK_Escape, 0U);

              gtk_im_context_reset(xic);
              /*
              --- 3340,3352 ----
              * recreate it. But that means loading/unloading the IM module on
              * every mode switch, which causes a quite noticable delay even on
              * my rather fast box...
              + *
              + * Moreover, there are some XIM which cannot respond to
              + * im_synthesize_keypress(). we hope that they reset by
              + * xim_shutdown().
              */
              ! if (im_activatekey_keyval != GDK_VoidSymbol && im_is_active)
              ! im_synthesize_keypress(GDK_Escape, 0U);

              gtk_im_context_reset(xic);
              /*
              ***************
              *** 3338,3343 ****
              --- 3365,3376 ----
              im_synthesize_keypress(im_activatekey_keyval, im_activatekey_state);
              g_signal_handler_unblock(xic, im_commit_handler_id);
              }
              + else
              + {
              + im_shutdown();
              + xim_init();
              + xim_set_focus(gui.in_focus);
              + }
              }

              preedit_start_col = MAXCOL;
              ***************
              *** 3384,3390 ****
              /* Don't filter events through the IM context if IM isn't active
              * right now. Unlike with GTK+ 1.2 we cannot rely on the IM module
              * not doing anything before the activation key was sent. */
              ! if (im_is_active)
              return gtk_im_context_filter_keypress(xic, event);
              }

              --- 3417,3423 ----
              /* Don't filter events through the IM context if IM isn't active
              * right now. Unlike with GTK+ 1.2 we cannot rely on the IM module
              * not doing anything before the activation key was sent. */
              ! if (im_activatekey_keyval == GDK_VoidSymbol || im_is_active)
              return gtk_im_context_filter_keypress(xic, event);
              }

              --

              - Yasuhiro


              _________________________________________________________________
              Add photos to your messages with MSN 8. Get 2 months FREE*.
              http://join.msn.com/?page=features/featuredemail
            • Nam SungHyun
              ... I just tested your 2nd(?) patch. And the 2nd and newest patch worked fine. Regards, namsh
              Message 6 of 6 , Apr 24, 2003
              • 0 Attachment
                On Fri, 25 Apr 2003 09:52:22 +0900, Yasuhiro Matsumoto wrote:
                > The code can't re-start preediting with ATOK(japanese XIM).

                I just tested your 2nd(?) patch.
                And the 2nd and newest patch worked fine.

                Regards,
                namsh
              Your message has been successfully submitted and would be delivered to recipients shortly.