/[rdesktop]/sourceforge.net/trunk/seamlessrdp/ServerExe/HookDll/hookdll.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/trunk/seamlessrdp/ServerExe/HookDll/hookdll.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1160 by ossman_, Fri Mar 17 16:23:08 2006 UTC revision 1161 by ossman_, Fri Mar 17 16:34:46 2006 UTC
# Line 45  Line 45 
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 ()
# Line 69  static void Line 71  static void
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          {          {
# Line 77  update_position(HWND hwnd) Line 80  update_position(HWND hwnd)
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    
# Line 285  cbt_hook_proc(int code, WPARAM wparam, L Line 289  cbt_hook_proc(int code, WPARAM wparam, L
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    
# Line 305  cbt_hook_proc(int code, WPARAM wparam, L Line 311  cbt_hook_proc(int code, WPARAM wparam, L
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    
# Line 351  DLL_EXPORT void Line 357  DLL_EXPORT void
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;
# Line 360  SafeMoveWindow(HWND hwnd, int x, int y, Line 367  SafeMoveWindow(HWND hwnd, int x, int y,
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  }  }
# Line 401  DLL_EXPORT void Line 409  DLL_EXPORT void
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    
# Line 414  SafeSetState(HWND hwnd, int state) Line 423  SafeSetState(HWND hwnd, int state)
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  }  }

Legend:
Removed from v.1160  
changed lines
  Added in v.1161

  ViewVC Help
Powered by ViewVC 1.1.26