99 |
&& (rect.right == blocked.right) && (rect.bottom == blocked.bottom)) |
&& (rect.right == blocked.right) && (rect.bottom == blocked.bottom)) |
100 |
goto end; |
goto end; |
101 |
|
|
102 |
vchannel_write("POSITION", "0x%p,%d,%d,%d,%d,0x%x", |
vchannel_write("POSITION", "0x%08lx,%d,%d,%d,%d,0x%08x", |
103 |
hwnd, |
hwnd, |
104 |
rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, 0); |
rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, 0); |
105 |
|
|
138 |
if ((hwnd == block_hwnd) && (behind == block_behind)) |
if ((hwnd == block_hwnd) && (behind == block_behind)) |
139 |
vchannel_write("ACK", "%u", serial); |
vchannel_write("ACK", "%u", serial); |
140 |
else |
else |
141 |
vchannel_write("ZCHANGE", "0x%p,0x%p,0x%x", hwnd, behind, 0); |
vchannel_write("ZCHANGE", "0x%08lx,0x%08lx,0x%08x", hwnd, behind, 0); |
142 |
|
|
143 |
vchannel_unblock(); |
vchannel_unblock(); |
144 |
} |
} |
145 |
|
|
146 |
|
static HWND |
147 |
|
get_parent(HWND hwnd) |
148 |
|
{ |
149 |
|
LONG style; |
150 |
|
HWND parent; |
151 |
|
|
152 |
|
style = GetWindowLong(hwnd, GWL_STYLE); |
153 |
|
|
154 |
|
if (style & (WS_POPUP | DS_MODALFRAME)) |
155 |
|
{ |
156 |
|
parent = (HWND) GetWindowLong(hwnd, GWL_HWNDPARENT); |
157 |
|
|
158 |
|
if (parent) |
159 |
|
{ |
160 |
|
style = GetWindowLong(parent, GWL_STYLE); |
161 |
|
if (((style & WS_CHILD) && !(style & WS_POPUP)) || !(style & WS_VISIBLE)) |
162 |
|
parent = NULL; |
163 |
|
} |
164 |
|
|
165 |
|
if (!parent) |
166 |
|
parent = GetWindow(hwnd, GW_OWNER); |
167 |
|
|
168 |
|
if (parent) |
169 |
|
{ |
170 |
|
style = GetWindowLong(parent, GWL_STYLE); |
171 |
|
if (((style & WS_CHILD) && !(style & WS_POPUP)) || !(style & WS_VISIBLE)) |
172 |
|
parent = NULL; |
173 |
|
} |
174 |
|
|
175 |
|
if (!parent) |
176 |
|
parent = (HWND) - 1; |
177 |
|
} |
178 |
|
else |
179 |
|
parent = NULL; |
180 |
|
|
181 |
|
return parent; |
182 |
|
} |
183 |
|
|
184 |
static LRESULT CALLBACK |
static LRESULT CALLBACK |
185 |
wndproc_hook_proc(int code, WPARAM cur_thread, LPARAM details) |
wndproc_hook_proc(int code, WPARAM cur_thread, LPARAM details) |
186 |
{ |
{ |
206 |
if ((style & WS_CHILD) && !(style & WS_POPUP)) |
if ((style & WS_CHILD) && !(style & WS_POPUP)) |
207 |
goto end; |
goto end; |
208 |
|
|
209 |
if (style & WS_POPUP) |
parent = get_parent(hwnd); |
|
{ |
|
|
parent = (HWND) GetWindowLong(hwnd, GWL_HWNDPARENT); |
|
|
if (!parent) |
|
|
parent = (HWND) - 1; |
|
|
} |
|
|
else |
|
|
parent = NULL; |
|
210 |
|
|
211 |
switch (msg) |
switch (msg) |
212 |
{ |
{ |
218 |
{ |
{ |
219 |
unsigned short title[150]; |
unsigned short title[150]; |
220 |
int state; |
int state; |
221 |
|
DWORD pid; |
222 |
|
int flags; |
223 |
|
|
224 |
|
GetWindowThreadProcessId(hwnd, &pid); |
225 |
|
|
226 |
vchannel_write("CREATE", "0x%p,0x%p,0x%x", hwnd, parent, 0); |
flags = 0; |
227 |
|
if (style & DS_MODALFRAME) |
228 |
|
flags |= SEAMLESS_CREATE_MODAL; |
229 |
|
|
230 |
|
vchannel_write("CREATE", "0x%08lx,0x%08lx,0x%08lx,0x%08x", |
231 |
|
(long) hwnd, (long) pid, (long) parent, |
232 |
|
flags); |
233 |
|
|
234 |
GetWindowTextW(hwnd, title, sizeof(title) / sizeof(*title)); |
GetWindowTextW(hwnd, title, sizeof(title) / sizeof(*title)); |
235 |
|
|
236 |
vchannel_write("TITLE", "0x%x,%s,0x%x", hwnd, |
vchannel_write("TITLE", "0x%08lx,%s,0x%08x", hwnd, |
237 |
vchannel_strfilter_unicode(title), 0); |
vchannel_strfilter_unicode(title), 0); |
238 |
|
|
239 |
if (style & WS_MAXIMIZE) |
if (style & WS_MAXIMIZE) |
245 |
|
|
246 |
update_position(hwnd); |
update_position(hwnd); |
247 |
|
|
248 |
vchannel_write("STATE", "0x%p,0x%x,0x%x", hwnd, state, 0); |
vchannel_write("STATE", "0x%08lx,0x%08x,0x%08x", hwnd, |
249 |
|
state, 0); |
250 |
} |
} |
251 |
|
|
252 |
if (wp->flags & SWP_HIDEWINDOW) |
if (wp->flags & SWP_HIDEWINDOW) |
253 |
vchannel_write("DESTROY", "0x%p,0x%x", hwnd, 0); |
vchannel_write("DESTROY", "0x%08lx,0x%08x", hwnd, 0); |
254 |
|
|
255 |
if (!(style & WS_VISIBLE) || (style & WS_MINIMIZE)) |
if (!(style & WS_VISIBLE) || (style & WS_MINIMIZE)) |
256 |
break; |
break; |
276 |
case WM_DESTROY: |
case WM_DESTROY: |
277 |
if (!(style & WS_VISIBLE)) |
if (!(style & WS_VISIBLE)) |
278 |
break; |
break; |
279 |
vchannel_write("DESTROY", "0x%p,0x%x", hwnd, 0); |
vchannel_write("DESTROY", "0x%08lx,0x%08x", hwnd, 0); |
280 |
break; |
break; |
281 |
|
|
282 |
default: |
default: |
312 |
if ((style & WS_CHILD) && !(style & WS_POPUP)) |
if ((style & WS_CHILD) && !(style & WS_POPUP)) |
313 |
goto end; |
goto end; |
314 |
|
|
315 |
if (style & WS_POPUP) |
parent = get_parent(hwnd); |
|
{ |
|
|
parent = (HWND) GetWindowLong(hwnd, GWL_HWNDPARENT); |
|
|
if (!parent) |
|
|
parent = (HWND) - 1; |
|
|
} |
|
|
else |
|
|
parent = NULL; |
|
316 |
|
|
317 |
switch (msg) |
switch (msg) |
318 |
{ |
{ |
338 |
/* We cannot use the string in lparam because |
/* We cannot use the string in lparam because |
339 |
we need unicode. */ |
we need unicode. */ |
340 |
GetWindowTextW(hwnd, title, sizeof(title) / sizeof(*title)); |
GetWindowTextW(hwnd, title, sizeof(title) / sizeof(*title)); |
341 |
vchannel_write("TITLE", "0x%p,%s,0x%x", hwnd, |
vchannel_write("TITLE", "0x%08lx,%s,0x%08x", hwnd, |
342 |
vchannel_strfilter_unicode(title), 0); |
vchannel_strfilter_unicode(title), 0); |
343 |
break; |
break; |
344 |
} |
} |
349 |
|
|
350 |
if (msg == g_wm_seamless_focus) |
if (msg == g_wm_seamless_focus) |
351 |
{ |
{ |
352 |
/* FIXME: SetActiveWindow() kills menus. Need to find a clean |
/* FIXME: SetForegroundWindow() kills menus. Need to find a |
353 |
way to solve this. */ |
clean way to solve this. */ |
354 |
if ((GetActiveWindow() != hwnd) && !parent) |
if ((GetForegroundWindow() != hwnd) && !parent) |
355 |
SetActiveWindow(hwnd); |
SetForegroundWindow(hwnd); |
356 |
|
|
357 |
vchannel_write("ACK", "%u", g_blocked_focus_serial); |
vchannel_write("ACK", "%u", g_blocked_focus_serial); |
358 |
} |
} |
399 |
if ((blocked_hwnd == (HWND) wparam) && (blocked == state)) |
if ((blocked_hwnd == (HWND) wparam) && (blocked == state)) |
400 |
vchannel_write("ACK", "%u", serial); |
vchannel_write("ACK", "%u", serial); |
401 |
else |
else |
402 |
vchannel_write("STATE", "0x%p,0x%x,0x%x", (HWND) wparam, |
vchannel_write("STATE", "0x%08lx,0x%08x,0x%08x", |
403 |
state, 0); |
(HWND) wparam, state, 0); |
404 |
|
|
405 |
break; |
break; |
406 |
} |
} |