49 |
|
|
50 |
static HANDLE g_mutex = NULL; |
static HANDLE g_mutex = NULL; |
51 |
|
|
52 |
|
static void |
53 |
|
update_position(HWND hwnd) |
54 |
|
{ |
55 |
|
RECT rect; |
56 |
|
|
57 |
|
if (!GetWindowRect(hwnd, &rect)) |
58 |
|
{ |
59 |
|
debug("GetWindowRect failed!\n"); |
60 |
|
return; |
61 |
|
} |
62 |
|
|
63 |
|
vchannel_write("POSITION1,0x%p,%d,%d,%d,%d,0x%x", |
64 |
|
hwnd, |
65 |
|
rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, 0); |
66 |
|
} |
67 |
|
|
68 |
static LRESULT CALLBACK |
static LRESULT CALLBACK |
69 |
wndproc_hook_proc(int code, WPARAM cur_thread, LPARAM details) |
wndproc_hook_proc(int code, WPARAM cur_thread, LPARAM details) |
70 |
{ |
{ |
85 |
|
|
86 |
style = GetWindowLong(hwnd, GWL_STYLE); |
style = GetWindowLong(hwnd, GWL_STYLE); |
87 |
|
|
88 |
if (style & WS_CHILD) |
/* Docs say that WS_CHILD and WS_POPUP is an illegal combination, |
89 |
|
but they exist nonetheless. */ |
90 |
|
if ((style & WS_CHILD) && !(style & WS_POPUP)) |
91 |
goto end; |
goto end; |
92 |
|
|
93 |
switch (msg) |
switch (msg) |
95 |
|
|
96 |
case WM_WINDOWPOSCHANGED: |
case WM_WINDOWPOSCHANGED: |
97 |
{ |
{ |
|
RECT rect; |
|
98 |
WINDOWPOS *wp = (WINDOWPOS *) lparam; |
WINDOWPOS *wp = (WINDOWPOS *) lparam; |
99 |
|
|
100 |
if (wp->flags & SWP_SHOWWINDOW) |
if (wp->flags & SWP_SHOWWINDOW) |
105 |
|
|
106 |
// FIXME: SETSTATE |
// FIXME: SETSTATE |
107 |
|
|
108 |
if (!GetWindowRect(hwnd, &rect)) |
update_position(hwnd); |
|
{ |
|
|
debug("GetWindowRect failed!\n"); |
|
|
break; |
|
|
} |
|
|
vchannel_write("POSITION1,0x%p,%d,%d,%d,%d,0x%x", |
|
|
hwnd, |
|
|
rect.left, rect.top, |
|
|
rect.right - rect.left, |
|
|
rect.bottom - rect.top, 0); |
|
109 |
} |
} |
110 |
|
|
111 |
if (wp->flags & SWP_HIDEWINDOW) |
if (wp->flags & SWP_HIDEWINDOW) |
115 |
break; |
break; |
116 |
|
|
117 |
if (!(wp->flags & SWP_NOMOVE && wp->flags & SWP_NOSIZE)) |
if (!(wp->flags & SWP_NOMOVE && wp->flags & SWP_NOSIZE)) |
118 |
{ |
update_position(hwnd); |
|
if (!GetWindowRect(hwnd, &rect)) |
|
|
{ |
|
|
debug("GetWindowRect failed!\n"); |
|
|
break; |
|
|
} |
|
|
|
|
|
vchannel_write("POSITION1,0x%p,%d,%d,%d,%d,0x%x", |
|
|
hwnd, |
|
|
rect.left, rect.top, |
|
|
rect.right - rect.left, |
|
|
rect.bottom - rect.top, 0); |
|
|
} |
|
119 |
|
|
120 |
if (!(wp->flags & SWP_NOZORDER)) |
if (!(wp->flags & SWP_NOZORDER)) |
121 |
{ |
{ |
128 |
break; |
break; |
129 |
} |
} |
130 |
|
|
131 |
|
case WM_SIZE: |
132 |
|
update_position(hwnd); |
133 |
|
break; |
134 |
|
|
135 |
|
case WM_MOVE: |
136 |
|
update_position(hwnd); |
137 |
|
break; |
138 |
|
|
139 |
case WM_DESTROY: |
case WM_DESTROY: |
140 |
vchannel_write("DESTROY1,0x%p,0x%x", hwnd, 0); |
vchannel_write("DESTROY1,0x%p,0x%x", hwnd, 0); |
141 |
break; |
break; |