]> git.pld-linux.org Git - packages/vim.git/blob - 7.2.442
- new
[packages/vim.git] / 7.2.442
1 To: vim-dev@vim.org
2 Subject: Patch 7.2.442
3 Fcc: outbox
4 From: Bram Moolenaar <Bram@moolenaar.net>
5 Mime-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8 ------------
9
10 Patch 7.2.442 (after 7.2.201)
11 Problem:    Copy/paste with OpenOffice doesn't work.
12 Solution:   Do not offer the HTML target when it is not supported. (James
13             Vega)
14 Files:      src/gui_gtk_x11.c, src/option.c, src/proto/gui_gtk_x11.pro
15
16
17 *** ../vim-7.2.441/src/gui_gtk_x11.c    2010-02-11 18:19:32.000000000 +0100
18 --- src/gui_gtk_x11.c   2010-06-05 12:42:23.000000000 +0200
19 ***************
20 *** 1433,1438 ****
21 --- 1433,1442 ----
22       }
23   #endif /* !HAVE_GTK2 */
24   
25 +     /* Chop off any traiing NUL bytes.  OpenOffice sends these. */
26 +     while (len > 0 && text[len - 1] == NUL)
27 +       --len;
28
29       clip_yank_selection(motion_type, text, (long)len, cbd);
30       received_selection = RS_OK;
31       vim_free(tmpbuf);
32 ***************
33 *** 3463,3468 ****
34 --- 3467,3532 ----
35   #endif /* FEAT_GUI_TABLINE */
36   
37   /*
38 +  * Add selection targets for PRIMARY and CLIPBOARD selections.
39 +  */
40 +     void
41 + gui_gtk_set_selection_targets(void)
42 + {
43 +     int                   i, j = 0;
44 +     int                   n_targets = N_SELECTION_TARGETS;
45 +     GtkTargetEntry  targets[N_SELECTION_TARGETS];
46
47 +     for (i = 0; i < (int)N_SELECTION_TARGETS; ++i)
48 +     {
49 + #ifdef FEAT_MBYTE
50 +       /* OpenOffice tries to use TARGET_HTML and fails when it doesn't
51 +        * return something, instead of trying another target. Therefore only
52 +        * offer TARGET_HTML when it works. */
53 +       if (!clip_html && selection_targets[i].info == TARGET_HTML)
54 +           n_targets--;
55 +       else
56 + #endif
57 +           targets[j++] = selection_targets[i];
58 +     }
59
60 +     gtk_selection_clear_targets(gui.drawarea, (GdkAtom)GDK_SELECTION_PRIMARY);
61 +     gtk_selection_clear_targets(gui.drawarea, (GdkAtom)clip_plus.gtk_sel_atom);
62 +     gtk_selection_add_targets(gui.drawarea,
63 +                             (GdkAtom)GDK_SELECTION_PRIMARY,
64 +                             targets, n_targets);
65 +     gtk_selection_add_targets(gui.drawarea,
66 +                             (GdkAtom)clip_plus.gtk_sel_atom,
67 +                             targets, n_targets);
68 + }
69
70 + /*
71 +  * Set up for receiving DND items.
72 +  */
73 +     void
74 + gui_gtk_set_dnd_targets(void)
75 + {
76 +     int                   i, j = 0;
77 +     int                   n_targets = N_DND_TARGETS;
78 +     GtkTargetEntry  targets[N_DND_TARGETS];
79
80 +     for (i = 0; i < (int)N_DND_TARGETS; ++i)
81 +     {
82 + #ifdef FEAT_MBYTE
83 +       if (!clip_html && selection_targets[i].info == TARGET_HTML)
84 +           n_targets--;
85 +       else
86 + #endif
87 +           targets[j++] = dnd_targets[i];
88 +     }
89
90 +     gtk_drag_dest_unset(gui.drawarea);
91 +     gtk_drag_dest_set(gui.drawarea,
92 +                     GTK_DEST_DEFAULT_ALL,
93 +                     targets, n_targets,
94 +                     GDK_ACTION_COPY);
95 + }
96
97 + /*
98    * Initialize the GUI.        Create all the windows, set up all the callbacks etc.
99    * Returns OK for success, FAIL when the GUI can't be started.
100    */
101 ***************
102 *** 3925,3939 ****
103       gtk_signal_connect(GTK_OBJECT(gui.drawarea), "selection_received",
104                        GTK_SIGNAL_FUNC(selection_received_cb), NULL);
105   
106 !     /*
107 !      * Add selection targets for PRIMARY and CLIPBOARD selections.
108 !      */
109 !     gtk_selection_add_targets(gui.drawarea,
110 !                             (GdkAtom)GDK_SELECTION_PRIMARY,
111 !                             selection_targets, N_SELECTION_TARGETS);
112 !     gtk_selection_add_targets(gui.drawarea,
113 !                             (GdkAtom)clip_plus.gtk_sel_atom,
114 !                             selection_targets, N_SELECTION_TARGETS);
115   
116       gtk_signal_connect(GTK_OBJECT(gui.drawarea), "selection_get",
117                        GTK_SIGNAL_FUNC(selection_get_cb), NULL);
118 --- 3989,3995 ----
119       gtk_signal_connect(GTK_OBJECT(gui.drawarea), "selection_received",
120                        GTK_SIGNAL_FUNC(selection_received_cb), NULL);
121   
122 !     gui_gtk_set_selection_targets();
123   
124       gtk_signal_connect(GTK_OBJECT(gui.drawarea), "selection_get",
125                        GTK_SIGNAL_FUNC(selection_get_cb), NULL);
126 ***************
127 *** 4057,4063 ****
128       return TRUE;
129   }
130   
131
132   /*
133    * Open the GUI window which was created by a call to gui_mch_init().
134    */
135 --- 4113,4118 ----
136 ***************
137 *** 4225,4237 ****
138                        GTK_SIGNAL_FUNC(form_configure_event), NULL);
139   
140   #ifdef FEAT_DND
141 !     /*
142 !      * Set up for receiving DND items.
143 !      */
144 !     gtk_drag_dest_set(gui.drawarea,
145 !                     GTK_DEST_DEFAULT_ALL,
146 !                     dnd_targets, N_DND_TARGETS,
147 !                     GDK_ACTION_COPY);
148   
149       gtk_signal_connect(GTK_OBJECT(gui.drawarea), "drag_data_received",
150                        GTK_SIGNAL_FUNC(drag_data_received_cb), NULL);
151 --- 4280,4287 ----
152                        GTK_SIGNAL_FUNC(form_configure_event), NULL);
153   
154   #ifdef FEAT_DND
155 !     /* Set up for receiving DND items. */
156 !     gui_gtk_set_dnd_targets();
157   
158       gtk_signal_connect(GTK_OBJECT(gui.drawarea), "drag_data_received",
159                        GTK_SIGNAL_FUNC(drag_data_received_cb), NULL);
160 ***************
161 *** 4428,4434 ****
162       /* this will cause the proper resizement to happen too */
163       update_window_manager_hints(0, 0);
164   
165 ! #else  /* HAVE_GTK2 */
166       /* this will cause the proper resizement to happen too */
167       if (gtk_socket_id == 0)
168         update_window_manager_hints(0, 0);
169 --- 4478,4484 ----
170       /* this will cause the proper resizement to happen too */
171       update_window_manager_hints(0, 0);
172   
173 ! #else
174       /* this will cause the proper resizement to happen too */
175       if (gtk_socket_id == 0)
176         update_window_manager_hints(0, 0);
177 ***************
178 *** 4444,4457 ****
179       else
180         update_window_manager_hints(width, height);
181   
182 ! #if 0
183       if (!resize_idle_installed)
184       {
185         g_idle_add_full(GDK_PRIORITY_EVENTS + 10,
186                         &force_shell_resize_idle, NULL, NULL);
187         resize_idle_installed = TRUE;
188       }
189 ! #endif
190       /*
191        * Wait until all events are processed to prevent a crash because the
192        * real size of the drawing area doesn't reflect Vim's internal ideas.
193 --- 4494,4507 ----
194       else
195         update_window_manager_hints(width, height);
196   
197 ! # if 0
198       if (!resize_idle_installed)
199       {
200         g_idle_add_full(GDK_PRIORITY_EVENTS + 10,
201                         &force_shell_resize_idle, NULL, NULL);
202         resize_idle_installed = TRUE;
203       }
204 ! # endif
205       /*
206        * Wait until all events are processed to prevent a crash because the
207        * real size of the drawing area doesn't reflect Vim's internal ideas.
208 *** ../vim-7.2.441/src/option.c 2010-05-14 17:32:53.000000000 +0200
209 --- src/option.c        2010-06-05 12:19:38.000000000 +0200
210 ***************
211 *** 7112,7117 ****
212 --- 7112,7124 ----
213         clip_html = new_html;
214         vim_free(clip_exclude_prog);
215         clip_exclude_prog = new_exclude_prog;
216 + #ifdef FEAT_GUI_GTK
217 +       if (gui.in_use)
218 +       {
219 +           gui_gtk_set_selection_targets();
220 +           gui_gtk_set_dnd_targets();
221 +       }
222 + #endif
223       }
224       else
225         vim_free(new_exclude_prog);
226 *** ../vim-7.2.441/src/proto/gui_gtk_x11.pro    2009-09-23 18:14:13.000000000 +0200
227 --- src/proto/gui_gtk_x11.pro   2010-06-05 12:31:22.000000000 +0200
228 ***************
229 *** 9,14 ****
230 --- 9,16 ----
231   int gui_mch_showing_tabline __ARGS((void));
232   void gui_mch_update_tabline __ARGS((void));
233   void gui_mch_set_curtab __ARGS((int nr));
234 + void gui_gtk_set_selection_targets __ARGS((void));
235 + void gui_gtk_set_dnd_targets __ARGS((void));
236   int gui_mch_init __ARGS((void));
237   void gui_mch_forked __ARGS((void));
238   void gui_mch_new_colors __ARGS((void));
239 *** ../vim-7.2.441/src/version.c        2010-05-30 16:55:17.000000000 +0200
240 --- src/version.c       2010-06-05 12:48:01.000000000 +0200
241 ***************
242 *** 683,684 ****
243 --- 683,686 ----
244   {   /* Add new patch number below this line */
245 + /**/
246 +     442,
247   /**/
248
249 -- 
250 hundred-and-one symptoms of being an internet addict:
251 158. You get a tuner card so you can watch TV while surfing.
252
253  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
254 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
255 \\\        download, build and distribute -- http://www.A-A-P.org        ///
256  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
This page took 0.046212 seconds and 3 git commands to generate.