/[rdesktop]/sourceforge.net/branches/seamlessrdp-branch/rdesktop/seamless.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/branches/seamlessrdp-branch/rdesktop/seamless.c

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

revision 1110 by astrand, Fri Mar 10 15:19:52 2006 UTC revision 1157 by astrand, Fri Mar 17 12:39:09 2006 UTC
# Line 67  seamless_process_line(const char *line, Line 67  seamless_process_line(const char *line,
67          l = xstrdup(line);          l = xstrdup(line);
68          p = l;          p = l;
69    
70          DEBUG_SEAMLESS(("seamlessrdp line:%s\n", p));          DEBUG_SEAMLESS(("seamlessrdp got:%s\n", p));
   
         if (!g_seamless_rdp)  
                 return True;  
71    
72          tok1 = seamless_get_token(&p);          tok1 = seamless_get_token(&p);
73          tok2 = seamless_get_token(&p);          tok2 = seamless_get_token(&p);
# Line 87  seamless_process_line(const char *line, Line 84  seamless_process_line(const char *line,
84                  if (!tok4)                  if (!tok4)
85                          return False;                          return False;
86    
87                  id = strtol(tok2, &endptr, 0);                  id = strtoul(tok2, &endptr, 0);
88                  if (*endptr)                  if (*endptr)
89                          return False;                          return False;
90    
91                  parent = strtol(tok3, &endptr, 0);                  parent = strtoul(tok3, &endptr, 0);
92                  if (*endptr)                  if (*endptr)
93                          return False;                          return False;
94    
95                  flags = strtol(tok4, &endptr, 0);                  flags = strtoul(tok4, &endptr, 0);
96                  if (*endptr)                  if (*endptr)
97                          return False;                          return False;
98    
# Line 106  seamless_process_line(const char *line, Line 103  seamless_process_line(const char *line,
103                  if (!tok3)                  if (!tok3)
104                          return False;                          return False;
105    
106                  id = strtol(tok2, &endptr, 0);                  id = strtoul(tok2, &endptr, 0);
107                  if (*endptr)                  if (*endptr)
108                          return False;                          return False;
109    
110                  flags = strtol(tok3, &endptr, 0);                  flags = strtoul(tok3, &endptr, 0);
111                  if (*endptr)                  if (*endptr)
112                          return False;                          return False;
113    
# Line 128  seamless_process_line(const char *line, Line 125  seamless_process_line(const char *line,
125                  if (!tok7)                  if (!tok7)
126                          return False;                          return False;
127    
128                  id = strtol(tok2, &endptr, 0);                  id = strtoul(tok2, &endptr, 0);
129                  if (*endptr)                  if (*endptr)
130                          return False;                          return False;
131    
# Line 146  seamless_process_line(const char *line, Line 143  seamless_process_line(const char *line,
143                  if (*endptr)                  if (*endptr)
144                          return False;                          return False;
145    
146                  flags = strtol(tok7, &endptr, 0);                  flags = strtoul(tok7, &endptr, 0);
147                  if (*endptr)                  if (*endptr)
148                          return False;                          return False;
149    
# Line 154  seamless_process_line(const char *line, Line 151  seamless_process_line(const char *line,
151          }          }
152          else if (!strcmp("ZCHANGE", tok1))          else if (!strcmp("ZCHANGE", tok1))
153          {          {
154                  unimpl("SeamlessRDP ZCHANGE1\n");                  unsigned long behind;
155    
156                    id = strtoul(tok2, &endptr, 0);
157                    if (*endptr)
158                            return False;
159    
160                    behind = strtoul(tok3, &endptr, 0);
161                    if (*endptr)
162                            return False;
163    
164                    flags = strtoul(tok4, &endptr, 0);
165                    if (*endptr)
166                            return False;
167    
168                    ui_seamless_restack_window(id, behind, flags);
169          }          }
170          else if (!strcmp("TITLE", tok1))          else if (!strcmp("TITLE", tok1))
171          {          {
172                  if (!tok4)                  if (!tok4)
173                          return False;                          return False;
174    
175                  id = strtol(tok2, &endptr, 0);                  id = strtoul(tok2, &endptr, 0);
176                  if (*endptr)                  if (*endptr)
177                          return False;                          return False;
178    
179                  flags = strtol(tok4, &endptr, 0);                  flags = strtoul(tok4, &endptr, 0);
180                  if (*endptr)                  if (*endptr)
181                          return False;                          return False;
182    
# Line 178  seamless_process_line(const char *line, Line 189  seamless_process_line(const char *line,
189                  if (!tok4)                  if (!tok4)
190                          return False;                          return False;
191    
192                  id = strtol(tok2, &endptr, 0);                  id = strtoul(tok2, &endptr, 0);
193                  if (*endptr)                  if (*endptr)
194                          return False;                          return False;
195    
196                  state = strtol(tok3, &endptr, 0);                  state = strtoul(tok3, &endptr, 0);
197                  if (*endptr)                  if (*endptr)
198                          return False;                          return False;
199    
200                  flags = strtol(tok4, &endptr, 0);                  flags = strtoul(tok4, &endptr, 0);
201                  if (*endptr)                  if (*endptr)
202                          return False;                          return False;
203    
# Line 196  seamless_process_line(const char *line, Line 207  seamless_process_line(const char *line,
207          {          {
208                  printf("SeamlessRDP:%s\n", line);                  printf("SeamlessRDP:%s\n", line);
209          }          }
210            else if (!strcmp("SYNCBEGIN", tok1))
211            {
212                    if (!tok2)
213                            return False;
214    
215                    flags = strtoul(tok2, &endptr, 0);
216                    if (*endptr)
217                            return False;
218    
219                    ui_seamless_syncbegin(flags);
220            }
221            else if (!strcmp("SYNCEND", tok1))
222            {
223                    if (!tok2)
224                            return False;
225    
226                    flags = strtoul(tok2, &endptr, 0);
227                    if (*endptr)
228                            return False;
229    
230                    /* do nothing, currently */
231            }
232            else if (!strcmp("HELLO", tok1))
233            {
234                    if (!tok2)
235                            return False;
236    
237                    flags = strtoul(tok2, &endptr, 0);
238                    if (*endptr)
239                            return False;
240    
241                    ui_seamless_begin();
242            }
243    
244    
245          xfree(l);          xfree(l);
246          return True;          return True;
# Line 238  seamless_process(STREAM s) Line 283  seamless_process(STREAM s)
283  BOOL  BOOL
284  seamless_init(void)  seamless_init(void)
285  {  {
286            if (!g_seamless_rdp)
287                    return False;
288    
289          seamless_channel =          seamless_channel =
290                  channel_register("seamrdp", CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP,                  channel_register("seamrdp", CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP,
291                                   seamless_process);                                   seamless_process);
# Line 260  seamless_send(const char *format, ...) Line 308  seamless_send(const char *format, ...)
308          s = channel_init(seamless_channel, len);          s = channel_init(seamless_channel, len);
309          out_uint8p(s, buf, len) s_mark_end(s);          out_uint8p(s, buf, len) s_mark_end(s);
310    
311            DEBUG_SEAMLESS(("SeamlessRDP sending:%s", buf));
312    
313  #if 0  #if 0
314          printf("seamless send:\n");          printf("seamless send:\n");
315          hexdump(s->channel_hdr + 8, s->end - s->channel_hdr - 8);          hexdump(s->channel_hdr + 8, s->end - s->channel_hdr - 8);
# Line 272  seamless_send(const char *format, ...) Line 322  seamless_send(const char *format, ...)
322  void  void
323  seamless_send_sync()  seamless_send_sync()
324  {  {
325            if (!g_seamless_rdp)
326                    return;
327    
328          seamless_send("SYNC\n");          seamless_send("SYNC\n");
329  }  }
330    
# Line 279  seamless_send_sync() Line 332  seamless_send_sync()
332  void  void
333  seamless_send_state(unsigned long id, unsigned int state, unsigned long flags)  seamless_send_state(unsigned long id, unsigned int state, unsigned long flags)
334  {  {
335            if (!g_seamless_rdp)
336                    return;
337    
338            seamless_send("STATE,0x%08lx,0x%x,0x%lx\n", id, state, flags);
339    }
340    
341    
342    void
343    seamless_send_position(unsigned long id, int x, int y, int width, int height, unsigned long flags)
344    {
345            seamless_send("POSITION,0x%08lx,%d,%d,%d,%d,0x%lx\n", id, x, y, width, height, flags);
346    }
347    
348    
349    /* Update select timeout */
350    void
351    seamless_select_timeout(struct timeval *tv)
352    {
353            struct timeval ourtimeout = { 0, SEAMLESSRDP_POSITION_TIMER };
354    
355            if (g_seamless_rdp)
356            {
357                    if (timercmp(&ourtimeout, tv, <))
358                    {
359                            tv->tv_sec = ourtimeout.tv_sec;
360                            tv->tv_usec = ourtimeout.tv_usec;
361                    }
362            }
363    }
364    
365    
366    void
367    seamless_send_zchange(unsigned long id, unsigned long below, unsigned long flags)
368    {
369            if (!g_seamless_rdp)
370                    return;
371    
372            seamless_send("ZCHANGE,0x%08lx,0x%08lx,0x%lx\n", id, below, flags);
373    }
374    
375    
376    void
377    seamless_send_focus(unsigned long id, unsigned long flags)
378    {
379            if (!g_seamless_rdp)
380                    return;
381    
382          DEBUG_SEAMLESS(("sending STATE,0x%p,0x%x,0x%x\n", id, state, flags));          seamless_send("FOCUS,0x%08lx,0x%lx\n", id, flags);
         seamless_send("STATE,0x%p,0x%x,0x%x", id, state, flags);  
383  }  }

Legend:
Removed from v.1110  
changed lines
  Added in v.1157

  ViewVC Help
Powered by ViewVC 1.1.26