45 |
int g_instance_count SHARED = 0; |
int g_instance_count SHARED = 0; |
46 |
|
|
47 |
// blocks for locally generated events |
// blocks for locally generated events |
48 |
|
HWND g_block_move_hwnd SHARED = NULL; |
49 |
RECT g_block_move SHARED = { 0, 0, 0, 0 }; |
RECT g_block_move SHARED = { 0, 0, 0, 0 }; |
50 |
HWND g_blocked_zchange[2] SHARED = { NULL, NULL }; |
HWND g_blocked_zchange[2] SHARED = { NULL, NULL }; |
51 |
HWND g_blocked_focus SHARED = NULL; |
HWND g_blocked_focus SHARED = NULL; |
52 |
|
HWND g_blocked_state_hwnd SHARED = NULL; |
53 |
int g_blocked_state SHARED = -1; |
int g_blocked_state SHARED = -1; |
54 |
|
|
55 |
#pragma data_seg () |
#pragma data_seg () |
71 |
update_position(HWND hwnd) |
update_position(HWND hwnd) |
72 |
{ |
{ |
73 |
RECT rect, blocked; |
RECT rect, blocked; |
74 |
|
HWND blocked_hwnd; |
75 |
|
|
76 |
if (!GetWindowRect(hwnd, &rect)) |
if (!GetWindowRect(hwnd, &rect)) |
77 |
{ |
{ |
80 |
} |
} |
81 |
|
|
82 |
WaitForSingleObject(g_mutex, INFINITE); |
WaitForSingleObject(g_mutex, INFINITE); |
83 |
|
blocked_hwnd = hwnd; |
84 |
memcpy(&blocked, &g_block_move, sizeof(RECT)); |
memcpy(&blocked, &g_block_move, sizeof(RECT)); |
85 |
ReleaseMutex(g_mutex); |
ReleaseMutex(g_mutex); |
86 |
|
|
87 |
if ((rect.left == blocked.left) && (rect.top == blocked.top) |
if ((hwnd == blocked_hwnd) && (rect.left == blocked.left) && (rect.top == blocked.top) |
88 |
&& (rect.right == blocked.right) && (rect.bottom == blocked.bottom)) |
&& (rect.right == blocked.right) && (rect.bottom == blocked.bottom)) |
89 |
return; |
return; |
90 |
|
|
289 |
case HCBT_MINMAX: |
case HCBT_MINMAX: |
290 |
{ |
{ |
291 |
int show, state, blocked; |
int show, state, blocked; |
292 |
|
HWND blocked_hwnd; |
293 |
|
|
294 |
WaitForSingleObject(g_mutex, INFINITE); |
WaitForSingleObject(g_mutex, INFINITE); |
295 |
|
blocked_hwnd = g_blocked_state_hwnd; |
296 |
blocked = g_blocked_state; |
blocked = g_blocked_state; |
297 |
ReleaseMutex(g_mutex); |
ReleaseMutex(g_mutex); |
298 |
|
|
311 |
break; |
break; |
312 |
} |
} |
313 |
|
|
314 |
if (blocked != state) |
if ((blocked_hwnd != (HWND) wparam) || (blocked != state)) |
315 |
vchannel_write("STATE,0x%p,0x%x,0x%x", (HWND) wparam, state, |
vchannel_write("STATE,0x%p,0x%x,0x%x", (HWND) wparam, state, |
316 |
0); |
0); |
317 |
|
|
357 |
SafeMoveWindow(HWND hwnd, int x, int y, int width, int height) |
SafeMoveWindow(HWND hwnd, int x, int y, int width, int height) |
358 |
{ |
{ |
359 |
WaitForSingleObject(g_mutex, INFINITE); |
WaitForSingleObject(g_mutex, INFINITE); |
360 |
|
g_block_move_hwnd = hwnd; |
361 |
g_block_move.left = x; |
g_block_move.left = x; |
362 |
g_block_move.top = y; |
g_block_move.top = y; |
363 |
g_block_move.right = x + width; |
g_block_move.right = x + width; |
367 |
SetWindowPos(hwnd, NULL, x, y, width, height, SWP_NOACTIVATE | SWP_NOZORDER); |
SetWindowPos(hwnd, NULL, x, y, width, height, SWP_NOACTIVATE | SWP_NOZORDER); |
368 |
|
|
369 |
WaitForSingleObject(g_mutex, INFINITE); |
WaitForSingleObject(g_mutex, INFINITE); |
370 |
|
g_block_move_hwnd = NULL; |
371 |
memset(&g_block_move, 0, sizeof(RECT)); |
memset(&g_block_move, 0, sizeof(RECT)); |
372 |
ReleaseMutex(g_mutex); |
ReleaseMutex(g_mutex); |
373 |
} |
} |
409 |
SafeSetState(HWND hwnd, int state) |
SafeSetState(HWND hwnd, int state) |
410 |
{ |
{ |
411 |
WaitForSingleObject(g_mutex, INFINITE); |
WaitForSingleObject(g_mutex, INFINITE); |
412 |
|
g_blocked_state_hwnd = hwnd; |
413 |
g_blocked_state = state; |
g_blocked_state = state; |
414 |
ReleaseMutex(g_mutex); |
ReleaseMutex(g_mutex); |
415 |
|
|
423 |
debug("Invalid state %d sent.", state); |
debug("Invalid state %d sent.", state); |
424 |
|
|
425 |
WaitForSingleObject(g_mutex, INFINITE); |
WaitForSingleObject(g_mutex, INFINITE); |
426 |
|
g_blocked_state_hwnd = NULL; |
427 |
g_blocked_state = -1; |
g_blocked_state = -1; |
428 |
ReleaseMutex(g_mutex); |
ReleaseMutex(g_mutex); |
429 |
} |
} |