/[rdesktop]/sourceforge.net/trunk/seamlessrdp/ServerExe/main.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/main.c

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

revision 1147 by ossman_, Thu Mar 16 14:54:02 2006 UTC revision 1160 by ossman_, Fri Mar 17 16:23:08 2006 UTC
# Line 49  typedef void (*remove_hooks_proc_t) (); Line 49  typedef void (*remove_hooks_proc_t) ();
49  typedef int (*get_instance_count_proc_t) ();  typedef int (*get_instance_count_proc_t) ();
50    
51  typedef void (*move_window_proc_t) (HWND hwnd, int x, int y, int width, int height);  typedef void (*move_window_proc_t) (HWND hwnd, int x, int y, int width, int height);
52    typedef void (*zchange_proc_t) (HWND hwnd, HWND behind);
53    typedef void (*focus_proc_t) (HWND hwnd);
54    typedef void (*set_state_proc_t) (HWND hwnd, int state);
55    
56  static move_window_proc_t g_move_window_fn = NULL;  static move_window_proc_t g_move_window_fn = NULL;
57    static zchange_proc_t g_zchange_fn = NULL;
58    static focus_proc_t g_focus_fn = NULL;
59    static set_state_proc_t g_set_state_fn = NULL;
60    
61  static void  static void
62  message(const char *text)  message(const char *text)
# Line 145  do_sync(void) Line 151  do_sync(void)
151  static void  static void
152  do_state(HWND hwnd, int state)  do_state(HWND hwnd, int state)
153  {  {
154          if (state == 0)          g_set_state_fn(hwnd, state);
                 ShowWindow(hwnd, SW_RESTORE);  
         else if (state == 1)  
                 ShowWindow(hwnd, SW_MINIMIZE);  
         else if (state == 2)  
                 ShowWindow(hwnd, SW_MAXIMIZE);  
         else  
                 debug("Invalid state %d sent.", state);  
155  }  }
156    
157  static void  static void
# Line 164  do_position(HWND hwnd, int x, int y, int Line 163  do_position(HWND hwnd, int x, int y, int
163  static void  static void
164  do_zchange(HWND hwnd, HWND behind)  do_zchange(HWND hwnd, HWND behind)
165  {  {
166          if (behind == NULL)          g_zchange_fn(hwnd, behind);
167                  behind = HWND_TOP;  }
168          SetWindowPos(hwnd, behind, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);  
169    static void
170    do_focus(HWND hwnd)
171    {
172            g_focus_fn(hwnd);
173  }  }
174    
175  static void  static void
# Line 200  process_cmds(void) Line 203  process_cmds(void)
203                                                                                           0));                                                                                           0));
204                  else if (strcmp(tok1, "ZCHANGE") == 0)                  else if (strcmp(tok1, "ZCHANGE") == 0)
205                          do_zchange((HWND) strtoul(tok2, NULL, 0), (HWND) strtoul(tok3, NULL, 0));                          do_zchange((HWND) strtoul(tok2, NULL, 0), (HWND) strtoul(tok3, NULL, 0));
206                    else if (strcmp(tok1, "FOCUS") == 0)
207                            do_focus((HWND) strtoul(tok2, NULL, 0));
208          }          }
209  }  }
210    
# Line 209  wndproc(HWND hwnd, UINT message, WPARAM Line 214  wndproc(HWND hwnd, UINT message, WPARAM
214          if (message == WM_WTSSESSION_CHANGE)          if (message == WM_WTSSESSION_CHANGE)
215          {          {
216                  if (wparam == WTS_REMOTE_CONNECT)                  if (wparam == WTS_REMOTE_CONNECT)
217                    {
218                            /* These get reset on each reconnect */
219                            SystemParametersInfo(SPI_SETDRAGFULLWINDOWS, TRUE, NULL, 0);
220                            SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, FALSE, NULL, 0);
221                          vchannel_write("HELLO,0x%08x", 1);                          vchannel_write("HELLO,0x%08x", 1);
222                    }
223          }          }
224    
225          return DefWindowProc(hwnd, message, wparam, lparam);          return DefWindowProc(hwnd, message, wparam, lparam);
# Line 272  WinMain(HINSTANCE instance, HINSTANCE pr Line 282  WinMain(HINSTANCE instance, HINSTANCE pr
282          remove_hooks_fn = (remove_hooks_proc_t) GetProcAddress(hookdll, "RemoveHooks");          remove_hooks_fn = (remove_hooks_proc_t) GetProcAddress(hookdll, "RemoveHooks");
283          instance_count_fn = (get_instance_count_proc_t) GetProcAddress(hookdll, "GetInstanceCount");          instance_count_fn = (get_instance_count_proc_t) GetProcAddress(hookdll, "GetInstanceCount");
284          g_move_window_fn = (move_window_proc_t) GetProcAddress(hookdll, "SafeMoveWindow");          g_move_window_fn = (move_window_proc_t) GetProcAddress(hookdll, "SafeMoveWindow");
285            g_zchange_fn = (zchange_proc_t) GetProcAddress(hookdll, "SafeZChange");
286            g_focus_fn = (focus_proc_t) GetProcAddress(hookdll, "SafeFocus");
287            g_set_state_fn = (set_state_proc_t) GetProcAddress(hookdll, "SafeSetState");
288    
289          if (!set_hooks_fn || !remove_hooks_fn || !instance_count_fn || !g_move_window_fn)          if (!set_hooks_fn || !remove_hooks_fn || !instance_count_fn || !g_move_window_fn
290                || !g_zchange_fn || !g_focus_fn || !g_set_state_fn)
291          {          {
292                  FreeLibrary(hookdll);                  FreeLibrary(hookdll);
293                  message("Hook DLL doesn't contain the correct functions. Unable to continue.");                  message("Hook DLL doesn't contain the correct functions. Unable to continue.");

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

  ViewVC Help
Powered by ViewVC 1.1.26