/[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 1161 by ossman_, Fri Mar 17 16:34:46 2006 UTC revision 1162 by ossman_, Mon Mar 20 09:36:23 2006 UTC
# Line 93  update_position(HWND hwnd) Line 93  update_position(HWND hwnd)
93                         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);
94  }  }
95    
96    static void
97    update_zorder(HWND hwnd)
98    {
99            HWND behind;
100            HWND block_hwnd, block_behind;
101    
102            WaitForSingleObject(g_mutex, INFINITE);
103            block_hwnd = g_blocked_zchange[0];
104            block_behind = g_blocked_zchange[1];
105            ReleaseMutex(g_mutex);
106    
107            behind = GetNextWindow(hwnd, GW_HWNDPREV);
108            while (behind)
109            {
110                    LONG style;
111    
112                    style = GetWindowLong(behind, GWL_STYLE);
113    
114                    if ((!(style & WS_CHILD) || (style & WS_POPUP)) && (style & WS_VISIBLE))
115                            break;
116    
117                    behind = GetNextWindow(behind, GW_HWNDPREV);
118            }
119    
120            if ((hwnd == block_hwnd) && (behind == block_behind))
121                    return;
122    
123            vchannel_write("ZCHANGE,0x%p,0x%p,0x%x", hwnd, behind, 0);
124    }
125    
126  static LRESULT CALLBACK  static LRESULT CALLBACK
127  wndproc_hook_proc(int code, WPARAM cur_thread, LPARAM details)  wndproc_hook_proc(int code, WPARAM cur_thread, LPARAM details)
128  {  {
# Line 166  wndproc_hook_proc(int code, WPARAM cur_t Line 196  wndproc_hook_proc(int code, WPARAM cur_t
196                                  if (!(wp->flags & SWP_NOMOVE && wp->flags & SWP_NOSIZE))                                  if (!(wp->flags & SWP_NOMOVE && wp->flags & SWP_NOSIZE))
197                                          update_position(hwnd);                                          update_position(hwnd);
198    
                                 if (!(wp->flags & SWP_NOZORDER))  
                                 {  
                                         HWND block_hwnd, block_behind;  
                                         WaitForSingleObject(g_mutex, INFINITE);  
                                         block_hwnd = g_blocked_zchange[0];  
                                         block_behind = g_blocked_zchange[1];  
                                         ReleaseMutex(g_mutex);  
   
                                         if ((hwnd != block_hwnd)  
                                             || (wp->hwndInsertAfter != block_behind))  
                                         {  
                                                 vchannel_write("ZCHANGE,0x%p,0x%p,0x%x",  
                                                                hwnd,  
                                                                wp->flags & SWP_NOACTIVATE ? wp->  
                                                                hwndInsertAfter : 0, 0);  
                                         }  
                                 }  
   
199                                  break;                                  break;
200                          }                          }
201    
# Line 249  wndprocret_hook_proc(int code, WPARAM cu Line 261  wndprocret_hook_proc(int code, WPARAM cu
261    
262          switch (msg)          switch (msg)
263          {          {
264                    case WM_WINDOWPOSCHANGED:
265                            {
266                                    WINDOWPOS *wp = (WINDOWPOS *) lparam;
267    
268                                    if (!(style & WS_VISIBLE) || (style & WS_MINIMIZE))
269                                            break;
270    
271                                    if (!(wp->flags & SWP_NOZORDER))
272                                            update_zorder(hwnd);
273    
274                                    break;
275                            }
276    
277    
278                  case WM_SETTEXT:                  case WM_SETTEXT:
279                          {                          {
280                                  unsigned short title[150];                                  unsigned short title[150];
# Line 375  SafeMoveWindow(HWND hwnd, int x, int y, Line 401  SafeMoveWindow(HWND hwnd, int x, int y,
401  DLL_EXPORT void  DLL_EXPORT void
402  SafeZChange(HWND hwnd, HWND behind)  SafeZChange(HWND hwnd, HWND behind)
403  {  {
         if (behind == NULL)  
                 behind = HWND_TOP;  
   
404          WaitForSingleObject(g_mutex, INFINITE);          WaitForSingleObject(g_mutex, INFINITE);
405          g_blocked_zchange[0] = hwnd;          g_blocked_zchange[0] = hwnd;
406          g_blocked_zchange[1] = behind;          g_blocked_zchange[1] = behind;
407          ReleaseMutex(g_mutex);          ReleaseMutex(g_mutex);
408    
409            if (behind == NULL)
410                    behind = HWND_TOP;
411    
412          SetWindowPos(hwnd, behind, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);          SetWindowPos(hwnd, behind, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
413    
414          WaitForSingleObject(g_mutex, INFINITE);          WaitForSingleObject(g_mutex, INFINITE);

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

  ViewVC Help
Powered by ViewVC 1.1.26