/[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 1165 by ossman_, Mon Mar 20 12:28:03 2006 UTC revision 1167 by ossman_, Mon Mar 20 14:35:02 2006 UTC
# Line 81  update_position(HWND hwnd) Line 81  update_position(HWND hwnd)
81          HWND blocked_hwnd;          HWND blocked_hwnd;
82          unsigned int serial;          unsigned int serial;
83    
         if (!GetWindowRect(hwnd, &rect))  
         {  
                 debug("GetWindowRect failed!\n");  
                 return;  
         }  
   
84          WaitForSingleObject(g_mutex, INFINITE);          WaitForSingleObject(g_mutex, INFINITE);
85          blocked_hwnd = g_block_move_hwnd;          blocked_hwnd = g_block_move_hwnd;
86          serial = g_block_move_serial;          serial = g_block_move_serial;
87          memcpy(&blocked, &g_block_move, sizeof(RECT));          memcpy(&blocked, &g_block_move, sizeof(RECT));
88          ReleaseMutex(g_mutex);          ReleaseMutex(g_mutex);
89    
90            vchannel_block();
91    
92            if (!GetWindowRect(hwnd, &rect))
93            {
94                    debug("GetWindowRect failed!\n");
95                    goto end;
96            }
97    
98          if ((hwnd == blocked_hwnd) && (rect.left == blocked.left) && (rect.top == blocked.top)          if ((hwnd == blocked_hwnd) && (rect.left == blocked.left) && (rect.top == blocked.top)
99              && (rect.right == blocked.right) && (rect.bottom == blocked.bottom))              && (rect.right == blocked.right) && (rect.bottom == blocked.bottom))
100                  vchannel_write("ACK", "%u", serial);                  goto end;
101          else  
102                  vchannel_write("POSITION", "0x%p,%d,%d,%d,%d,0x%x",          vchannel_write("POSITION", "0x%p,%d,%d,%d,%d,0x%x",
103                                 hwnd,                         hwnd,
104                                 rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top,                         rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, 0);
105                                 0);  
106          end:
107            vchannel_unblock();
108  }  }
109    
110  static void  static void
# Line 116  update_zorder(HWND hwnd) Line 120  update_zorder(HWND hwnd)
120          block_behind = g_blocked_zchange[1];          block_behind = g_blocked_zchange[1];
121          ReleaseMutex(g_mutex);          ReleaseMutex(g_mutex);
122    
123            vchannel_block();
124    
125          behind = GetNextWindow(hwnd, GW_HWNDPREV);          behind = GetNextWindow(hwnd, GW_HWNDPREV);
126          while (behind)          while (behind)
127          {          {
# Line 133  update_zorder(HWND hwnd) Line 139  update_zorder(HWND hwnd)
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%p,0x%p,0x%x", hwnd, behind, 0);
142    
143            vchannel_unblock();
144  }  }
145    
146  static LRESULT CALLBACK  static LRESULT CALLBACK
# Line 402  SafeMoveWindow(unsigned int serial, HWND Line 410  SafeMoveWindow(unsigned int serial, HWND
410  {  {
411          RECT rect;          RECT rect;
412    
         vchannel_block();  
   
         if (!GetWindowRect(hwnd, &rect))  
         {  
                 vchannel_unblock();  
                 debug("GetWindowRect failed!\n");  
                 return;  
         }  
   
         if ((rect.left == x) && (rect.top == y) && (rect.right == x + width)  
             && (rect.bottom == y + height))  
         {  
                 vchannel_write("ACK", "%u", serial);  
                 vchannel_unblock();  
         }  
   
413          WaitForSingleObject(g_mutex, INFINITE);          WaitForSingleObject(g_mutex, INFINITE);
414          g_block_move_hwnd = hwnd;          g_block_move_hwnd = hwnd;
415          g_block_move_serial = serial;          g_block_move_serial = serial;
# Line 427  SafeMoveWindow(unsigned int serial, HWND Line 419  SafeMoveWindow(unsigned int serial, HWND
419          g_block_move.bottom = y + height;          g_block_move.bottom = y + height;
420          ReleaseMutex(g_mutex);          ReleaseMutex(g_mutex);
421    
         vchannel_unblock();  
   
422          SetWindowPos(hwnd, NULL, x, y, width, height, SWP_NOACTIVATE | SWP_NOZORDER);          SetWindowPos(hwnd, NULL, x, y, width, height, SWP_NOACTIVATE | SWP_NOZORDER);
423    
424            vchannel_write("ACK", "%u", serial);
425    
426            if (!GetWindowRect(hwnd, &rect))
427                    debug("GetWindowRect failed!\n");
428            else if ((rect.left != x) || (rect.top != y) || (rect.right != x + width)
429                     || (rect.bottom != y + height))
430                    update_position(hwnd);
431    
432          WaitForSingleObject(g_mutex, INFINITE);          WaitForSingleObject(g_mutex, INFINITE);
433          g_block_move_hwnd = NULL;          g_block_move_hwnd = NULL;
434          memset(&g_block_move, 0, sizeof(RECT));          memset(&g_block_move, 0, sizeof(RECT));
# Line 493  SafeSetState(unsigned int serial, HWND h Line 491  SafeSetState(unsigned int serial, HWND h
491          {          {
492                  vchannel_write("ACK", "%u", serial);                  vchannel_write("ACK", "%u", serial);
493                  vchannel_unblock();                  vchannel_unblock();
494                    return;
495          }          }
496    
497          WaitForSingleObject(g_mutex, INFINITE);          WaitForSingleObject(g_mutex, INFINITE);

Legend:
Removed from v.1165  
changed lines
  Added in v.1167

  ViewVC Help
Powered by ViewVC 1.1.26