1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0462
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 8.1.0462
Problem: When using ConPTY Vim can be a child process.
Solution: To find a Vim window use both EnumWindows() and
EnumChildWindows(). (Nobuhiro Takasaki, closes #3521)
Files: src/os_mswin.c
*** ../vim-8.1.0461/src/os_mswin.c 2018-08-07 22:30:26.674240818 +0200
--- src/os_mswin.c 2018-10-07 20:32:20.655313848 +0200
***************
*** 2324,2329 ****
--- 2324,2364 ----
return TRUE;
}
+ struct enum_windows_s
+ {
+ WNDENUMPROC lpEnumFunc;
+ LPARAM lParam;
+ };
+
+ static BOOL CALLBACK
+ enum_windows_child(HWND hwnd, LPARAM lParam)
+ {
+ struct enum_windows_s *ew = (struct enum_windows_s *)lParam;
+
+ return (ew->lpEnumFunc)(hwnd, ew->lParam);
+ }
+
+ static BOOL CALLBACK
+ enum_windows_toplevel(HWND hwnd, LPARAM lParam)
+ {
+ struct enum_windows_s *ew = (struct enum_windows_s *)lParam;
+
+ if ((ew->lpEnumFunc)(hwnd, ew->lParam) == FALSE)
+ return FALSE;
+ return EnumChildWindows(hwnd, enum_windows_child, lParam);
+ }
+
+ /* Enumerate all windows including children. */
+ static BOOL
+ enum_windows(WNDENUMPROC lpEnumFunc, LPARAM lParam)
+ {
+ struct enum_windows_s ew;
+
+ ew.lpEnumFunc = lpEnumFunc;
+ ew.lParam = lParam;
+ return EnumWindows(enum_windows_toplevel, (LPARAM)&ew);
+ }
+
static HWND
findServer(char_u *name)
{
***************
*** 2332,2338 ****
id.name = name;
id.hwnd = 0;
! EnumWindows(enumWindowsGetServer, (LPARAM)(&id));
return id.hwnd;
}
--- 2367,2373 ----
id.name = name;
id.hwnd = 0;
! enum_windows(enumWindowsGetServer, (LPARAM)(&id));
return id.hwnd;
}
***************
*** 2395,2401 ****
ga_init2(&ga, 1, 100);
! EnumWindows(enumWindowsGetNames, (LPARAM)(&ga));
ga_append(&ga, NUL);
return ga.ga_data;
--- 2430,2436 ----
ga_init2(&ga, 1, 100);
! enum_windows(enumWindowsGetNames, (LPARAM)(&ga));
ga_append(&ga, NUL);
return ga.ga_data;
*** ../vim-8.1.0461/src/version.c 2018-10-07 20:26:15.834185143 +0200
--- src/version.c 2018-10-07 20:34:15.754398574 +0200
***************
*** 794,795 ****
--- 794,797 ----
{ /* Add new patch number below this line */
+ /**/
+ 462,
/**/
--
hundred-and-one symptoms of being an internet addict:
170. You introduce your wife as "my_lady@home.wife" and refer to your
children as "forked processes."
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|