Karsten Hopp df50d8
To: vim_dev@googlegroups.com
Karsten Hopp df50d8
Subject: Patch 7.4.523
Karsten Hopp df50d8
Fcc: outbox
Karsten Hopp df50d8
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp df50d8
Mime-Version: 1.0
Karsten Hopp df50d8
Content-Type: text/plain; charset=UTF-8
Karsten Hopp df50d8
Content-Transfer-Encoding: 8bit
Karsten Hopp df50d8
------------
Karsten Hopp df50d8
Karsten Hopp df50d8
Patch 7.4.523
Karsten Hopp df50d8
Problem:    When the X11 server is stopped and restarted, while Vim is kept in
Karsten Hopp df50d8
	    the background, copy/paste no longer works. (Issue 203)
Karsten Hopp df50d8
Solution:   Setup the clipboard again. (Christian Brabandt)
Karsten Hopp df50d8
Files:	    src/os_unix.c
Karsten Hopp df50d8
Karsten Hopp df50d8
Karsten Hopp df50d8
*** ../vim-7.4.522/src/os_unix.c	2014-11-19 16:38:01.520679869 +0100
Karsten Hopp df50d8
--- src/os_unix.c	2014-11-19 18:34:45.505245180 +0100
Karsten Hopp df50d8
***************
Karsten Hopp df50d8
*** 1586,1597 ****
Karsten Hopp df50d8
--- 1586,1600 ----
Karsten Hopp df50d8
   * An X IO Error handler, used to catch terminal errors.
Karsten Hopp df50d8
   */
Karsten Hopp df50d8
  static int x_IOerror_handler __ARGS((Display *dpy));
Karsten Hopp df50d8
+ static void may_restore_clipboard __ARGS((void));
Karsten Hopp df50d8
+ static int xterm_dpy_was_reset = FALSE;
Karsten Hopp df50d8
  
Karsten Hopp df50d8
      static int
Karsten Hopp df50d8
  x_IOerror_handler(dpy)
Karsten Hopp df50d8
      Display *dpy UNUSED;
Karsten Hopp df50d8
  {
Karsten Hopp df50d8
      xterm_dpy = NULL;
Karsten Hopp df50d8
+     xterm_dpy_was_reset = TRUE;
Karsten Hopp df50d8
      x11_window = 0;
Karsten Hopp df50d8
      x11_display = NULL;
Karsten Hopp df50d8
      xterm_Shell = (Widget)0;
Karsten Hopp df50d8
***************
Karsten Hopp df50d8
*** 1602,1607 ****
Karsten Hopp df50d8
--- 1605,1626 ----
Karsten Hopp df50d8
      return 0;  /* avoid the compiler complains about missing return value */
Karsten Hopp df50d8
  # endif
Karsten Hopp df50d8
  }
Karsten Hopp df50d8
+ 
Karsten Hopp df50d8
+ /*
Karsten Hopp df50d8
+  * If the X11 connection was lost try to restore it.
Karsten Hopp df50d8
+  * Helps when the X11 server was stopped and restarted while Vim was inactive
Karsten Hopp df50d8
+  * (e.g. though tmux).
Karsten Hopp df50d8
+  */
Karsten Hopp df50d8
+     static void
Karsten Hopp df50d8
+ may_restore_clipboard()
Karsten Hopp df50d8
+ {
Karsten Hopp df50d8
+     if (xterm_dpy_was_reset)
Karsten Hopp df50d8
+     {
Karsten Hopp df50d8
+ 	xterm_dpy_was_reset = FALSE;
Karsten Hopp df50d8
+ 	setup_term_clip();
Karsten Hopp df50d8
+ 	get_x11_title(FALSE);
Karsten Hopp df50d8
+     }
Karsten Hopp df50d8
+ }
Karsten Hopp df50d8
  #endif
Karsten Hopp df50d8
  
Karsten Hopp df50d8
  /*
Karsten Hopp df50d8
***************
Karsten Hopp df50d8
*** 5274,5279 ****
Karsten Hopp df50d8
--- 5293,5299 ----
Karsten Hopp df50d8
  	}
Karsten Hopp df50d8
  # endif
Karsten Hopp df50d8
  # ifdef FEAT_XCLIPBOARD
Karsten Hopp df50d8
+ 	may_restore_clipboard();
Karsten Hopp df50d8
  	if (xterm_Shell != (Widget)0)
Karsten Hopp df50d8
  	{
Karsten Hopp df50d8
  	    xterm_idx = nfd;
Karsten Hopp df50d8
***************
Karsten Hopp df50d8
*** 5426,5431 ****
Karsten Hopp df50d8
--- 5446,5452 ----
Karsten Hopp df50d8
  	}
Karsten Hopp df50d8
  # endif
Karsten Hopp df50d8
  # ifdef FEAT_XCLIPBOARD
Karsten Hopp df50d8
+ 	may_restore_clipboard();
Karsten Hopp df50d8
  	if (xterm_Shell != (Widget)0)
Karsten Hopp df50d8
  	{
Karsten Hopp df50d8
  	    FD_SET(ConnectionNumber(xterm_dpy), &rfds);
Karsten Hopp df50d8
*** ../vim-7.4.522/src/version.c	2014-11-19 18:03:24.202559721 +0100
Karsten Hopp df50d8
--- src/version.c	2014-11-19 18:48:06.140215792 +0100
Karsten Hopp df50d8
***************
Karsten Hopp df50d8
*** 743,744 ****
Karsten Hopp df50d8
--- 743,746 ----
Karsten Hopp df50d8
  {   /* Add new patch number below this line */
Karsten Hopp df50d8
+ /**/
Karsten Hopp df50d8
+     523,
Karsten Hopp df50d8
  /**/
Karsten Hopp df50d8
Karsten Hopp df50d8
-- 
Karsten Hopp df50d8
There is no right or wrong, there is only your personal opinion.
Karsten Hopp df50d8
                 (Bram Moolenaar)
Karsten Hopp df50d8
Karsten Hopp df50d8
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp df50d8
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp df50d8
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp df50d8
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///