home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / unreleased / patches / old / 5.4p.13 < prev    next >
Encoding:
Internet Message Format  |  1999-07-23  |  5.8 KB

  1. Received: from luna.worldonline.nl (luna.worldonline.nl [195.241.48.131])
  2.     by larissa.worldonline.nl (8.8.5/8.8.5) with ESMTP id MAA12414
  3.     for <moolena@larissa.worldonline.nl>; Sat, 24 Jul 1999 12:58:27 +0200 (MET DST)
  4. Received: from ulwar.pair.com (ulwar.pair.com [209.68.1.173])
  5.     by luna.worldonline.nl (8.8.5/8.8.5) with ESMTP id MAA28772
  6.     for <Bram.Moolenaar@worldonline.nl>; Sat, 24 Jul 1999 12:50:40 +0200 (MET DST)
  7. Received: from foobar.math.fu-berlin.de (foobar.math.fu-berlin.de [160.45.45.151]) by ulwar.pair.com (8.9.1/8.6.12) with SMTP id GAA20067 for <Bram@moolenaar.net>; Sat, 24 Jul 1999 06:50:38 -0400 (EDT)
  8. X-Envelope-To: <Bram@moolenaar.net>
  9. Received: (qmail 22368 invoked by uid 200); 24 Jul 1999 10:52:24 -0000
  10. Mailing-List: contact vim-dev-help@vim.org; run by ezmlm
  11. Precedence: bulk
  12. Delivered-To: mailing list vim-dev@vim.org
  13. Received: (qmail 22360 invoked from network); 24 Jul 1999 10:52:16 -0000
  14. Message-Id: <199907241102.NAA00729@moolenaar.net>
  15. To: vim-dev@vim.org
  16. Subject: patch 5.4p.13
  17. From: Bram Moolenaar <Bram@moolenaar.net>
  18. Date: Sat, 24 Jul 1999 13:02:36 +0200
  19. Sender: Bram@moolenaar.net
  20. Content-type: text
  21. Status: U
  22.  
  23.  
  24. This is the "official" version of the previous copy/paste hang problem fix.
  25. I also included the change to make vim work with GTK 1.0.6.
  26.  
  27.  
  28. Patch 5.4p.13
  29. Problem:    GTK: pasting selected text sometimes caused a hang.
  30.         Hang with GTK 1.0.6.  
  31. Solution:   In clip_mch_request_selection() there was a gui_mch_update() call
  32.         in the wrong place.
  33.         Also: Skip getting a normal string selection if the Vim selection
  34.         was already obtained successfully.
  35.         Added idle_function() back. (Kahn)
  36. Files:        src/gui_gtk_x11.c
  37.  
  38.  
  39. *** ../vim-5.4p/src/gui_gtk_x11.c    Mon Jul 19 11:09:06 1999
  40. --- src/gui_gtk_x11.c    Fri Jul 23 12:45:47 1999
  41. ***************
  42. *** 582,588 ****
  43.       return TRUE;
  44.   }
  45.   
  46. ! static int did_receive_selection = FALSE;
  47.   
  48.   /*ARGSUSED*/
  49.   static void
  50. --- 582,591 ----
  51.       return TRUE;
  52.   }
  53.   
  54. ! #define RS_NONE    0    /* selection_received_event() not called yet */
  55. ! #define RS_OK    1    /* selection_received_event() called and OK */
  56. ! #define RS_FAIL    2    /* selection_received_event() called and failed */
  57. ! static int received_selection;
  58.   
  59.   /*ARGSUSED*/
  60.   static void
  61. ***************
  62. *** 592,600 ****
  63.       long_u len;
  64.       char_u *p;
  65.   
  66. -     did_receive_selection = TRUE;
  67.       if ((!data->data) || (data->length <= 0)) {
  68.       /* clip_free_selection(); ??? */
  69.       if (gtk_main_level() > 0)
  70.           gtk_main_quit();
  71. --- 595,602 ----
  72.       long_u len;
  73.       char_u *p;
  74.   
  75.       if ((!data->data) || (data->length <= 0)) {
  76. +     received_selection = RS_FAIL;
  77.       /* clip_free_selection(); ??? */
  78.       if (gtk_main_level() > 0)
  79.           gtk_main_quit();
  80. ***************
  81. *** 611,616 ****
  82. --- 613,619 ----
  83.       len--;
  84.       }
  85.       clip_yank_selection(motion_type, p, (long) len);
  86. +     received_selection = RS_OK;
  87.       if (gtk_main_level() > 0)
  88.       gtk_main_quit();
  89.   }
  90. ***************
  91. *** 2047,2052 ****
  92. --- 2056,2072 ----
  93.       gdk_gc_destroy(gc);
  94.   }
  95.   
  96. + #ifndef GTK_HAVE_FEATURES_1_1_0
  97. + static gint
  98. + idle_function(GtkWidget * label)
  99. + {
  100. +     if (gtk_main_level() > 0)
  101. +     gtk_main_quit();
  102. +     return FALSE;
  103. + }
  104. + #endif
  105.   
  106.   /*
  107.    * Catch up with any queued X11 events.  This may put keyboard input into the
  108. ***************
  109. *** 2057,2066 ****
  110.   void
  111.   gui_mch_update()
  112.   {
  113.       while (gtk_events_pending() && !vim_is_input_buf_full())
  114.       gtk_main_iteration_do(FALSE);
  115.   
  116. !     return;
  117.   }
  118.   
  119.   static gint
  120. --- 2077,2098 ----
  121.   void
  122.   gui_mch_update()
  123.   {
  124. + #ifdef GTK_HAVE_FEATURES_1_1_0
  125.       while (gtk_events_pending() && !vim_is_input_buf_full())
  126.       gtk_main_iteration_do(FALSE);
  127. + #else
  128. +     int pending;
  129. +     /* Somehow the above loop hangs on GTK 1.0.6.  Use the idle_function() to
  130. +      * work around this weird problem. */
  131. +     while (((pending = gtk_events_pending()) > 1) && !vim_is_input_buf_full())
  132. +     gtk_main_iteration();
  133.   
  134. !     if ((pending == 1) && !vim_is_input_buf_full()) {
  135. !     gtk_idle_add((GtkFunction)idle_function, gui.mainwin);
  136. !     gtk_main_iteration_do(FALSE);
  137. !     }
  138. ! #endif
  139.   }
  140.   
  141.   static gint
  142. ***************
  143. *** 2322,2342 ****
  144.   clip_mch_request_selection()
  145.   {
  146.       /* First try to get the content of our own special clipboard. */
  147.       (void)gtk_selection_convert(gui.drawarea,
  148.                       GDK_SELECTION_PRIMARY, clipboard.atom,
  149.                       GDK_CURRENT_TIME);
  150. !     did_receive_selection = FALSE;
  151. !     while (!did_receive_selection)
  152. !     gtk_main();        /* wait until signal arrives */
  153.   
  154. !     /* Ok now try to get it out of the usual string selection. */
  155. !     (void)gtk_selection_convert(gui.drawarea, GDK_SELECTION_PRIMARY,
  156.                       GDK_TARGET_STRING,
  157.                       GDK_CURRENT_TIME);
  158. !     gui_mch_update();
  159. !     did_receive_selection = FALSE;
  160. !     while (!did_receive_selection)
  161. !     gtk_main();        /* wait until signal arrives */
  162.   }
  163.   
  164.   void
  165. --- 2354,2376 ----
  166.   clip_mch_request_selection()
  167.   {
  168.       /* First try to get the content of our own special clipboard. */
  169. +     received_selection = RS_NONE;
  170.       (void)gtk_selection_convert(gui.drawarea,
  171.                       GDK_SELECTION_PRIMARY, clipboard.atom,
  172.                       GDK_CURRENT_TIME);
  173. !     while (received_selection == RS_NONE)
  174. !     gtk_main();        /* wait for selection_received_event */
  175.   
  176. !     if (received_selection == RS_FAIL)
  177. !     {
  178. !     /* Now try to get it out of the usual string selection. */
  179. !     received_selection = RS_NONE;
  180. !     (void)gtk_selection_convert(gui.drawarea, GDK_SELECTION_PRIMARY,
  181.                       GDK_TARGET_STRING,
  182.                       GDK_CURRENT_TIME);
  183. !     while (received_selection == RS_NONE)
  184. !         gtk_main();        /* wait for selection_received_event */
  185. !     }
  186.   }
  187.   
  188.   void
  189.  
  190. --
  191. hundred-and-one symptoms of being an internet addict:
  192. 246. You use up your free 100 hours in less than a week.
  193.  
  194. --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\--
  195.   \ \    www.vim.org/iccf      www.moolenaar.net       www.vim.org    / /
  196.  
  197.