To: vim-dev@vim.org Subject: Patch 6.0.055 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.055 Problem: GTK: The selection isn't copied the first time. Solution: Own the selection at the right moment. Files: src/gui_gtk_x11.c *** ../vim60.54/src/gui_gtk_x11.c Thu Oct 25 10:20:46 2001 --- src/gui_gtk_x11.c Thu Nov 1 14:14:30 2001 *************** *** 871,877 **** * Selection handlers: */ - /*ARGSUSED*/ static gint selection_clear_event(GtkWidget * widget, GdkEventSelection * event) --- 871,876 ---- *************** *** 3521,3563 **** } } void clip_mch_lose_selection(cbd) VimClipboard *cbd; { ! gtk_selection_owner_set(gui.drawarea, cbd->gtk_sel_atom, ! (guint32)GDK_CURRENT_TIME); gui_mch_update(); } /* ! * Check whatever we allready own the selection. */ int clip_mch_own_selection(cbd) VimClipboard *cbd; { ! if (cbd == &clip_star) ! { ! /* At this point we always already own the selection - apparently */ return OK; ! } ! else ! { ! return gdk_selection_owner_get(clip_plus.gtk_sel_atom) == gui.drawarea->window; ! } } /* ! * Send the current selection to the clipboard. */ void clip_mch_set_selection(cbd) VimClipboard* cbd; { - gtk_selection_owner_set(gui.drawarea, cbd->gtk_sel_atom, - (guint32)GDK_CURRENT_TIME); - gui_mch_update(); } --- 3520,3565 ---- } } + /* + * Disown the selection. + */ void clip_mch_lose_selection(cbd) VimClipboard *cbd; { ! /* WEIRD: when using NULL to actually disown the selection, we lose the ! * selection the first time we own it. */ ! /* ! gtk_selection_owner_set(NULL, cbd->gtk_sel_atom, (guint32)GDK_CURRENT_TIME); gui_mch_update(); + */ } /* ! * Own the selection and return OK if it worked. */ int clip_mch_own_selection(cbd) VimClipboard *cbd; { ! int r; ! ! r = gtk_selection_owner_set(gui.drawarea, cbd->gtk_sel_atom, ! (guint32)GDK_CURRENT_TIME); ! gui_mch_update(); ! if (r) return OK; ! return FAIL; } /* ! * Send the current selection to the clipboard. Do nothing for X because we ! * will fill in the selection only when requested by another app. */ void clip_mch_set_selection(cbd) VimClipboard* cbd; { } *** ../vim60.54/src/version.c Thu Nov 1 14:37:02 2001 --- src/version.c Thu Nov 1 14:38:27 2001 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 55, /**/ -- ARTHUR: It is I, Arthur, son of Uther Pendragon, from the castle of Camelot. King of all Britons, defeator of the Saxons, sovereign of all England! [Pause] SOLDIER: Get away! "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim ))) \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///