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 / patches / 7.3 / 7.3.595 < prev    next >
Encoding:
Internet Message Format  |  2012-11-20  |  3.8 KB

  1. To: vim_dev@googlegroups.com
  2. Subject: Patch 7.3.595
  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.3.595
  11. Problem:    The X command server responds slowly
  12. Solution:   Change the loop that waits for replies. (Brian Burns)
  13. Files:        src/if_xcmdsrv.c
  14.  
  15.  
  16. *** ../vim-7.3.594/src/if_xcmdsrv.c    2012-07-10 14:25:00.000000000 +0200
  17. --- src/if_xcmdsrv.c    2012-07-10 14:44:13.000000000 +0200
  18. ***************
  19. *** 572,632 ****
  20.   {
  21.       time_t        start;
  22.       time_t        now;
  23. -     time_t        lastChk = 0;
  24.       XEvent        event;
  25. !     XPropertyEvent *e = (XPropertyEvent *)&event;
  26. ! #   define SEND_MSEC_POLL 50
  27.   
  28.       time(&start);
  29. !     while (endCond(endData) == 0)
  30.       {
  31.       time(&now);
  32.       if (seconds >= 0 && (now - start) >= seconds)
  33.           break;
  34. !     if (now != lastChk)
  35. !     {
  36. !         lastChk = now;
  37. !         if (!WindowValid(dpy, w))
  38. !         break;
  39. !         /*
  40. !          * Sometimes the PropertyChange event doesn't come.
  41. !          * This can be seen in eg: vim -c 'echo remote_expr("gvim", "3+2")'
  42. !          */
  43. !         serverEventProc(dpy, NULL);
  44. !     }
  45.       if (localLoop)
  46.       {
  47. -         /* Just look out for the answer without calling back into Vim */
  48.   #ifndef HAVE_SELECT
  49. -         struct pollfd   fds;
  50. -         fds.fd = ConnectionNumber(dpy);
  51. -         fds.events = POLLIN;
  52.           if (poll(&fds, 1, SEND_MSEC_POLL) < 0)
  53.           break;
  54.   #else
  55. !         fd_set        fds;
  56. !         struct timeval  tv;
  57. !         tv.tv_sec = 0;
  58. !         tv.tv_usec =  SEND_MSEC_POLL * 1000;
  59. !         FD_ZERO(&fds);
  60. !         FD_SET(ConnectionNumber(dpy), &fds);
  61. !         if (select(ConnectionNumber(dpy) + 1, &fds, NULL, NULL, &tv) < 0)
  62.           break;
  63.   #endif
  64. -         while (XEventsQueued(dpy, QueuedAfterReading) > 0)
  65. -         {
  66. -         XNextEvent(dpy, &event);
  67. -         if (event.type == PropertyNotify && e->window == commWindow)
  68. -             serverEventProc(dpy, &event);
  69. -         }
  70.       }
  71.       else
  72.       {
  73.           if (got_int)
  74.           break;
  75. !         ui_delay((long)SEND_MSEC_POLL, TRUE);
  76.           ui_breakcheck();
  77.       }
  78.       }
  79. --- 572,626 ----
  80.   {
  81.       time_t        start;
  82.       time_t        now;
  83.       XEvent        event;
  84. ! #define UI_MSEC_DELAY 50
  85. ! #define SEND_MSEC_POLL 500
  86. ! #ifndef HAVE_SELECT
  87. !     struct pollfd   fds;
  88. !     fds.fd = ConnectionNumber(dpy);
  89. !     fds.events = POLLIN;
  90. ! #else
  91. !     fd_set        fds;
  92. !     struct timeval  tv;
  93. !     tv.tv_sec = 0;
  94. !     tv.tv_usec =  SEND_MSEC_POLL * 1000;
  95. !     FD_ZERO(&fds);
  96. !     FD_SET(ConnectionNumber(dpy), &fds);
  97. ! #endif
  98.   
  99.       time(&start);
  100. !     while (TRUE)
  101.       {
  102. +     while (XCheckWindowEvent(dpy, commWindow, PropertyChangeMask, &event))
  103. +         serverEventProc(dpy, &event);
  104. +     if (endCond(endData) != 0)
  105. +         break;
  106. +     if (!WindowValid(dpy, w))
  107. +         break;
  108.       time(&now);
  109.       if (seconds >= 0 && (now - start) >= seconds)
  110.           break;
  111. !     /* Just look out for the answer without calling back into Vim */
  112.       if (localLoop)
  113.       {
  114.   #ifndef HAVE_SELECT
  115.           if (poll(&fds, 1, SEND_MSEC_POLL) < 0)
  116.           break;
  117.   #else
  118. !         if (select(FD_SETSIZE, &fds, NULL, NULL, &tv) < 0)
  119.           break;
  120.   #endif
  121.       }
  122.       else
  123.       {
  124.           if (got_int)
  125.           break;
  126. !         ui_delay((long)UI_MSEC_DELAY, TRUE);
  127.           ui_breakcheck();
  128.       }
  129.       }
  130. *** ../vim-7.3.594/src/version.c    2012-07-10 14:25:00.000000000 +0200
  131. --- src/version.c    2012-07-10 14:52:16.000000000 +0200
  132. ***************
  133. *** 716,717 ****
  134. --- 716,719 ----
  135.   {   /* Add new patch number below this line */
  136. + /**/
  137. +     595,
  138.   /**/
  139.  
  140. -- 
  141. hundred-and-one symptoms of being an internet addict:
  142. 104. When people ask about the Presidential Election you ask "Which country?"
  143.  
  144.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  145. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  146. \\\  an exciting new programming language -- http://www.Zimbu.org        ///
  147.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  148.