]> git.pld-linux.org Git - packages/vim.git/blob - 6.2.343
- updated to 6.2.430
[packages/vim.git] / 6.2.343
1 To: vim-dev@vim.org
2 Subject: Patch 6.2.343
3 Fcc: outbox
4 From: Bram Moolenaar <Bram@moolenaar.net>
5 Mime-Version: 1.0
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
8 ------------
9
10 Patch 6.2.343
11 Problem:    Title doesn't work with some window managers.  X11: Setting the
12             text property for the window title is hard coded.
13 Solution:   Use STRING format when possible.  Use the UTF-8 function when
14             it's available and 'encoding' is utf-8. Use
15             XStringListToTextProperty().  Do the same for the icon name.
16             (David Harrison)
17 Files:      src/os_unix.c
18
19
20 *** ../vim-6.2.342/src/os_unix.c        Fri Mar  5 15:21:09 2004
21 --- src/os_unix.c       Thu Mar 11 20:54:54 2004
22 ***************
23 *** 1607,1612 ****
24 --- 1607,1619 ----
25       return retval;
26   }
27   
28 + /* Are Xutf8 functions available?  Avoid error from old compilers. */
29 + #if defined(X_HAVE_UTF8_STRING) && defined(FEAT_MBYTE)
30 + # if X_HAVE_UTF8_STRING
31 + #  define USE_UTF8_STRING
32 + # endif
33 + #endif
34
35   /*
36    * Set x11 Window Title
37    *
38 ***************
39 *** 1616,1646 ****
40   set_x11_title(title)
41       char_u    *title;
42   {
43   #if XtSpecificationRelease >= 4
44 -     XTextProperty     text_prop;
45   # ifdef FEAT_XFONTSET
46 !     Status            status;
47   
48 !     status = XmbTextListToTextProperty(x11_display, (char **)&title, 1,
49 !                                             XCompoundTextStyle, &text_prop);
50 !     /* Status is a positive number when some chars could not be converted.
51 !      * Accept that, we don't know what to do otherwise. */
52 !     if (status < Success)
53 ! # endif
54 !     {
55 !       text_prop.value = title;
56 !       text_prop.nitems = STRLEN(title);
57 !       text_prop.encoding = XA_STRING;
58 !       text_prop.format = 8;
59 !     }
60 !     XSetWMName(x11_display, x11_window, &text_prop);
61 ! # ifdef FEAT_XFONTSET
62 !     if (status >= Success)
63 !       XFree((void *)text_prop.value);
64   # endif
65   #else
66 !     XStoreName(x11_display, x11_window, (char *)title);
67   #endif
68       XFlush(x11_display);
69   }
70   
71 --- 1623,1655 ----
72   set_x11_title(title)
73       char_u    *title;
74   {
75 +       /* XmbSetWMProperties() and Xutf8SetWMProperties() should use a STRING
76 +        * when possible, COMPOUND_TEXT otherwise.  COMPOUND_TEXT isn't
77 +        * supported everywhere and STRING doesn't work for multi-byte titles.
78 +        */
79 + #ifdef USE_UTF8_STRING
80 +     if (enc_utf8)
81 +       Xutf8SetWMProperties(x11_display, x11_window, (const char *)title,
82 +                                            NULL, NULL, 0, NULL, NULL, NULL);
83 +     else
84 + #endif
85 +     {
86   #if XtSpecificationRelease >= 4
87   # ifdef FEAT_XFONTSET
88 !       XmbSetWMProperties(x11_display, x11_window, (const char *)title,
89 !                                            NULL, NULL, 0, NULL, NULL, NULL);
90 ! # else
91 !       XTextProperty   text_prop;
92   
93 !       /* directly from example 3-18 "basicwin" of Xlib Programming Manual */
94 !       (void)XStringListToTextProperty((char **)&title, 1, &text_prop);
95 !       XSetWMProperties(x11_display, x11_window, &text_prop,
96 !                                            NULL, NULL, 0, NULL, NULL, NULL);
97   # endif
98   #else
99 !       XStoreName(x11_display, x11_window, (char *)title);
100   #endif
101 +     }
102       XFlush(x11_display);
103   }
104   
105 ***************
106 *** 1653,1683 ****
107   set_x11_icon(icon)
108       char_u    *icon;
109   {
110   #if XtSpecificationRelease >= 4
111 -     XTextProperty     text_prop;
112   # ifdef FEAT_XFONTSET
113 !     Status            status;
114   
115 !     status = XmbTextListToTextProperty(x11_display, (char **)&icon, 1,
116 !                                             XCompoundTextStyle, &text_prop);
117 !     /* Status is a positive number when some chars could not be converted.
118 !      * Accept that, we don't know what to do otherwise. */
119 !     if (status < Success)
120 ! # endif
121 !     {
122 !       text_prop.value = icon;
123 !       text_prop.nitems = STRLEN(icon);
124 !       text_prop.encoding = XA_STRING;
125 !       text_prop.format = 8;
126 !     }
127 !     XSetWMIconName(x11_display, x11_window, &text_prop);
128 ! # ifdef FEAT_XFONTSET
129 !     if (status >= Success)
130 !       XFree((void *)text_prop.value);
131   # endif
132   #else
133 !     XSetIconName(x11_display, x11_window, (char *)icon);
134   #endif
135       XFlush(x11_display);
136   }
137   
138 --- 1662,1690 ----
139   set_x11_icon(icon)
140       char_u    *icon;
141   {
142 +     /* See above for comments about using X*SetWMProperties(). */
143 + #ifdef USE_UTF8_STRING
144 +     if (enc_utf8)
145 +       Xutf8SetWMProperties(x11_display, x11_window, NULL, (const char *)icon,
146 +                                                  NULL, 0, NULL, NULL, NULL);
147 +     else
148 + #endif
149 +     {
150   #if XtSpecificationRelease >= 4
151   # ifdef FEAT_XFONTSET
152 !       XmbSetWMProperties(x11_display, x11_window, NULL, (const char *)icon,
153 !                                                  NULL, 0, NULL, NULL, NULL);
154 ! # else
155 !       XTextProperty   text_prop;
156   
157 !       (void)XStringListToTextProperty((char **)&icon, 1, &text_prop);
158 !       XSetWMProperties(x11_display, x11_window, NULL, &text_prop,
159 !                                                  NULL, 0, NULL, NULL, NULL);
160   # endif
161   #else
162 !       XSetIconName(x11_display, x11_window, (char *)icon);
163   #endif
164 +     }
165       XFlush(x11_display);
166   }
167   
168 *** ../vim-6.2.342/src/version.c        Thu Mar 11 20:49:02 2004
169 --- src/version.c       Thu Mar 11 20:50:31 2004
170 ***************
171 *** 639,640 ****
172 --- 639,642 ----
173   {   /* Add new patch number below this line */
174 + /**/
175 +     343,
176   /**/
177
178 -- 
179 hundred-and-one symptoms of being an internet addict:
180 6. You refuse to go to a vacation spot with no electricity and no phone lines.
181
182  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
183 ///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
184 \\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
185  \\\  Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
This page took 0.04101 seconds and 3 git commands to generate.