4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
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
14 Files: src/gui_gtk_x11.c, src/option.c, src/proto/gui_gtk_x11.pro
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
23 #endif /* !HAVE_GTK2 */
25 + /* Chop off any traiing NUL bytes. OpenOffice sends these. */
26 + while (len > 0 && text[len - 1] == NUL)
29 clip_yank_selection(motion_type, text, (long)len, cbd);
30 received_selection = RS_OK;
35 #endif /* FEAT_GUI_TABLINE */
38 + * Add selection targets for PRIMARY and CLIPBOARD selections.
41 + gui_gtk_set_selection_targets(void)
44 + int n_targets = N_SELECTION_TARGETS;
45 + GtkTargetEntry targets[N_SELECTION_TARGETS];
47 + for (i = 0; i < (int)N_SELECTION_TARGETS; ++i)
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)
57 + targets[j++] = selection_targets[i];
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);
71 + * Set up for receiving DND items.
74 + gui_gtk_set_dnd_targets(void)
77 + int n_targets = N_DND_TARGETS;
78 + GtkTargetEntry targets[N_DND_TARGETS];
80 + for (i = 0; i < (int)N_DND_TARGETS; ++i)
83 + if (!clip_html && selection_targets[i].info == TARGET_HTML)
87 + targets[j++] = dnd_targets[i];
90 + gtk_drag_dest_unset(gui.drawarea);
91 + gtk_drag_dest_set(gui.drawarea,
92 + GTK_DEST_DEFAULT_ALL,
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.
103 gtk_signal_connect(GTK_OBJECT(gui.drawarea), "selection_received",
104 GTK_SIGNAL_FUNC(selection_received_cb), NULL);
107 ! * Add selection targets for PRIMARY and CLIPBOARD selections.
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);
116 gtk_signal_connect(GTK_OBJECT(gui.drawarea), "selection_get",
117 GTK_SIGNAL_FUNC(selection_get_cb), NULL);
119 gtk_signal_connect(GTK_OBJECT(gui.drawarea), "selection_received",
120 GTK_SIGNAL_FUNC(selection_received_cb), NULL);
122 ! gui_gtk_set_selection_targets();
124 gtk_signal_connect(GTK_OBJECT(gui.drawarea), "selection_get",
125 GTK_SIGNAL_FUNC(selection_get_cb), NULL);
133 * Open the GUI window which was created by a call to gui_mch_init().
138 GTK_SIGNAL_FUNC(form_configure_event), NULL);
142 ! * Set up for receiving DND items.
144 ! gtk_drag_dest_set(gui.drawarea,
145 ! GTK_DEST_DEFAULT_ALL,
146 ! dnd_targets, N_DND_TARGETS,
149 gtk_signal_connect(GTK_OBJECT(gui.drawarea), "drag_data_received",
150 GTK_SIGNAL_FUNC(drag_data_received_cb), NULL);
152 GTK_SIGNAL_FUNC(form_configure_event), NULL);
155 ! /* Set up for receiving DND items. */
156 ! gui_gtk_set_dnd_targets();
158 gtk_signal_connect(GTK_OBJECT(gui.drawarea), "drag_data_received",
159 GTK_SIGNAL_FUNC(drag_data_received_cb), NULL);
162 /* this will cause the proper resizement to happen too */
163 update_window_manager_hints(0, 0);
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);
170 /* this will cause the proper resizement to happen too */
171 update_window_manager_hints(0, 0);
174 /* this will cause the proper resizement to happen too */
175 if (gtk_socket_id == 0)
176 update_window_manager_hints(0, 0);
180 update_window_manager_hints(width, height);
183 if (!resize_idle_installed)
185 g_idle_add_full(GDK_PRIORITY_EVENTS + 10,
186 &force_shell_resize_idle, NULL, NULL);
187 resize_idle_installed = TRUE;
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.
195 update_window_manager_hints(width, height);
198 if (!resize_idle_installed)
200 g_idle_add_full(GDK_PRIORITY_EVENTS + 10,
201 &force_shell_resize_idle, NULL, NULL);
202 resize_idle_installed = TRUE;
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
213 clip_html = new_html;
214 vim_free(clip_exclude_prog);
215 clip_exclude_prog = new_exclude_prog;
216 + #ifdef FEAT_GUI_GTK
219 + gui_gtk_set_selection_targets();
220 + gui_gtk_set_dnd_targets();
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
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
244 { /* Add new patch number below this line */
250 hundred-and-one symptoms of being an internet addict:
251 158. You get a tuner card so you can watch TV while surfing.
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 ///