1 |
/* -*- c-basic-offset: 8 -*- |
/* -*- c-basic-offset: 8 -*- |
2 |
rdesktop: A Remote Desktop Protocol client. |
rdesktop: A Remote Desktop Protocol client. |
3 |
Seamless Windows support |
Seamless Windows support |
4 |
Copyright (C) Peter Astrand <astrand@cendio.se> 2005-2006 |
Copyright 2005-2007 Peter Astrand <astrand@cendio.se> for Cendio AB |
5 |
|
Copyright 2007 Pierre Ossman <ossman@cendio.se> for Cendio AB |
6 |
|
|
7 |
This program is free software; you can redistribute it and/or modify |
This program is free software; you can redistribute it and/or modify |
8 |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
9 |
the Free Software Foundation; either version 2 of the License, or |
the Free Software Foundation; either version 2 of the License, or |
10 |
(at your option) any later version. |
(at your option) any later version. |
11 |
|
|
12 |
This program is distributed in the hope that it will be useful, |
This program is distributed in the hope that it will be useful, |
13 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
GNU General Public License for more details. |
GNU General Public License for more details. |
16 |
|
|
17 |
You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License |
18 |
along with this program; if not, write to the Free Software |
along with this program; if not, write to the Free Software |
19 |
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
23 |
#include <stdarg.h> |
#include <stdarg.h> |
24 |
#include <assert.h> |
#include <assert.h> |
25 |
|
|
|
/* #define WITH_DEBUG_SEAMLESS */ |
|
|
|
|
26 |
#ifdef WITH_DEBUG_SEAMLESS |
#ifdef WITH_DEBUG_SEAMLESS |
27 |
#define DEBUG_SEAMLESS(args) printf args; |
#define DEBUG_SEAMLESS(args) printf args; |
28 |
#else |
#else |
29 |
#define DEBUG_SEAMLESS(args) |
#define DEBUG_SEAMLESS(args) |
30 |
#endif |
#endif |
31 |
|
|
32 |
extern BOOL g_seamless_rdp; |
extern RD_BOOL g_seamless_rdp; |
33 |
static VCHANNEL *seamless_channel; |
static VCHANNEL *seamless_channel; |
34 |
static unsigned int seamless_serial; |
static unsigned int seamless_serial; |
35 |
|
static char icon_buf[1024]; |
36 |
|
|
37 |
static char * |
static char * |
38 |
seamless_get_token(char **s) |
seamless_get_token(char **s) |
58 |
} |
} |
59 |
|
|
60 |
|
|
61 |
static BOOL |
static RD_BOOL |
62 |
seamless_process_line(const char *line, void *data) |
seamless_process_line(const char *line, void *data) |
63 |
{ |
{ |
64 |
char *p, *l; |
char *p, *l; |
120 |
ui_seamless_destroy_window(id, flags); |
ui_seamless_destroy_window(id, flags); |
121 |
|
|
122 |
} |
} |
123 |
|
else if (!strcmp("DESTROYGRP", tok1)) |
124 |
|
{ |
125 |
|
if (!tok4) |
126 |
|
return False; |
127 |
|
|
128 |
|
id = strtoul(tok3, &endptr, 0); |
129 |
|
if (*endptr) |
130 |
|
return False; |
131 |
|
|
132 |
|
flags = strtoul(tok4, &endptr, 0); |
133 |
|
if (*endptr) |
134 |
|
return False; |
135 |
|
|
136 |
|
ui_seamless_destroy_group(id, flags); |
137 |
|
} |
138 |
else if (!strcmp("SETICON", tok1)) |
else if (!strcmp("SETICON", tok1)) |
139 |
{ |
{ |
140 |
unimpl("SeamlessRDP SETICON1\n"); |
int chunk, width, height, len; |
141 |
|
char byte[3]; |
142 |
|
|
143 |
|
if (!tok8) |
144 |
|
return False; |
145 |
|
|
146 |
|
id = strtoul(tok3, &endptr, 0); |
147 |
|
if (*endptr) |
148 |
|
return False; |
149 |
|
|
150 |
|
chunk = strtoul(tok4, &endptr, 0); |
151 |
|
if (*endptr) |
152 |
|
return False; |
153 |
|
|
154 |
|
width = strtoul(tok6, &endptr, 0); |
155 |
|
if (*endptr) |
156 |
|
return False; |
157 |
|
|
158 |
|
height = strtoul(tok7, &endptr, 0); |
159 |
|
if (*endptr) |
160 |
|
return False; |
161 |
|
|
162 |
|
byte[2] = '\0'; |
163 |
|
len = 0; |
164 |
|
while (*tok8 != '\0') |
165 |
|
{ |
166 |
|
byte[0] = *tok8; |
167 |
|
tok8++; |
168 |
|
if (*tok8 == '\0') |
169 |
|
return False; |
170 |
|
byte[1] = *tok8; |
171 |
|
tok8++; |
172 |
|
|
173 |
|
icon_buf[len] = strtol(byte, NULL, 16); |
174 |
|
len++; |
175 |
|
} |
176 |
|
|
177 |
|
ui_seamless_seticon(id, tok5, width, height, chunk, icon_buf, len); |
178 |
|
} |
179 |
|
else if (!strcmp("DELICON", tok1)) |
180 |
|
{ |
181 |
|
int width, height; |
182 |
|
|
183 |
|
if (!tok6) |
184 |
|
return False; |
185 |
|
|
186 |
|
id = strtoul(tok3, &endptr, 0); |
187 |
|
if (*endptr) |
188 |
|
return False; |
189 |
|
|
190 |
|
width = strtoul(tok5, &endptr, 0); |
191 |
|
if (*endptr) |
192 |
|
return False; |
193 |
|
|
194 |
|
height = strtoul(tok6, &endptr, 0); |
195 |
|
if (*endptr) |
196 |
|
return False; |
197 |
|
|
198 |
|
ui_seamless_delicon(id, tok4, width, height); |
199 |
} |
} |
200 |
else if (!strcmp("POSITION", tok1)) |
else if (!strcmp("POSITION", tok1)) |
201 |
{ |
{ |
358 |
} |
} |
359 |
|
|
360 |
|
|
361 |
static BOOL |
static RD_BOOL |
362 |
seamless_line_handler(const char *line, void *data) |
seamless_line_handler(const char *line, void *data) |
363 |
{ |
{ |
364 |
if (!seamless_process_line(line, data)) |
if (!seamless_process_line(line, data)) |
391 |
} |
} |
392 |
|
|
393 |
|
|
394 |
BOOL |
RD_BOOL |
395 |
seamless_init(void) |
seamless_init(void) |
396 |
{ |
{ |
397 |
if (!g_seamless_rdp) |
if (!g_seamless_rdp) |