/[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 1093 by ossman_, Fri Mar 10 09:47:10 2006 UTC revision 1113 by ossman_, Fri Mar 10 16:40:57 2006 UTC
# Line 74  enum_cb(HWND hwnd, LPARAM lparam) Line 74  enum_cb(HWND hwnd, LPARAM lparam)
74          char title[150];          char title[150];
75          LONG styles;          LONG styles;
76          int state;          int state;
77            HWND parent;
78    
79          styles = GetWindowLong(hwnd, GWL_STYLE);          styles = GetWindowLong(hwnd, GWL_STYLE);
80    
81          if (!(styles & WS_VISIBLE))          if (!(styles & WS_VISIBLE))
82                  return TRUE;                  return TRUE;
83    
84          vchannel_write("CREATE,0x%p,0x%x", hwnd, 0);          if (styles & WS_POPUP)
85                    parent = (HWND) GetWindowLong(hwnd, GWL_HWNDPARENT);
86            else
87                    parent = NULL;
88    
89            vchannel_write("CREATE,0x%p,0x%p,0x%x", hwnd, parent, 0);
90    
91          if (!GetWindowRect(hwnd, &rect))          if (!GetWindowRect(hwnd, &rect))
92          {          {
# Line 94  enum_cb(HWND hwnd, LPARAM lparam) Line 100  enum_cb(HWND hwnd, LPARAM lparam)
100    
101          GetWindowText(hwnd, title, sizeof(title));          GetWindowText(hwnd, title, sizeof(title));
102    
103          /* FIXME: Strip title of dangerous characters */          vchannel_write("TITLE,0x%x,%s,0x%x", hwnd, vchannel_strfilter(title), 0);
104    
105          if (styles & WS_MAXIMIZE)          if (styles & WS_MAXIMIZE)
106                  state = 2;                  state = 2;
# Line 103  enum_cb(HWND hwnd, LPARAM lparam) Line 109  enum_cb(HWND hwnd, LPARAM lparam)
109          else          else
110                  state = 0;                  state = 0;
111    
112          vchannel_write("SETSTATE,0x%p,%s,0x%x,0x%x", hwnd, title, state, 0);          vchannel_write("STATE,0x%p,0x%x,0x%x", hwnd, state, 0);
113    
114          return TRUE;          return TRUE;
115  }  }
# Line 123  do_sync(void) Line 129  do_sync(void)
129  }  }
130    
131  static void  static void
132    do_state(HWND hwnd, int state)
133    {
134            if (state == 0)
135                    ShowWindow(hwnd, SW_RESTORE);
136            else if (state == 1)
137                    ShowWindow(hwnd, SW_MINIMIZE);
138            else if (state == 2)
139                    ShowWindow(hwnd, SW_MAXIMIZE);
140            else
141                    debug("Invalid state %d sent.", state);
142    }
143    
144    static void
145    do_position(HWND hwnd, int x, int y, int width, int height)
146    {
147            SetWindowPos(hwnd, NULL, x, y, width, height, SWP_NOACTIVATE | SWP_NOZORDER);
148    }
149    
150    static void
151    do_zchange(HWND hwnd, HWND behind)
152    {
153            if (behind == NULL)
154                    behind = HWND_TOP;
155            SetWindowPos(hwnd, behind, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
156    }
157    
158    static void
159  process_cmds(void)  process_cmds(void)
160  {  {
161          char line[VCHANNEL_MAX_LINE];          char line[VCHANNEL_MAX_LINE];
# Line 147  process_cmds(void) Line 180  process_cmds(void)
180    
181                  if (strcmp(tok1, "SYNC") == 0)                  if (strcmp(tok1, "SYNC") == 0)
182                          do_sync();                          do_sync();
183                    else if (strcmp(tok1, "STATE") == 0)
184                            do_state((HWND) strtol(tok2, NULL, 0), strtol(tok3, NULL, 0));
185                    else if (strcmp(tok1, "POSITION") == 0)
186                            do_position((HWND) strtol(tok2, NULL, 0), strtol(tok3, NULL, 0),
187                                        strtol(tok4, NULL, 0), strtol(tok5, NULL, 0), strtol(tok6, NULL,
188                                                                                             0));
189                    else if (strcmp(tok1, "ZCHANGE") == 0)
190                            do_zchange((HWND) strtol(tok2, NULL, 0), (HWND) strtol(tok3, NULL, 0));
191          }          }
192  }  }
193    

Legend:
Removed from v.1093  
changed lines
  Added in v.1113

  ViewVC Help
Powered by ViewVC 1.1.26