23 |
#include <unistd.h> |
#include <unistd.h> |
24 |
#include <time.h> |
#include <time.h> |
25 |
#include <errno.h> |
#include <errno.h> |
26 |
|
#include <strings.h> |
27 |
#include "rdesktop.h" |
#include "rdesktop.h" |
28 |
#include "xproto.h" |
#include "xproto.h" |
29 |
|
|
64 |
|
|
65 |
/* software backing store */ |
/* software backing store */ |
66 |
static BOOL g_ownbackstore; |
static BOOL g_ownbackstore; |
67 |
static Pixmap g_backstore = NULL; |
static Pixmap g_backstore = 0; |
68 |
|
|
69 |
/* Moving in single app mode */ |
/* Moving in single app mode */ |
70 |
static BOOL g_moving_wnd; |
static BOOL g_moving_wnd; |
895 |
if (g_gc == NULL) |
if (g_gc == NULL) |
896 |
g_gc = XCreateGC(g_display, g_wnd, 0, NULL); |
g_gc = XCreateGC(g_display, g_wnd, 0, NULL); |
897 |
|
|
898 |
if ((g_ownbackstore) && (g_backstore == NULL)) |
if ((g_ownbackstore) && (g_backstore == 0)) |
899 |
{ |
{ |
900 |
g_backstore = XCreatePixmap(g_display, g_wnd, g_width, g_height, g_depth); |
g_backstore = XCreatePixmap(g_display, g_wnd, g_width, g_height, g_depth); |
901 |
|
|
1272 |
int |
int |
1273 |
ui_select(int rdp_socket) |
ui_select(int rdp_socket) |
1274 |
{ |
{ |
1275 |
int n = (rdp_socket > g_x_socket) ? rdp_socket + 1 : g_x_socket + 1; |
int n = (rdp_socket > g_x_socket) ? rdp_socket : g_x_socket; |
1276 |
fd_set rfds, wfds; |
fd_set rfds, wfds; |
1277 |
|
struct timeval tv; |
1278 |
|
BOOL s_timeout = False; |
1279 |
|
|
1280 |
while (True) |
while (True) |
1281 |
{ |
{ |
1294 |
if (g_dsp_busy) |
if (g_dsp_busy) |
1295 |
{ |
{ |
1296 |
FD_SET(g_dsp_fd, &wfds); |
FD_SET(g_dsp_fd, &wfds); |
1297 |
n = (g_dsp_fd + 1 > n) ? g_dsp_fd + 1 : n; |
n = (g_dsp_fd > n) ? g_dsp_fd : n; |
1298 |
} |
} |
1299 |
#endif |
#endif |
1300 |
|
/* default timeout */ |
1301 |
|
tv.tv_sec = 60; |
1302 |
|
tv.tv_usec = 0; |
1303 |
|
|
1304 |
switch (select(n, &rfds, &wfds, NULL, NULL)) |
/* add redirection handles */ |
1305 |
|
rdpdr_add_fds(&n, &rfds, &wfds, &tv, &s_timeout); |
1306 |
|
|
1307 |
|
n++; |
1308 |
|
|
1309 |
|
switch (select(n, &rfds, &wfds, NULL, &tv)) |
1310 |
{ |
{ |
1311 |
case -1: |
case -1: |
1312 |
error("select: %s\n", strerror(errno)); |
error("select: %s\n", strerror(errno)); |
1313 |
|
|
1314 |
case 0: |
case 0: |
1315 |
|
/* TODO: if tv.tv_sec just times out |
1316 |
|
* we will segfault. |
1317 |
|
* FIXME: |
1318 |
|
*/ |
1319 |
|
//s_timeout = True; |
1320 |
|
//rdpdr_check_fds(&rfds, &wfds, (BOOL) True); |
1321 |
continue; |
continue; |
1322 |
} |
} |
1323 |
|
|
1324 |
|
rdpdr_check_fds(&rfds, &wfds, (BOOL) False); |
1325 |
|
|
1326 |
if (FD_ISSET(rdp_socket, &rfds)) |
if (FD_ISSET(rdp_socket, &rfds)) |
1327 |
return 1; |
return 1; |
1328 |
|
|