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

Re: Japanese titlestring patch

Expand Messages
  • Kentaro Nakazawa
    This is the patch which solves the problem of a Japanese titlestring and icon string. This problem occurs by redhat8 and 9. Index: os_unix.c
    Message 1 of 9 , Apr 12, 2003
      This is the patch which solves the problem of a Japanese titlestring
      and icon string.
      This problem occurs by redhat8 and 9.


      Index: os_unix.c
      ===================================================================
      RCS file: /cvsroot/vim/vim/src/os_unix.c,v
      retrieving revision 1.77
      diff -r1.77 os_unix.c
      1551a1552,1556
      > #ifdef FEAT_MBYTE
      > char *text[1] = { title };
      > XmbTextListToTextProperty(x11_display, text, 1,
      > XCompoundTextStyle, &text_prop);
      > #else
      1555a1561
      > #endif
      1574a1581,1585
      > #ifdef FEAT_MBYTE
      > char *text[1] = { icon };
      > XmbTextListToTextProperty(x11_display, text, 1,
      > XCompoundTextStyle, &text_prop);
      > #else
      1578a1590
      > #endif


      ---
      Kentaro Nakazawa <kentaro@...>
    • Bram Moolenaar
      ... Can you please send me a context diff? I can t see exactly where this fits. I suspect setting the icon text would have to be done in the same way. Ah, it
      Message 2 of 9 , Apr 13, 2003
        Kentaro Nakazawa wrote:

        > This is the patch which solves the problem of a Japanese titlestring.
        > This problem occurs by redhat8 and 9.
        >
        >
        > Index: os_unix.c
        > ===================================================================
        > RCS file: /cvsroot/vim/vim/src/os_unix.c,v
        > retrieving revision 1.77
        > diff -r1.77 os_unix.c
        > 1551a1552,1556
        > > #ifdef FEAT_MBYTE
        > > char *text[1] = { title };
        > > XmbTextListToTextProperty(x11_display, text, 1,
        > > XCompoundTextStyle, &text_prop);
        > > #else
        > 1555a1561
        > > #endif

        Can you please send me a context diff? I can't see exactly where this
        fits.

        I suspect setting the icon text would have to be done in the same way.
        Ah, it appears your second message does this.

        Is XmbTextListToTextProperty() always available, or was it added after a
        certain X version?

        --
        FIRST SOLDIER: So they wouldn't be able to bring a coconut back anyway.
        SECOND SOLDIER: Wait a minute! Suppose two swallows carried it together?
        FIRST SOLDIER: No, they'd have to have it on a line.
        "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

        /// 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 ///
      • Kentaro Nakazawa
        ... It seems that XmbTextListToTextProperty() can be used from X11R5 and it is already used in ui.c os_unix.c(XmbTextPropertyToTextList). Index: os_unix.c
        Message 3 of 9 , Apr 13, 2003
          Bram Moolenaar wrote:
          > Is XmbTextListToTextProperty() always available, or was it added after a
          > certain X version?

          It seems that XmbTextListToTextProperty() can be used from X11R5
          and it is already used in ui.c os_unix.c(XmbTextPropertyToTextList).

          Index: os_unix.c
          ===================================================================
          RCS file: /cvsroot/vim/vim/src/os_unix.c,v
          retrieving revision 1.77
          diff -c -r1.77 os_unix.c
          *** os_unix.c 31 Mar 2003 23:59:27 -0000 1.77
          --- os_unix.c 13 Apr 2003 15:40:16 -0000
          ***************
          *** 1549,1558 ****
          --- 1549,1564 ----
          #if XtSpecificationRelease >= 4
          XTextProperty text_prop;

          + # ifdef FEAT_XFONTSET
          + char *text[1] = { title };
          + XmbTextListToTextProperty(x11_display, text, 1,
          + XCompoundTextStyle, &text_prop);
          + # else
          text_prop.value = title;
          text_prop.nitems = STRLEN(title);
          text_prop.encoding = XA_STRING;
          text_prop.format = 8;
          + # endif
          XSetWMName(x11_display, x11_window, &text_prop);
          #else
          XStoreName(x11_display, x11_window, (char *)title);
          ***************
          *** 1572,1581 ****
          --- 1578,1593 ----
          #if XtSpecificationRelease >= 4
          XTextProperty text_prop;

          + # ifdef FEAT_XFONTSET
          + char *text[1] = { icon };
          + XmbTextListToTextProperty(x11_display, text, 1,
          + XCompoundTextStyle, &text_prop);
          + # else
          text_prop.value = icon;
          text_prop.nitems = STRLEN(icon);
          text_prop.encoding = XA_STRING;
          text_prop.format = 8;
          + # endif
          XSetWMIconName(x11_display, x11_window, &text_prop);
          #else
          XSetIconName(x11_display, x11_window, (char *)icon);


          ---
          Kentaro Nakazawa <kentaro@...>
        • Bram Moolenaar
          ... OK, I ll assume this works for everyone. Thanks for making this patch! -- BODY: I m not dead! CART DRIVER: Ere. He says he s not dead. LARGE MAN:
          Message 4 of 9 , Apr 13, 2003
            Kentaro Nakazawa wrote:

            > Bram Moolenaar wrote:
            > > Is XmbTextListToTextProperty() always available, or was it added after a
            > > certain X version?
            >
            > It seems that XmbTextListToTextProperty() can be used from X11R5
            > and it is already used in ui.c os_unix.c(XmbTextPropertyToTextList).

            OK, I'll assume this works for everyone. Thanks for making this patch!

            --
            BODY: I'm not dead!
            CART DRIVER: 'Ere. He says he's not dead.
            LARGE MAN: Yes he is.
            BODY: I'm not!
            "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

            /// 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 ///
          • Motonobu Ichimura
            Hi. I think when we use XmbTextListToTextProperty, text_prop.value is newly allocated, so it needs to be XFree d after using it.
            Message 5 of 9 , Apr 13, 2003
              Hi.
              I think when we use XmbTextListToTextProperty, text_prop.value is
              newly allocated, so it needs to be XFree'd after using it.

              > Index: os_unix.c
              > ===================================================================
              > RCS file: /cvsroot/vim/vim/src/os_unix.c,v
              > retrieving revision 1.77
              > diff -c -r1.77 os_unix.c
              > *** os_unix.c 31 Mar 2003 23:59:27 -0000 1.77
              > --- os_unix.c 13 Apr 2003 15:40:16 -0000
              > ***************
              > *** 1549,1558 ****
              > --- 1549,1564 ----
              > #if XtSpecificationRelease >= 4
              > XTextProperty text_prop;
              >
              > + # ifdef FEAT_XFONTSET
              > + char *text[1] = { title };
              > + XmbTextListToTextProperty(x11_display, text, 1,
              > + XCompoundTextStyle, &text_prop);
              > + # else
              > text_prop.value = title;
              > text_prop.nitems = STRLEN(title);
              > text_prop.encoding = XA_STRING;
              > text_prop.format = 8;
              > + # endif
              > XSetWMName(x11_display, x11_window, &text_prop);
              > #else
              > XStoreName(x11_display, x11_window, (char *)title);
              > ***************
              > *** 1572,1581 ****
              > --- 1578,1593 ----
              > #if XtSpecificationRelease >= 4
              > XTextProperty text_prop;
              >
              > + # ifdef FEAT_XFONTSET
              > + char *text[1] = { icon };
              > + XmbTextListToTextProperty(x11_display, text, 1,
              > + XCompoundTextStyle, &text_prop);
              > + # else
              > text_prop.value = icon;
              > text_prop.nitems = STRLEN(icon);
              > text_prop.encoding = XA_STRING;
              > text_prop.format = 8;
              > + # endif
              > XSetWMIconName(x11_display, x11_window, &text_prop);

              > #else
              > XSetIconName(x11_display, x11_window, (char *)icon);
              >
              >
              > ---
              > Kentaro Nakazawa <kentaro@...>
            • Bram Moolenaar
              ... The manual page is a bit unclear on this point, but it certainly looks like the text_prop.value needs to be freed afterwards. -- BLACK KNIGHT: None shall
              Message 6 of 9 , Apr 14, 2003
                Motonobu Ichimura wrote:

                > I think when we use XmbTextListToTextProperty, text_prop.value is
                > newly allocated, so it needs to be XFree'd after using it.

                The manual page is a bit unclear on this point, but it certainly looks
                like the text_prop.value needs to be freed afterwards.

                --
                BLACK KNIGHT: None shall pass.
                ARTHUR: I have no quarrel with you, brave Sir knight, but I must cross
                this bridge.
                BLACK KNIGHT: Then you shall die.
                "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

                /// 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 ///
              • Kentaro Nakazawa
                The check of memory release and a return value was added and corrected. Index: os_unix.c ===================================================================
                Message 7 of 9 , Apr 14, 2003
                  The check of memory release and a return value was added and corrected.



                  Index: os_unix.c
                  ===================================================================
                  RCS file: /cvsroot/vim/vim/src/os_unix.c,v
                  retrieving revision 1.77
                  diff -c -r1.77 os_unix.c
                  *** os_unix.c 31 Mar 2003 23:59:27 -0000 1.77
                  --- os_unix.c 14 Apr 2003 11:50:43 -0000
                  ***************
                  *** 1549,1559 ****
                  --- 1549,1579 ----
                  #if XtSpecificationRelease >= 4
                  XTextProperty text_prop;

                  + # ifdef FEAT_XFONTSET
                  + Status status;
                  +
                  + status = XmbTextListToTextProperty(x11_display,
                  + (char **)&title, 1, XCompoundTextStyle, &text_prop);
                  + if (status >= Success)
                  + {
                  + XSetWMName(x11_display, x11_window, &text_prop);
                  + XFree(text_prop.value);
                  + }
                  + else
                  + {
                  + text_prop.value = title;
                  + text_prop.nitems = STRLEN(title);
                  + text_prop.encoding = XA_STRING;
                  + text_prop.format = 8;
                  + XSetWMName(x11_display, x11_window, &text_prop);
                  + }
                  + # else
                  text_prop.value = title;
                  text_prop.nitems = STRLEN(title);
                  text_prop.encoding = XA_STRING;
                  text_prop.format = 8;
                  XSetWMName(x11_display, x11_window, &text_prop);
                  + # endif
                  #else
                  XStoreName(x11_display, x11_window, (char *)title);
                  #endif
                  ***************
                  *** 1572,1582 ****
                  --- 1592,1622 ----
                  #if XtSpecificationRelease >= 4
                  XTextProperty text_prop;

                  + # ifdef FEAT_XFONTSET
                  + Status status;
                  +
                  + status = XmbTextListToTextProperty(x11_display,
                  + (char **)&icon, 1, XCompoundTextStyle, &text_prop);
                  + if (status >= Success)
                  + {
                  + XSetWMIconName(x11_display, x11_window, &text_prop);
                  + XFree(text_prop.value);
                  + }
                  + else
                  + {
                  + text_prop.value = icon;
                  + text_prop.nitems = STRLEN(icon);
                  + text_prop.encoding = XA_STRING;
                  + text_prop.format = 8;
                  + XSetWMIconName(x11_display, x11_window, &text_prop);
                  + }
                  + # else
                  text_prop.value = icon;
                  text_prop.nitems = STRLEN(icon);
                  text_prop.encoding = XA_STRING;
                  text_prop.format = 8;
                  XSetWMIconName(x11_display, x11_window, &text_prop);
                  + # endif
                  #else
                  XSetIconName(x11_display, x11_window, (char *)icon);
                  #endif



                  ---
                  Kentaro Nakazawa <kentaro@...>
                • Bram Moolenaar
                  ... Thanks for updating the patch. -- Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald Knuth /// Bram Moolenaar --
                  Message 8 of 9 , Apr 14, 2003
                    Kentaro Nakazawa wrote:

                    > The check of memory release and a return value was added and corrected.

                    Thanks for updating the patch.

                    --
                    "Beware of bugs in the above code; I have only proved
                    it correct, not tried it." -- Donald Knuth

                    /// 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 ///
                  Your message has been successfully submitted and would be delivered to recipients shortly.