Mercurial > vim
comparison src/os_unix.c @ 16608:0422b14bce58 v8.1.1307
patch 8.1.1307: cannot reconnect to the X server after it restarted
commit https://github.com/vim/vim/commit/d4aa83af1d691fdabbc8e6aab36db2c96ea4d4b6
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu May 9 18:59:31 2019 +0200
patch 8.1.1307: cannot reconnect to the X server after it restarted
Problem: Cannot reconnect to the X server after it restarted.
Solution: Add the :xrestore command. (Adrian Kocis, closes https://github.com/vim/vim/issues/844)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 09 May 2019 19:00:08 +0200 |
parents | 5412fcd03ecb |
children | ef00b6bc186b |
comparison
equal
deleted
inserted
replaced
16607:5c5a7f945ade | 16608:0422b14bce58 |
---|---|
1657 | 1657 |
1658 setup_term_clip(); | 1658 setup_term_clip(); |
1659 get_x11_title(FALSE); | 1659 get_x11_title(FALSE); |
1660 } | 1660 } |
1661 } | 1661 } |
1662 | |
1663 void | |
1664 ex_xrestore(exarg_T *eap) | |
1665 { | |
1666 if (eap->arg != NULL && STRLEN(eap->arg) > 0) | |
1667 { | |
1668 if (xterm_display_allocated) | |
1669 vim_free(xterm_display); | |
1670 xterm_display = (char *)vim_strsave(eap->arg); | |
1671 xterm_display_allocated = TRUE; | |
1672 } | |
1673 smsg(_("restoring display %s"), xterm_display == NULL | |
1674 ? (char *)mch_getenv("DISPLAY") : xterm_display); | |
1675 | |
1676 clear_xterm_clip(); | |
1677 x11_window = 0; | |
1678 xterm_dpy_retry_count = 5; // Try reconnecting five times | |
1679 may_restore_clipboard(); | |
1680 } | |
1662 #endif | 1681 #endif |
1663 | 1682 |
1664 /* | 1683 /* |
1665 * Test if "dpy" and x11_window are valid by getting the window title. | 1684 * Test if "dpy" and x11_window are valid by getting the window title. |
1666 * I don't actually want it yet, so there may be a simpler call to use, but | 1685 * I don't actually want it yet, so there may be a simpler call to use, but |
1759 */ | 1778 */ |
1760 if (x11_window == 0 && (winid = getenv("WINDOWID")) != NULL) | 1779 if (x11_window == 0 && (winid = getenv("WINDOWID")) != NULL) |
1761 x11_window = (Window)atol(winid); | 1780 x11_window = (Window)atol(winid); |
1762 | 1781 |
1763 #ifdef FEAT_XCLIPBOARD | 1782 #ifdef FEAT_XCLIPBOARD |
1783 if (xterm_dpy == x11_display) | |
1784 // x11_display may have been set to xterm_dpy elsewhere | |
1785 x11_display_from = XD_XTERM; | |
1786 | |
1764 if (xterm_dpy != NULL && x11_window != 0) | 1787 if (xterm_dpy != NULL && x11_window != 0) |
1765 { | 1788 { |
1766 /* We may have checked it already, but Gnome terminal can move us to | 1789 /* We may have checked it already, but Gnome terminal can move us to |
1767 * another window, so we need to check every time. */ | 1790 * another window, so we need to check every time. */ |
1768 if (x11_display_from != XD_XTERM) | 1791 if (x11_display_from != XD_XTERM) |
7659 prev_row = row; | 7682 prev_row = row; |
7660 prev_col = col; | 7683 prev_col = col; |
7661 return TRUE; | 7684 return TRUE; |
7662 } | 7685 } |
7663 | 7686 |
7664 # if defined(FEAT_GUI) || defined(PROTO) | 7687 # if defined(FEAT_GUI) || defined(FEAT_XCLIPBOARD) || defined(PROTO) |
7665 /* | 7688 /* |
7666 * Destroy the display, window and app_context. Required for GTK. | 7689 * Destroy the display, window and app_context. Required for GTK. |
7667 */ | 7690 */ |
7668 void | 7691 void |
7669 clear_xterm_clip(void) | 7692 clear_xterm_clip(void) |