20 |
|
|
21 |
#include <X11/Xlib.h> |
#include <X11/Xlib.h> |
22 |
#include <X11/Xutil.h> |
#include <X11/Xutil.h> |
|
#define BOOL XPROTO_BOOL |
|
23 |
#include <X11/Xproto.h> |
#include <X11/Xproto.h> |
|
#undef BOOL |
|
24 |
#include <unistd.h> |
#include <unistd.h> |
25 |
#include <sys/time.h> |
#include <sys/time.h> |
26 |
#include <time.h> |
#include <time.h> |
34 |
extern int g_xpos; |
extern int g_xpos; |
35 |
extern int g_ypos; |
extern int g_ypos; |
36 |
extern int g_pos; |
extern int g_pos; |
37 |
extern BOOL g_sendmotion; |
extern RD_BOOL g_sendmotion; |
38 |
extern BOOL g_fullscreen; |
extern RD_BOOL g_fullscreen; |
39 |
extern BOOL g_grab_keyboard; |
extern RD_BOOL g_grab_keyboard; |
40 |
extern BOOL g_hide_decorations; |
extern RD_BOOL g_hide_decorations; |
41 |
extern char g_title[]; |
extern char g_title[]; |
42 |
/* Color depth of the RDP session. |
/* Color depth of the RDP session. |
43 |
As of RDP 5.1, it may be 8, 15, 16 or 24. */ |
As of RDP 5.1, it may be 8, 15, 16 or 24. */ |
69 |
unsigned int desktop; |
unsigned int desktop; |
70 |
struct timeval *position_timer; |
struct timeval *position_timer; |
71 |
|
|
72 |
BOOL outstanding_position; |
RD_BOOL outstanding_position; |
73 |
unsigned int outpos_serial; |
unsigned int outpos_serial; |
74 |
int outpos_xoffset, outpos_yoffset; |
int outpos_xoffset, outpos_yoffset; |
75 |
int outpos_width, outpos_height; |
int outpos_width, outpos_height; |
78 |
} seamless_window; |
} seamless_window; |
79 |
static seamless_window *g_seamless_windows = NULL; |
static seamless_window *g_seamless_windows = NULL; |
80 |
static unsigned long g_seamless_focused = 0; |
static unsigned long g_seamless_focused = 0; |
81 |
static BOOL g_seamless_started = False; /* Server end is up and running */ |
static RD_BOOL g_seamless_started = False; /* Server end is up and running */ |
82 |
static BOOL g_seamless_active = False; /* We are currently in seamless mode */ |
static RD_BOOL g_seamless_active = False; /* We are currently in seamless mode */ |
83 |
static BOOL g_seamless_hidden = False; /* Desktop is hidden on server */ |
static RD_BOOL g_seamless_hidden = False; /* Desktop is hidden on server */ |
84 |
extern BOOL g_seamless_rdp; |
extern RD_BOOL g_seamless_rdp; |
85 |
|
|
86 |
extern uint32 g_embed_wnd; |
extern uint32 g_embed_wnd; |
87 |
BOOL g_enable_compose = False; |
RD_BOOL g_enable_compose = False; |
88 |
BOOL g_Unobscured; /* used for screenblt */ |
RD_BOOL g_Unobscured; /* used for screenblt */ |
89 |
static GC g_gc = NULL; |
static GC g_gc = NULL; |
90 |
static GC g_create_bitmap_gc = NULL; |
static GC g_create_bitmap_gc = NULL; |
91 |
static GC g_create_glyph_gc = NULL; |
static GC g_create_glyph_gc = NULL; |
107 |
static Atom g_protocol_atom, g_kill_atom; |
static Atom g_protocol_atom, g_kill_atom; |
108 |
extern Atom g_net_wm_state_atom; |
extern Atom g_net_wm_state_atom; |
109 |
extern Atom g_net_wm_desktop_atom; |
extern Atom g_net_wm_desktop_atom; |
110 |
static BOOL g_focused; |
static RD_BOOL g_focused; |
111 |
static BOOL g_mouse_in_wnd; |
static RD_BOOL g_mouse_in_wnd; |
112 |
/* Indicates that: |
/* Indicates that: |
113 |
1) visual has 15, 16 or 24 depth and the same color channel masks |
1) visual has 15, 16 or 24 depth and the same color channel masks |
114 |
as its RDP equivalent (implies X server is LE), |
as its RDP equivalent (implies X server is LE), |
115 |
2) host is LE |
2) host is LE |
116 |
This will trigger an optimization whose real value is questionable. |
This will trigger an optimization whose real value is questionable. |
117 |
*/ |
*/ |
118 |
static BOOL g_compatible_arch; |
static RD_BOOL g_compatible_arch; |
119 |
/* Indicates whether RDP's bitmaps and our XImages have the same |
/* Indicates whether RDP's bitmaps and our XImages have the same |
120 |
binary format. If so, we can avoid an expensive translation. |
binary format. If so, we can avoid an expensive translation. |
121 |
Note that this can be true when g_compatible_arch is false, |
Note that this can be true when g_compatible_arch is false, |
126 |
('host' is the machine running rdesktop; the host simply memcpy's |
('host' is the machine running rdesktop; the host simply memcpy's |
127 |
so its endianess doesn't matter) |
so its endianess doesn't matter) |
128 |
*/ |
*/ |
129 |
static BOOL g_no_translate_image = False; |
static RD_BOOL g_no_translate_image = False; |
130 |
|
|
131 |
/* endianness */ |
/* endianness */ |
132 |
static BOOL g_host_be; |
static RD_BOOL g_host_be; |
133 |
static BOOL g_xserver_be; |
static RD_BOOL g_xserver_be; |
134 |
static int g_red_shift_r, g_blue_shift_r, g_green_shift_r; |
static int g_red_shift_r, g_blue_shift_r, g_green_shift_r; |
135 |
static int g_red_shift_l, g_blue_shift_l, g_green_shift_l; |
static int g_red_shift_l, g_blue_shift_l, g_green_shift_l; |
136 |
|
|
137 |
/* software backing store */ |
/* software backing store */ |
138 |
extern BOOL g_ownbackstore; |
extern RD_BOOL g_ownbackstore; |
139 |
static Pixmap g_backstore = 0; |
static Pixmap g_backstore = 0; |
140 |
|
|
141 |
/* Moving in single app mode */ |
/* Moving in single app mode */ |
142 |
static BOOL g_moving_wnd; |
static RD_BOOL g_moving_wnd; |
143 |
static int g_move_x_offset = 0; |
static int g_move_x_offset = 0; |
144 |
static int g_move_y_offset = 0; |
static int g_move_y_offset = 0; |
145 |
static BOOL g_using_full_workarea = False; |
static RD_BOOL g_using_full_workarea = False; |
146 |
|
|
147 |
#ifdef WITH_RDPSND |
#ifdef WITH_RDPSND |
148 |
extern BOOL g_rdpsnd; |
extern RD_BOOL g_rdpsnd; |
149 |
#endif |
#endif |
150 |
|
|
151 |
/* MWM decorations */ |
/* MWM decorations */ |
246 |
} |
} |
247 |
|
|
248 |
/* colour maps */ |
/* colour maps */ |
249 |
extern BOOL g_owncolmap; |
extern RD_BOOL g_owncolmap; |
250 |
static Colormap g_xcolmap; |
static Colormap g_xcolmap; |
251 |
static uint32 *g_colmap = NULL; |
static uint32 *g_colmap = NULL; |
252 |
|
|
470 |
|
|
471 |
|
|
472 |
static seamless_group * |
static seamless_group * |
473 |
sw_find_group(unsigned long id, BOOL dont_create) |
sw_find_group(unsigned long id, RD_BOOL dont_create) |
474 |
{ |
{ |
475 |
seamless_window *sw; |
seamless_window *sw; |
476 |
seamless_group *sg; |
seamless_group *sg; |
1260 |
return out; |
return out; |
1261 |
} |
} |
1262 |
|
|
1263 |
BOOL |
RD_BOOL |
1264 |
get_key_state(unsigned int state, uint32 keysym) |
get_key_state(unsigned int state, uint32 keysym) |
1265 |
{ |
{ |
1266 |
int modifierpos, key, keysymMask = 0; |
int modifierpos, key, keysymMask = 0; |
1308 |
return weight; |
return weight; |
1309 |
} |
} |
1310 |
|
|
1311 |
static BOOL |
static RD_BOOL |
1312 |
select_visual(int screen_num) |
select_visual(int screen_num) |
1313 |
{ |
{ |
1314 |
XPixmapFormatValues *pfm; |
XPixmapFormatValues *pfm; |
1347 |
for (i = 0; i < visuals_count; ++i) |
for (i = 0; i < visuals_count; ++i) |
1348 |
{ |
{ |
1349 |
XVisualInfo *visual_info = &vmatches[i]; |
XVisualInfo *visual_info = &vmatches[i]; |
1350 |
BOOL can_translate_to_bpp = False; |
RD_BOOL can_translate_to_bpp = False; |
1351 |
int j; |
int j; |
1352 |
|
|
1353 |
/* Try to find a no-translation visual that'll |
/* Try to find a no-translation visual that'll |
1519 |
return g_old_error_handler(dpy, eev); |
return g_old_error_handler(dpy, eev); |
1520 |
} |
} |
1521 |
|
|
1522 |
BOOL |
RD_BOOL |
1523 |
ui_init(void) |
ui_init(void) |
1524 |
{ |
{ |
1525 |
int screen_num; |
int screen_num; |
1533 |
|
|
1534 |
{ |
{ |
1535 |
uint16 endianess_test = 1; |
uint16 endianess_test = 1; |
1536 |
g_host_be = !(BOOL) (*(uint8 *) (&endianess_test)); |
g_host_be = !(RD_BOOL) (*(uint8 *) (&endianess_test)); |
1537 |
} |
} |
1538 |
|
|
1539 |
g_old_error_handler = XSetErrorHandler(error_handler); |
g_old_error_handler = XSetErrorHandler(error_handler); |
1685 |
*input_mask |= LeaveWindowMask; |
*input_mask |= LeaveWindowMask; |
1686 |
} |
} |
1687 |
|
|
1688 |
BOOL |
RD_BOOL |
1689 |
ui_create_window(void) |
ui_create_window(void) |
1690 |
{ |
{ |
1691 |
uint8 null_pointer_mask[1] = { 0x80 }; |
uint8 null_pointer_mask[1] = { 0x80 }; |
1872 |
} |
} |
1873 |
|
|
1874 |
static void |
static void |
1875 |
handle_button_event(XEvent xevent, BOOL down) |
handle_button_event(XEvent xevent, RD_BOOL down) |
1876 |
{ |
{ |
1877 |
uint16 button, flags = 0; |
uint16 button, flags = 0; |
1878 |
g_last_gesturetime = xevent.xbutton.time; |
g_last_gesturetime = xevent.xbutton.time; |
2246 |
int n; |
int n; |
2247 |
fd_set rfds, wfds; |
fd_set rfds, wfds; |
2248 |
struct timeval tv; |
struct timeval tv; |
2249 |
BOOL s_timeout = False; |
RD_BOOL s_timeout = False; |
2250 |
|
|
2251 |
while (True) |
while (True) |
2252 |
{ |
{ |
2290 |
|
|
2291 |
/* Abort serial read calls */ |
/* Abort serial read calls */ |
2292 |
if (s_timeout) |
if (s_timeout) |
2293 |
rdpdr_check_fds(&rfds, &wfds, (BOOL) True); |
rdpdr_check_fds(&rfds, &wfds, (RD_BOOL) True); |
2294 |
continue; |
continue; |
2295 |
} |
} |
2296 |
|
|
2298 |
rdpsnd_check_fds(&rfds, &wfds); |
rdpsnd_check_fds(&rfds, &wfds); |
2299 |
#endif |
#endif |
2300 |
|
|
2301 |
rdpdr_check_fds(&rfds, &wfds, (BOOL) False); |
rdpdr_check_fds(&rfds, &wfds, (RD_BOOL) False); |
2302 |
|
|
2303 |
if (FD_ISSET(rdp_socket, &rfds)) |
if (FD_ISSET(rdp_socket, &rfds)) |
2304 |
return 1; |
return 1; |
3251 |
|
|
3252 |
|
|
3253 |
void |
void |
3254 |
ui_seamless_begin(BOOL hidden) |
ui_seamless_begin(RD_BOOL hidden) |
3255 |
{ |
{ |
3256 |
if (!g_seamless_rdp) |
if (!g_seamless_rdp) |
3257 |
return; |
return; |