/[rdesktop]/sourceforge.net/trunk/seamlessrdp/ClientDLL/clipper.cpp
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/ClientDLL/clipper.cpp

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

revision 936 by astrand, Thu Jun 30 14:46:14 2005 UTC revision 937 by astrand, Fri Jul 1 06:50:52 2005 UTC
# Line 54  void WINAPI VirtualChannelOpenEvent(DWOR Line 54  void WINAPI VirtualChannelOpenEvent(DWOR
54    
55      if (OUTPUT_DEBUG_INFO == 1) {      if (OUTPUT_DEBUG_INFO == 1) {
56          OutputDebugString          OutputDebugString
57              ("TS WINDOW CLIPPER :: CLIENT DLL :: Info --> Virtual channel data received");          ("TS WINDOW CLIPPER :: CLIENT DLL :: Info --> Virtual channel data received");
58          OutputDebugString(ourData);          OutputDebugString(ourData);
59      }      }
60    
61      if (dataLength == totalLength) {      if (dataLength == totalLength) {
62          switch (event) {          switch (event) {
63          case CHANNEL_EVENT_DATA_RECEIVED:          case CHANNEL_EVENT_DATA_RECEIVED: {
             {  
64                  CTokenizer tok(_T((LPSTR) ourData), _T(";"));                  CTokenizer tok(_T((LPSTR) ourData), _T(";"));
65                  CStdString cs;                  CStdString cs;
66    
# Line 83  void WINAPI VirtualChannelOpenEvent(DWOR Line 82  void WINAPI VirtualChannelOpenEvent(DWOR
82                      if (strcmp(msg, "ID") == 0) {                      if (strcmp(msg, "ID") == 0) {
83                          msgTok.Next(msg);                          msgTok.Next(msg);
84                          wid->SetId(msg);                          wid->SetId(msg);
85                      }                      } else if (strcmp(msg, "TITLE") == 0) {
                     else if (strcmp(msg, "TITLE") == 0) {  
86                          msgTok.Next(msg);                          msgTok.Next(msg);
87                          wid->SetTitle(msg);                          wid->SetTitle(msg);
88                      }                      } else if (strcmp(msg, "POS") == 0) {
                     else if (strcmp(msg, "POS") == 0) {  
89                          msgTok.Next(msg);                          msgTok.Next(msg);
90    
91                          CStdString pos;                          CStdString pos;
# Line 102  void WINAPI VirtualChannelOpenEvent(DWOR Line 99  void WINAPI VirtualChannelOpenEvent(DWOR
99    
100                          if (strchr(pos, '-') == NULL) {                          if (strchr(pos, '-') == NULL) {
101                              wid->SetX1(atoi(pos));                              wid->SetX1(atoi(pos));
102                          }                          } else {
                         else {  
103                              wid->SetX1(0);                              wid->SetX1(0);
104                          }                          }
105    
# Line 111  void WINAPI VirtualChannelOpenEvent(DWOR Line 107  void WINAPI VirtualChannelOpenEvent(DWOR
107    
108                          if (strchr(pos, '-') == NULL) {                          if (strchr(pos, '-') == NULL) {
109                              wid->SetY1(atoi(pos));                              wid->SetY1(atoi(pos));
110                          }                          } else {
                         else {  
111                              wid->SetY1(0);                              wid->SetY1(0);
112                          }                          }
113    
# Line 120  void WINAPI VirtualChannelOpenEvent(DWOR Line 115  void WINAPI VirtualChannelOpenEvent(DWOR
115    
116                          if (strchr(pos, '-') == NULL) {                          if (strchr(pos, '-') == NULL) {
117                              wid->SetX2(atoi(pos));                              wid->SetX2(atoi(pos));
118                          }                          } else {
                         else {  
119                              wid->SetX2(0);                              wid->SetX2(0);
120                          }                          }
121    
# Line 129  void WINAPI VirtualChannelOpenEvent(DWOR Line 123  void WINAPI VirtualChannelOpenEvent(DWOR
123    
124                          if (strchr(pos, '-') == NULL) {                          if (strchr(pos, '-') == NULL) {
125                              wid->SetY2(atoi(pos));                              wid->SetY2(atoi(pos));
126                          }                          } else {
                         else {  
127                              wid->SetY2(0);                              wid->SetY2(0);
128                          }                          }
129                      }                      } else if (strcmp(msg, "TYPE") == 0) {
                     else if (strcmp(msg, "TYPE") == 0) {  
130                          msgTok.Next(msg);                          msgTok.Next(msg);
131                          mixMaxType = atoi(msg);                          mixMaxType = atoi(msg);
132                      }                      }
# Line 143  void WINAPI VirtualChannelOpenEvent(DWOR Line 135  void WINAPI VirtualChannelOpenEvent(DWOR
135                  if (strcmp(messageType, "HSHELL_WINDOWCREATED") == 0) {                  if (strcmp(messageType, "HSHELL_WINDOWCREATED") == 0) {
136                      if (OUTPUT_DEBUG_INFO == 1) {                      if (OUTPUT_DEBUG_INFO == 1) {
137                          OutputDebugString                          OutputDebugString
138                              ("TS WINDOW CLIPPER :: CLIENT DLL :: Info --> Message was of type HSHELL_WINDOWCREATED window title is:");                          ("TS WINDOW CLIPPER :: CLIENT DLL :: Info --> Message was of type HSHELL_WINDOWCREATED window title is:");
139                          OutputDebugString(wid->GetTitle());                          OutputDebugString(wid->GetTitle());
140                      }                      }
141    
# Line 157  void WINAPI VirtualChannelOpenEvent(DWOR Line 149  void WINAPI VirtualChannelOpenEvent(DWOR
149                      CreateAndShowWindow(wid);                      CreateAndShowWindow(wid);
150    
151                      DoClipping(1);                      DoClipping(1);
152                  }                  } else if (strcmp(messageType, "HSHELL_WINDOWDESTROYED") == 0) {
                 else if (strcmp(messageType, "HSHELL_WINDOWDESTROYED") == 0) {  
153                      if (OUTPUT_DEBUG_INFO == 1) {                      if (OUTPUT_DEBUG_INFO == 1) {
154                          OutputDebugString                          OutputDebugString
155                              ("TS WINDOW CLIPPER :: CLIENT DLL :: Info --> Message was of type HSHELL_WINDOWDISTROYED window title is:");                          ("TS WINDOW CLIPPER :: CLIENT DLL :: Info --> Message was of type HSHELL_WINDOWDISTROYED window title is:");
156                          OutputDebugString(wid->GetTitle());                          OutputDebugString(wid->GetTitle());
157                      }                      }
158    
# Line 178  void WINAPI VirtualChannelOpenEvent(DWOR Line 169  void WINAPI VirtualChannelOpenEvent(DWOR
169                      delete oldWinData;                      delete oldWinData;
170    
171                      DoClipping(1);                      DoClipping(1);
172                  }                  } else if (strcmp(messageType, "HCBT_MINMAX") == 0) {
                 else if (strcmp(messageType, "HCBT_MINMAX") == 0) {  
173                      if (OUTPUT_DEBUG_INFO == 1) {                      if (OUTPUT_DEBUG_INFO == 1) {
174                          OutputDebugString                          OutputDebugString
175                              ("TS WINDOW CLIPPER :: CLIENT DLL :: Info --> Message was of type HCBT_MINMAX");                          ("TS WINDOW CLIPPER :: CLIENT DLL :: Info --> Message was of type HCBT_MINMAX");
176                      }                      }
177    
178    
179                      //TODO                      //TODO
180    
181                  }                  } else if (strcmp(messageType, "HCBT_MOVESIZE") == 0) {
                 else if (strcmp(messageType, "HCBT_MOVESIZE") == 0) {  
182                      if (OUTPUT_DEBUG_INFO == 1) {                      if (OUTPUT_DEBUG_INFO == 1) {
183                          OutputDebugString                          OutputDebugString
184                              ("TS WINDOW CLIPPER :: CLIENT DLL :: Info --> Message was of type HCBT_MOVESIZE window title is:");                          ("TS WINDOW CLIPPER :: CLIENT DLL :: Info --> Message was of type HCBT_MOVESIZE window title is:");
185                          OutputDebugString(wid->GetTitle());                          OutputDebugString(wid->GetTitle());
186                      }                      }
187    
# Line 214  void WINAPI VirtualChannelOpenEvent(DWOR Line 203  void WINAPI VirtualChannelOpenEvent(DWOR
203                      }                      }
204    
205                      delete wid;                      delete wid;
206                  }                  } else if (strcmp(messageType, "CALLWNDPROC_WM_MOVING") == 0) {
                 else if (strcmp(messageType, "CALLWNDPROC_WM_MOVING") == 0) {  
207                      if (OUTPUT_DEBUG_INFO == 1) {                      if (OUTPUT_DEBUG_INFO == 1) {
208                          OutputDebugString                          OutputDebugString
209                              ("TS WINDOW CLIPPER :: CLIENT DLL :: Info --> Message was of type CALLWNDPROC_WM_MOVING window title is:");                          ("TS WINDOW CLIPPER :: CLIENT DLL :: Info --> Message was of type CALLWNDPROC_WM_MOVING window title is:");
210                          OutputDebugString(wid->GetTitle());                          OutputDebugString(wid->GetTitle());
211                      }                      }
212    
# Line 245  void WINAPI VirtualChannelOpenEvent(DWOR Line 233  void WINAPI VirtualChannelOpenEvent(DWOR
233              }              }
234              break;              break;
235    
236          case CHANNEL_EVENT_WRITE_COMPLETE:          case CHANNEL_EVENT_WRITE_COMPLETE: {}
             {  
             }  
237              break;              break;
238    
239          case CHANNEL_EVENT_WRITE_CANCELLED:          case CHANNEL_EVENT_WRITE_CANCELLED: {}
             {  
             }  
240              break;              break;
241    
242          default:          default: {}
             {  
             }  
243              break;              break;
244          }          }
245      }      } else {}
     else {  
     }  
246  }  }
247    
248    
249  VOID VCAPITYPE VirtualChannelInitEventProc(LPVOID pInitHandle, UINT event,  VOID VCAPITYPE VirtualChannelInitEventProc(LPVOID pInitHandle, UINT event,
250                                             LPVOID pData, UINT dataLength)          LPVOID pData, UINT dataLength)
251  {  {
252      UINT ui;      UINT ui;
253    
# Line 275  VOID VCAPITYPE VirtualChannelInitEventPr Line 255  VOID VCAPITYPE VirtualChannelInitEventPr
255      UNREFERENCED_PARAMETER(dataLength);      UNREFERENCED_PARAMETER(dataLength);
256    
257      switch (event) {      switch (event) {
258      case CHANNEL_EVENT_INITIALIZED:      case CHANNEL_EVENT_INITIALIZED: {}
         {  
         }  
259          break;          break;
260    
261      case CHANNEL_EVENT_CONNECTED:      case CHANNEL_EVENT_CONNECTED: {
         {  
262              //              //
263              // open channel              // open channel
264              //              //
# Line 291  VOID VCAPITYPE VirtualChannelInitEventPr Line 268  VOID VCAPITYPE VirtualChannelInitEventPr
268                                                      (PCHANNEL_OPEN_EVENT_FN)                                                      (PCHANNEL_OPEN_EVENT_FN)
269                                                      VirtualChannelOpenEvent);                                                      VirtualChannelOpenEvent);
270    
271              if (ui == CHANNEL_RC_OK) {              if (ui == CHANNEL_RC_OK) {}
   
             }  
272              else {              else {
273                  MessageBox(NULL, TEXT("Open of RDP virtual channel failed"),                  MessageBox(NULL, TEXT("Open of RDP virtual channel failed"),
274                             TEXT("TS Window Clipper"), MB_OK);                             TEXT("TS Window Clipper"), MB_OK);
# Line 305  VOID VCAPITYPE VirtualChannelInitEventPr Line 280  VOID VCAPITYPE VirtualChannelInitEventPr
280          }          }
281          break;          break;
282    
283      case CHANNEL_EVENT_V1_CONNECTED:      case CHANNEL_EVENT_V1_CONNECTED: {
         {  
284              MessageBox(NULL,              MessageBox(NULL,
285                         TEXT                         TEXT
286                         ("Connecting to a non Windows 2000 Terminal Server"),                         ("Connecting to a non Windows 2000 Terminal Server"),
# Line 314  VOID VCAPITYPE VirtualChannelInitEventPr Line 288  VOID VCAPITYPE VirtualChannelInitEventPr
288          }          }
289          break;          break;
290    
291      case CHANNEL_EVENT_DISCONNECTED:      case CHANNEL_EVENT_DISCONNECTED: {}
         {  
   
         }  
292          break;          break;
293    
294      case CHANNEL_EVENT_TERMINATED:      case CHANNEL_EVENT_TERMINATED: {
         {  
295              //              //
296              // free the entry points table              // free the entry points table
297              //              //
# Line 329  VOID VCAPITYPE VirtualChannelInitEventPr Line 299  VOID VCAPITYPE VirtualChannelInitEventPr
299          }          }
300          break;          break;
301    
302      default:      default: {}
         {  
   
         }  
303          break;          break;
304      }      }
305  }  }
# Line 373  BOOL VCAPITYPE VirtualChannelEntry(PCHAN Line 340  BOOL VCAPITYPE VirtualChannelEntry(PCHAN
340          if (ALWAYS__CLIP) {          if (ALWAYS__CLIP) {
341              DoClipping(1);              DoClipping(1);
342          }          }
343      }      } else {
     else {  
344          MessageBox(NULL, TEXT("RDP Virtual channel Init Failed"),          MessageBox(NULL, TEXT("RDP Virtual channel Init Failed"),
345                     TEXT("TS Window Clipper"), MB_OK);                     TEXT("TS Window Clipper"), MB_OK);
346      }      }
# Line 403  typedef struct _WindowFromProcessOrThrea Line 369  typedef struct _WindowFromProcessOrThrea
369          DWORD threadId;          DWORD threadId;
370      };      };
371      HWND hWnd;      HWND hWnd;
372  } Wnd4PTID;  }
373    Wnd4PTID;
374    
375  // Callback procedure  // Callback procedure
376  BOOL CALLBACK PrivateEnumWindowsProc(HWND hwnd, LPARAM lParam)  BOOL CALLBACK PrivateEnumWindowsProc(HWND hwnd, LPARAM lParam)
# Line 432  HWND FindProcessMainWindow(DWORD procId) Line 399  HWND FindProcessMainWindow(DWORD procId)
399      Wnd4PTID tempWnd4ID;      Wnd4PTID tempWnd4ID;
400      tempWnd4ID.procId = procId;      tempWnd4ID.procId = procId;
401      if (!EnumWindows      if (!EnumWindows
402          ((WNDENUMPROC) PrivateEnumWindowsProc, (LPARAM) & tempWnd4ID)) {              ((WNDENUMPROC) PrivateEnumWindowsProc, (LPARAM) & tempWnd4ID)) {
403    
404          if (OUTPUT_DEBUG_INFO == 1) {          if (OUTPUT_DEBUG_INFO == 1) {
405              OutputDebugString              OutputDebugString
406                  ("TS WINDOW CLIPPER :: CLIENT DLL :: Info --> Found main process window");              ("TS WINDOW CLIPPER :: CLIENT DLL :: Info --> Found main process window");
407          }          }
408    
409          return tempWnd4ID.hWnd;          return tempWnd4ID.hWnd;
# Line 445  HWND FindProcessMainWindow(DWORD procId) Line 412  HWND FindProcessMainWindow(DWORD procId)
412    
413      if (OUTPUT_DEBUG_INFO == 1) {      if (OUTPUT_DEBUG_INFO == 1) {
414          OutputDebugString          OutputDebugString
415              ("TS WINDOW CLIPPER :: CLIENT DLL :: Info --> Could not find main process window");          ("TS WINDOW CLIPPER :: CLIENT DLL :: Info --> Could not find main process window");
416      }      }
417    
418      return NULL;      return NULL;
# Line 478  void DoClipping(int forceRedraw) Line 445  void DoClipping(int forceRedraw)
445    
446          if (OUTPUT_DEBUG_INFO == 1) {          if (OUTPUT_DEBUG_INFO == 1) {
447              OutputDebugString              OutputDebugString
448                  ("TS WINDOW CLIPPER :: CLIENT DLL :: Info --> Restarting clipping...");              ("TS WINDOW CLIPPER :: CLIENT DLL :: Info --> Restarting clipping...");
449          }          }
450    
451          m_regionResult = NULL;          m_regionResult = NULL;
452    
453          if (OUTPUT_WINDOW_TABLE_DEBUG_INFO == 1) {          if (OUTPUT_WINDOW_TABLE_DEBUG_INFO == 1) {
454              OutputDebugString              OutputDebugString
455                  ("-----------------------------------------------------------------------------");              ("-----------------------------------------------------------------------------");
456              OutputDebugString              OutputDebugString
457                  ("TS WINDOW CLIPPER :: CLIENT DLL :: Info --> starting printing of window table");              ("TS WINDOW CLIPPER :: CLIENT DLL :: Info --> starting printing of window table");
458          }          }
459    
460          //enumerate though hashtable          //enumerate though hashtable
# Line 497  void DoClipping(int forceRedraw) Line 464  void DoClipping(int forceRedraw)
464    
465          if (OUTPUT_WINDOW_TABLE_DEBUG_INFO == 1) {          if (OUTPUT_WINDOW_TABLE_DEBUG_INFO == 1) {
466              OutputDebugString              OutputDebugString
467                  ("TS WINDOW CLIPPER :: CLIENT DLL :: Info --> finished printing of window table");              ("TS WINDOW CLIPPER :: CLIENT DLL :: Info --> finished printing of window table");
468              OutputDebugString              OutputDebugString
469                  ("-----------------------------------------------------------------------------");              ("-----------------------------------------------------------------------------");
470          }          }
471    
472          if (m_regionResult == NULL) {          if (m_regionResult == NULL) {
473              if (ALWAYS__CLIP) {              if (ALWAYS__CLIP) {
474                  m_regionResult = CreateRectRgn(0, 0, 0, 0);                  m_regionResult = CreateRectRgn(0, 0, 0, 0);
475              }              } else {
             else {  
476                  m_regionResult =                  m_regionResult =
477                      CreateRectRgn(0, 0, wRect.right, wRect.bottom);                      CreateRectRgn(0, 0, wRect.right, wRect.bottom);
478              }              }
# Line 519  void DoClipping(int forceRedraw) Line 485  void DoClipping(int forceRedraw)
485              RedrawWindow(m_mainWindowHandle, NULL, NULL,              RedrawWindow(m_mainWindowHandle, NULL, NULL,
486                           RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN);                           RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN);
487          }          }
488      }      } else {
     else {  
489          if (OUTPUT_DEBUG_INFO == 1) {          if (OUTPUT_DEBUG_INFO == 1) {
490              OutputDebugString              OutputDebugString
491                  ("TS WINDOW CLIPPER :: CLIENT DLL :: Info --> Coulf not find window to clip");              ("TS WINDOW CLIPPER :: CLIENT DLL :: Info --> Coulf not find window to clip");
492          }          }
493      }      }
494  }  }
# Line 545  void CreateRegionFromWindowData(char *ke Line 510  void CreateRegionFromWindowData(char *ke
510    
511      if (OUTPUT_DEBUG_INFO == 1 && OUTPUT_WINDOW_TABLE_DEBUG_INFO != 1) {      if (OUTPUT_DEBUG_INFO == 1 && OUTPUT_WINDOW_TABLE_DEBUG_INFO != 1) {
512          OutputDebugString          OutputDebugString
513              ("TS WINDOW CLIPPER :: CLIENT DLL :: Info --> Adding this window to cliping region");          ("TS WINDOW CLIPPER :: CLIENT DLL :: Info --> Adding this window to cliping region");
514          OutputDebugString(wd->GetTitle());          OutputDebugString(wd->GetTitle());
515      }      }
516      if (OUTPUT_WINDOW_TABLE_DEBUG_INFO == 1) {      if (OUTPUT_WINDOW_TABLE_DEBUG_INFO == 1) {
# Line 572  void CreateRegionFromWindowData(char *ke Line 537  void CreateRegionFromWindowData(char *ke
537    
538  /*  /*
539     Dummy procedure to catch when window is being maximised.     Dummy procedure to catch when window is being maximised.
540    
541     Need to tell the window on the server to do the same.     Need to tell the window on the server to do the same.
542   */   */
543  LRESULT CALLBACK DummyWindowCallbackProc(HWND hwnd, UINT uMsg, WPARAM wParam,  LRESULT CALLBACK DummyWindowCallbackProc(HWND hwnd, UINT uMsg, WPARAM wParam,
544                                           LPARAM lParam)          LPARAM lParam)
545  {  {
546      //TODO      //TODO
547    

Legend:
Removed from v.936  
changed lines
  Added in v.937

  ViewVC Help
Powered by ViewVC 1.1.26