1 |
/* -*- c-basic-offset: 8 -*- |
/* -*- c-basic-offset: 8 -*- |
2 |
rdesktop: A Remote Desktop Protocol client. |
rdesktop: A Remote Desktop Protocol client. |
3 |
User interface services - X Window System |
User interface services - X Window System |
4 |
Copyright (C) Matthew Chapman 1999-2005 |
Copyright (C) Matthew Chapman 1999-2007 |
5 |
|
|
6 |
This program is free software; you can redistribute it and/or modify |
This program is free software; you can redistribute it and/or modify |
7 |
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 |
20 |
|
|
21 |
#include <X11/Xlib.h> |
#include <X11/Xlib.h> |
22 |
#include <X11/Xutil.h> |
#include <X11/Xutil.h> |
23 |
|
#include <X11/Xproto.h> |
24 |
#include <unistd.h> |
#include <unistd.h> |
25 |
#include <sys/time.h> |
#include <sys/time.h> |
26 |
#include <time.h> |
#include <time.h> |
29 |
#include "rdesktop.h" |
#include "rdesktop.h" |
30 |
#include "xproto.h" |
#include "xproto.h" |
31 |
|
|
|
/* We can't include Xproto.h because of conflicting defines for BOOL */ |
|
|
#define X_ConfigureWindow 12 |
|
|
|
|
32 |
extern int g_width; |
extern int g_width; |
33 |
extern int g_height; |
extern int g_height; |
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; |
103 |
static XIC g_IC; |
static XIC g_IC; |
104 |
static XModifierKeymap *g_mod_map; |
static XModifierKeymap *g_mod_map; |
105 |
static Cursor g_current_cursor; |
static Cursor g_current_cursor; |
106 |
static HCURSOR g_null_cursor = NULL; |
static RD_HCURSOR g_null_cursor = 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 int g_dsp_fd; |
extern RD_BOOL g_rdpsnd; |
|
extern BOOL g_dsp_busy; |
|
|
extern BOOL g_rdpsnd; |
|
149 |
#endif |
#endif |
150 |
|
|
151 |
/* MWM decorations */ |
/* MWM decorations */ |
238 |
break; \ |
break; \ |
239 |
case 1: /* Filled */ \ |
case 1: /* Filled */ \ |
240 |
XFillArc(g_display, g_wnd, g_gc, x, y, cx, cy, 0, 360*64); \ |
XFillArc(g_display, g_wnd, g_gc, x, y, cx, cy, 0, 360*64); \ |
241 |
ON_ALL_SEAMLESS_WINDOWS(XCopyArea, (g_display, g_ownbackstore ? g_backstore : g_wnd, sw->wnd, g_gc, \ |
ON_ALL_SEAMLESS_WINDOWS(XFillArc, (g_display, sw->wnd, g_gc, x-sw->xoffset, y-sw->yoffset, cx, cy, 0, 360*64)); \ |
|
x, y, cx, cy, x-sw->xoffset, y-sw->yoffset)); \ |
|
242 |
if (g_ownbackstore) \ |
if (g_ownbackstore) \ |
243 |
XFillArc(g_display, g_backstore, g_gc, x, y, cx, cy, 0, 360*64); \ |
XFillArc(g_display, g_backstore, g_gc, x, y, cx, cy, 0, 360*64); \ |
244 |
break; \ |
break; \ |
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() |
select_visual(int screen_num) |
1313 |
{ |
{ |
1314 |
XPixmapFormatValues *pfm; |
XPixmapFormatValues *pfm; |
1315 |
int pixmap_formats_count, visuals_count; |
int pixmap_formats_count, visuals_count; |
1335 |
|
|
1336 |
/* Search for best TrueColor visual */ |
/* Search for best TrueColor visual */ |
1337 |
template.class = TrueColor; |
template.class = TrueColor; |
1338 |
vmatches = XGetVisualInfo(g_display, VisualClassMask, &template, &visuals_count); |
template.screen = screen_num; |
1339 |
|
vmatches = |
1340 |
|
XGetVisualInfo(g_display, VisualClassMask | VisualScreenMask, &template, |
1341 |
|
&visuals_count); |
1342 |
g_visual = NULL; |
g_visual = NULL; |
1343 |
g_no_translate_image = False; |
g_no_translate_image = False; |
1344 |
g_compatible_arch = False; |
g_compatible_arch = False; |
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); |
1543 |
g_screen = ScreenOfDisplay(g_display, screen_num); |
g_screen = ScreenOfDisplay(g_display, screen_num); |
1544 |
g_depth = DefaultDepthOfScreen(g_screen); |
g_depth = DefaultDepthOfScreen(g_screen); |
1545 |
|
|
1546 |
if (!select_visual()) |
if (!select_visual(screen_num)) |
1547 |
return False; |
return False; |
1548 |
|
|
1549 |
if (g_no_translate_image) |
if (g_no_translate_image) |
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 }; |
1733 |
} |
} |
1734 |
|
|
1735 |
XStoreName(g_display, g_wnd, g_title); |
XStoreName(g_display, g_wnd, g_title); |
1736 |
|
ewmh_set_wm_name(g_wnd, g_title); |
1737 |
|
|
1738 |
if (g_hide_decorations) |
if (g_hide_decorations) |
1739 |
mwm_hide_decorations(g_wnd); |
mwm_hide_decorations(g_wnd); |
1873 |
} |
} |
1874 |
|
|
1875 |
static void |
static void |
1876 |
handle_button_event(XEvent xevent, BOOL down) |
handle_button_event(XEvent xevent, RD_BOOL down) |
1877 |
{ |
{ |
1878 |
uint16 button, flags = 0; |
uint16 button, flags = 0; |
1879 |
g_last_gesturetime = xevent.xbutton.time; |
g_last_gesturetime = xevent.xbutton.time; |
2247 |
int n; |
int n; |
2248 |
fd_set rfds, wfds; |
fd_set rfds, wfds; |
2249 |
struct timeval tv; |
struct timeval tv; |
2250 |
BOOL s_timeout = False; |
RD_BOOL s_timeout = False; |
2251 |
|
|
2252 |
while (True) |
while (True) |
2253 |
{ |
{ |
2265 |
FD_SET(rdp_socket, &rfds); |
FD_SET(rdp_socket, &rfds); |
2266 |
FD_SET(g_x_socket, &rfds); |
FD_SET(g_x_socket, &rfds); |
2267 |
|
|
|
#ifdef WITH_RDPSND |
|
|
/* FIXME: there should be an API for registering fds */ |
|
|
if (g_dsp_busy) |
|
|
{ |
|
|
FD_SET(g_dsp_fd, &wfds); |
|
|
n = (g_dsp_fd > n) ? g_dsp_fd : n; |
|
|
} |
|
|
#endif |
|
2268 |
/* default timeout */ |
/* default timeout */ |
2269 |
tv.tv_sec = 60; |
tv.tv_sec = 60; |
2270 |
tv.tv_usec = 0; |
tv.tv_usec = 0; |
2271 |
|
|
2272 |
|
#ifdef WITH_RDPSND |
2273 |
|
rdpsnd_add_fds(&n, &rfds, &wfds, &tv); |
2274 |
|
#endif |
2275 |
|
|
2276 |
/* add redirection handles */ |
/* add redirection handles */ |
2277 |
rdpdr_add_fds(&n, &rfds, &wfds, &tv, &s_timeout); |
rdpdr_add_fds(&n, &rfds, &wfds, &tv, &s_timeout); |
2278 |
seamless_select_timeout(&tv); |
seamless_select_timeout(&tv); |
2285 |
error("select: %s\n", strerror(errno)); |
error("select: %s\n", strerror(errno)); |
2286 |
|
|
2287 |
case 0: |
case 0: |
2288 |
|
#ifdef WITH_RDPSND |
2289 |
|
rdpsnd_check_fds(&rfds, &wfds); |
2290 |
|
#endif |
2291 |
|
|
2292 |
/* Abort serial read calls */ |
/* Abort serial read calls */ |
2293 |
if (s_timeout) |
if (s_timeout) |
2294 |
rdpdr_check_fds(&rfds, &wfds, (BOOL) True); |
rdpdr_check_fds(&rfds, &wfds, (RD_BOOL) True); |
2295 |
continue; |
continue; |
2296 |
} |
} |
2297 |
|
|
2298 |
rdpdr_check_fds(&rfds, &wfds, (BOOL) False); |
#ifdef WITH_RDPSND |
2299 |
|
rdpsnd_check_fds(&rfds, &wfds); |
2300 |
|
#endif |
2301 |
|
|
2302 |
|
rdpdr_check_fds(&rfds, &wfds, (RD_BOOL) False); |
2303 |
|
|
2304 |
if (FD_ISSET(rdp_socket, &rfds)) |
if (FD_ISSET(rdp_socket, &rfds)) |
2305 |
return 1; |
return 1; |
2306 |
|
|
|
#ifdef WITH_RDPSND |
|
|
if (g_dsp_busy && FD_ISSET(g_dsp_fd, &wfds)) |
|
|
wave_out_play(); |
|
|
#endif |
|
2307 |
} |
} |
2308 |
} |
} |
2309 |
|
|
2313 |
XWarpPointer(g_display, g_wnd, g_wnd, 0, 0, 0, 0, x, y); |
XWarpPointer(g_display, g_wnd, g_wnd, 0, 0, 0, 0, x, y); |
2314 |
} |
} |
2315 |
|
|
2316 |
HBITMAP |
RD_HBITMAP |
2317 |
ui_create_bitmap(int width, int height, uint8 * data) |
ui_create_bitmap(int width, int height, uint8 * data) |
2318 |
{ |
{ |
2319 |
XImage *image; |
XImage *image; |
2343 |
XFree(image); |
XFree(image); |
2344 |
if (tdata != data) |
if (tdata != data) |
2345 |
xfree(tdata); |
xfree(tdata); |
2346 |
return (HBITMAP) bitmap; |
return (RD_HBITMAP) bitmap; |
2347 |
} |
} |
2348 |
|
|
2349 |
void |
void |
2391 |
} |
} |
2392 |
|
|
2393 |
void |
void |
2394 |
ui_destroy_bitmap(HBITMAP bmp) |
ui_destroy_bitmap(RD_HBITMAP bmp) |
2395 |
{ |
{ |
2396 |
XFreePixmap(g_display, (Pixmap) bmp); |
XFreePixmap(g_display, (Pixmap) bmp); |
2397 |
} |
} |
2398 |
|
|
2399 |
HGLYPH |
RD_HGLYPH |
2400 |
ui_create_glyph(int width, int height, uint8 * data) |
ui_create_glyph(int width, int height, uint8 * data) |
2401 |
{ |
{ |
2402 |
XImage *image; |
XImage *image; |
2418 |
XPutImage(g_display, bitmap, g_create_glyph_gc, image, 0, 0, 0, 0, width, height); |
XPutImage(g_display, bitmap, g_create_glyph_gc, image, 0, 0, 0, 0, width, height); |
2419 |
|
|
2420 |
XFree(image); |
XFree(image); |
2421 |
return (HGLYPH) bitmap; |
return (RD_HGLYPH) bitmap; |
2422 |
} |
} |
2423 |
|
|
2424 |
void |
void |
2425 |
ui_destroy_glyph(HGLYPH glyph) |
ui_destroy_glyph(RD_HGLYPH glyph) |
2426 |
{ |
{ |
2427 |
XFreePixmap(g_display, (Pixmap) glyph); |
XFreePixmap(g_display, (Pixmap) glyph); |
2428 |
} |
} |
2429 |
|
|
2430 |
HCURSOR |
RD_HCURSOR |
2431 |
ui_create_cursor(unsigned int x, unsigned int y, int width, int height, |
ui_create_cursor(unsigned int x, unsigned int y, int width, int height, |
2432 |
uint8 * andmask, uint8 * xormask) |
uint8 * andmask, uint8 * xormask) |
2433 |
{ |
{ |
2434 |
HGLYPH maskglyph, cursorglyph; |
RD_HGLYPH maskglyph, cursorglyph; |
2435 |
XColor bg, fg; |
XColor bg, fg; |
2436 |
Cursor xcursor; |
Cursor xcursor; |
2437 |
uint8 *cursor, *pcursor; |
uint8 *cursor, *pcursor; |
2495 |
ui_destroy_glyph(cursorglyph); |
ui_destroy_glyph(cursorglyph); |
2496 |
xfree(mask); |
xfree(mask); |
2497 |
xfree(cursor); |
xfree(cursor); |
2498 |
return (HCURSOR) xcursor; |
return (RD_HCURSOR) xcursor; |
2499 |
} |
} |
2500 |
|
|
2501 |
void |
void |
2502 |
ui_set_cursor(HCURSOR cursor) |
ui_set_cursor(RD_HCURSOR cursor) |
2503 |
{ |
{ |
2504 |
g_current_cursor = (Cursor) cursor; |
g_current_cursor = (Cursor) cursor; |
2505 |
XDefineCursor(g_display, g_wnd, g_current_cursor); |
XDefineCursor(g_display, g_wnd, g_current_cursor); |
2507 |
} |
} |
2508 |
|
|
2509 |
void |
void |
2510 |
ui_destroy_cursor(HCURSOR cursor) |
ui_destroy_cursor(RD_HCURSOR cursor) |
2511 |
{ |
{ |
2512 |
XFreeCursor(g_display, (Cursor) cursor); |
XFreeCursor(g_display, (Cursor) cursor); |
2513 |
} |
} |
2525 |
(xc)->flags = DoRed | DoGreen | DoBlue; |
(xc)->flags = DoRed | DoGreen | DoBlue; |
2526 |
|
|
2527 |
|
|
2528 |
HCOLOURMAP |
RD_HCOLOURMAP |
2529 |
ui_create_colourmap(COLOURMAP * colours) |
ui_create_colourmap(COLOURMAP * colours) |
2530 |
{ |
{ |
2531 |
COLOURENTRY *entry; |
COLOURENTRY *entry; |
2621 |
XStoreColors(g_display, map, xcolours, ncolours); |
XStoreColors(g_display, map, xcolours, ncolours); |
2622 |
|
|
2623 |
xfree(xcolours); |
xfree(xcolours); |
2624 |
return (HCOLOURMAP) map; |
return (RD_HCOLOURMAP) map; |
2625 |
} |
} |
2626 |
} |
} |
2627 |
|
|
2628 |
void |
void |
2629 |
ui_destroy_colourmap(HCOLOURMAP map) |
ui_destroy_colourmap(RD_HCOLOURMAP map) |
2630 |
{ |
{ |
2631 |
if (!g_owncolmap) |
if (!g_owncolmap) |
2632 |
xfree(map); |
xfree(map); |
2635 |
} |
} |
2636 |
|
|
2637 |
void |
void |
2638 |
ui_set_colourmap(HCOLOURMAP map) |
ui_set_colourmap(RD_HCOLOURMAP map) |
2639 |
{ |
{ |
2640 |
if (!g_owncolmap) |
if (!g_owncolmap) |
2641 |
{ |
{ |
2723 |
FILL_RECTANGLE_BACKSTORE(x, y, cx, cy); |
FILL_RECTANGLE_BACKSTORE(x, y, cx, cy); |
2724 |
XSetFillStyle(g_display, g_gc, FillSolid); |
XSetFillStyle(g_display, g_gc, FillSolid); |
2725 |
XSetTSOrigin(g_display, g_gc, 0, 0); |
XSetTSOrigin(g_display, g_gc, 0, 0); |
2726 |
ui_destroy_glyph((HGLYPH) fill); |
ui_destroy_glyph((RD_HGLYPH) fill); |
2727 |
break; |
break; |
2728 |
|
|
2729 |
case 3: /* Pattern */ |
case 3: /* Pattern */ |
2738 |
FILL_RECTANGLE_BACKSTORE(x, y, cx, cy); |
FILL_RECTANGLE_BACKSTORE(x, y, cx, cy); |
2739 |
XSetFillStyle(g_display, g_gc, FillSolid); |
XSetFillStyle(g_display, g_gc, FillSolid); |
2740 |
XSetTSOrigin(g_display, g_gc, 0, 0); |
XSetTSOrigin(g_display, g_gc, 0, 0); |
2741 |
ui_destroy_glyph((HGLYPH) fill); |
ui_destroy_glyph((RD_HGLYPH) fill); |
2742 |
break; |
break; |
2743 |
|
|
2744 |
default: |
default: |
2781 |
void |
void |
2782 |
ui_memblt(uint8 opcode, |
ui_memblt(uint8 opcode, |
2783 |
/* dest */ int x, int y, int cx, int cy, |
/* dest */ int x, int y, int cx, int cy, |
2784 |
/* src */ HBITMAP src, int srcx, int srcy) |
/* src */ RD_HBITMAP src, int srcx, int srcy) |
2785 |
{ |
{ |
2786 |
SET_FUNCTION(opcode); |
SET_FUNCTION(opcode); |
2787 |
XCopyArea(g_display, (Pixmap) src, g_wnd, g_gc, srcx, srcy, cx, cy, x, y); |
XCopyArea(g_display, (Pixmap) src, g_wnd, g_gc, srcx, srcy, cx, cy, x, y); |
2796 |
void |
void |
2797 |
ui_triblt(uint8 opcode, |
ui_triblt(uint8 opcode, |
2798 |
/* dest */ int x, int y, int cx, int cy, |
/* dest */ int x, int y, int cx, int cy, |
2799 |
/* src */ HBITMAP src, int srcx, int srcy, |
/* src */ RD_HBITMAP src, int srcx, int srcy, |
2800 |
/* brush */ BRUSH * brush, int bgcolour, int fgcolour) |
/* brush */ BRUSH * brush, int bgcolour, int fgcolour) |
2801 |
{ |
{ |
2802 |
/* This is potentially difficult to do in general. Until someone |
/* This is potentially difficult to do in general. Until someone |
2854 |
void |
void |
2855 |
ui_polygon(uint8 opcode, |
ui_polygon(uint8 opcode, |
2856 |
/* mode */ uint8 fillmode, |
/* mode */ uint8 fillmode, |
2857 |
/* dest */ POINT * point, int npoints, |
/* dest */ RD_POINT * point, int npoints, |
2858 |
/* brush */ BRUSH * brush, int bgcolour, int fgcolour) |
/* brush */ BRUSH * brush, int bgcolour, int fgcolour) |
2859 |
{ |
{ |
2860 |
uint8 style, i, ipattern[8]; |
uint8 style, i, ipattern[8]; |
2897 |
FILL_POLYGON((XPoint *) point, npoints); |
FILL_POLYGON((XPoint *) point, npoints); |
2898 |
XSetFillStyle(g_display, g_gc, FillSolid); |
XSetFillStyle(g_display, g_gc, FillSolid); |
2899 |
XSetTSOrigin(g_display, g_gc, 0, 0); |
XSetTSOrigin(g_display, g_gc, 0, 0); |
2900 |
ui_destroy_glyph((HGLYPH) fill); |
ui_destroy_glyph((RD_HGLYPH) fill); |
2901 |
break; |
break; |
2902 |
|
|
2903 |
case 3: /* Pattern */ |
case 3: /* Pattern */ |
2912 |
FILL_POLYGON((XPoint *) point, npoints); |
FILL_POLYGON((XPoint *) point, npoints); |
2913 |
XSetFillStyle(g_display, g_gc, FillSolid); |
XSetFillStyle(g_display, g_gc, FillSolid); |
2914 |
XSetTSOrigin(g_display, g_gc, 0, 0); |
XSetTSOrigin(g_display, g_gc, 0, 0); |
2915 |
ui_destroy_glyph((HGLYPH) fill); |
ui_destroy_glyph((RD_HGLYPH) fill); |
2916 |
break; |
break; |
2917 |
|
|
2918 |
default: |
default: |
2924 |
|
|
2925 |
void |
void |
2926 |
ui_polyline(uint8 opcode, |
ui_polyline(uint8 opcode, |
2927 |
/* dest */ POINT * points, int npoints, |
/* dest */ RD_POINT * points, int npoints, |
2928 |
/* pen */ PEN * pen) |
/* pen */ PEN * pen) |
2929 |
{ |
{ |
2930 |
/* TODO: set join style */ |
/* TODO: set join style */ |
2975 |
DRAW_ELLIPSE(x, y, cx, cy, fillmode); |
DRAW_ELLIPSE(x, y, cx, cy, fillmode); |
2976 |
XSetFillStyle(g_display, g_gc, FillSolid); |
XSetFillStyle(g_display, g_gc, FillSolid); |
2977 |
XSetTSOrigin(g_display, g_gc, 0, 0); |
XSetTSOrigin(g_display, g_gc, 0, 0); |
2978 |
ui_destroy_glyph((HGLYPH) fill); |
ui_destroy_glyph((RD_HGLYPH) fill); |
2979 |
break; |
break; |
2980 |
|
|
2981 |
case 3: /* Pattern */ |
case 3: /* Pattern */ |
2990 |
DRAW_ELLIPSE(x, y, cx, cy, fillmode); |
DRAW_ELLIPSE(x, y, cx, cy, fillmode); |
2991 |
XSetFillStyle(g_display, g_gc, FillSolid); |
XSetFillStyle(g_display, g_gc, FillSolid); |
2992 |
XSetTSOrigin(g_display, g_gc, 0, 0); |
XSetTSOrigin(g_display, g_gc, 0, 0); |
2993 |
ui_destroy_glyph((HGLYPH) fill); |
ui_destroy_glyph((RD_HGLYPH) fill); |
2994 |
break; |
break; |
2995 |
|
|
2996 |
default: |
default: |
3004 |
void |
void |
3005 |
ui_draw_glyph(int mixmode, |
ui_draw_glyph(int mixmode, |
3006 |
/* dest */ int x, int y, int cx, int cy, |
/* dest */ int x, int y, int cx, int cy, |
3007 |
/* src */ HGLYPH glyph, int srcx, int srcy, |
/* src */ RD_HGLYPH glyph, int srcx, int srcy, |
3008 |
int bgcolour, int fgcolour) |
int bgcolour, int fgcolour) |
3009 |
{ |
{ |
3010 |
SET_FOREGROUND(fgcolour); |
SET_FOREGROUND(fgcolour); |
3189 |
if (g_ownbackstore) |
if (g_ownbackstore) |
3190 |
{ |
{ |
3191 |
image = XGetImage(g_display, g_backstore, x, y, cx, cy, AllPlanes, ZPixmap); |
image = XGetImage(g_display, g_backstore, x, y, cx, cy, AllPlanes, ZPixmap); |
3192 |
|
exit_if_null(image); |
3193 |
} |
} |
3194 |
else |
else |
3195 |
{ |
{ |
3196 |
pix = XCreatePixmap(g_display, g_wnd, cx, cy, g_depth); |
pix = XCreatePixmap(g_display, g_wnd, cx, cy, g_depth); |
3197 |
XCopyArea(g_display, g_wnd, pix, g_gc, x, y, cx, cy, 0, 0); |
XCopyArea(g_display, g_wnd, pix, g_gc, x, y, cx, cy, 0, 0); |
3198 |
image = XGetImage(g_display, pix, 0, 0, cx, cy, AllPlanes, ZPixmap); |
image = XGetImage(g_display, pix, 0, 0, cx, cy, AllPlanes, ZPixmap); |
3199 |
|
exit_if_null(image); |
3200 |
XFreePixmap(g_display, pix); |
XFreePixmap(g_display, pix); |
3201 |
} |
} |
3202 |
|
|
3252 |
|
|
3253 |
|
|
3254 |
void |
void |
3255 |
ui_seamless_begin(BOOL hidden) |
ui_seamless_begin(RD_BOOL hidden) |
3256 |
{ |
{ |
3257 |
if (!g_seamless_rdp) |
if (!g_seamless_rdp) |
3258 |
return; |
return; |
3474 |
} |
} |
3475 |
|
|
3476 |
|
|
3477 |
|
void |
3478 |
|
ui_seamless_destroy_group(unsigned long id, unsigned long flags) |
3479 |
|
{ |
3480 |
|
seamless_window *sw, *sw_next; |
3481 |
|
|
3482 |
|
if (!g_seamless_active) |
3483 |
|
return; |
3484 |
|
|
3485 |
|
for (sw = g_seamless_windows; sw; sw = sw_next) |
3486 |
|
{ |
3487 |
|
sw_next = sw->next; |
3488 |
|
|
3489 |
|
if (sw->group->id == id) |
3490 |
|
{ |
3491 |
|
XDestroyWindow(g_display, sw->wnd); |
3492 |
|
sw_remove_window(sw); |
3493 |
|
} |
3494 |
|
} |
3495 |
|
} |
3496 |
|
|
3497 |
|
|
3498 |
void |
void |
3499 |
ui_seamless_move_window(unsigned long id, int x, int y, int width, int height, unsigned long flags) |
ui_seamless_move_window(unsigned long id, int x, int y, int width, int height, unsigned long flags) |
3500 |
{ |
{ |