21 |
#include <X11/Xlib.h> |
#include <X11/Xlib.h> |
22 |
#include <X11/Xutil.h> |
#include <X11/Xutil.h> |
23 |
#include <unistd.h> |
#include <unistd.h> |
24 |
|
#include <sys/time.h> |
25 |
#include <time.h> |
#include <time.h> |
26 |
#include <errno.h> |
#include <errno.h> |
27 |
|
#include <strings.h> |
28 |
#include "rdesktop.h" |
#include "rdesktop.h" |
29 |
#include "xproto.h" |
#include "xproto.h" |
30 |
|
|
43 |
static int g_x_socket; |
static int g_x_socket; |
44 |
static Screen *g_screen; |
static Screen *g_screen; |
45 |
Window g_wnd; |
Window g_wnd; |
46 |
|
extern uint32 g_embed_wnd; |
47 |
BOOL g_enable_compose = False; |
BOOL g_enable_compose = False; |
48 |
static GC g_gc; |
static GC g_gc = NULL; |
49 |
static Visual *g_visual; |
static Visual *g_visual; |
50 |
static int g_depth; |
static int g_depth; |
51 |
static int g_bpp; |
static int g_bpp; |
53 |
static XIC g_IC; |
static XIC g_IC; |
54 |
static XModifierKeymap *g_mod_map; |
static XModifierKeymap *g_mod_map; |
55 |
static Cursor g_current_cursor; |
static Cursor g_current_cursor; |
56 |
static HCURSOR g_null_cursor; |
static HCURSOR g_null_cursor = NULL; |
57 |
static Atom g_protocol_atom, g_kill_atom; |
static Atom g_protocol_atom, g_kill_atom; |
58 |
static BOOL g_focused; |
static BOOL g_focused; |
59 |
static BOOL g_mouse_in_wnd; |
static BOOL g_mouse_in_wnd; |
60 |
|
static BOOL g_arch_match = False; /* set to True if RGB XServer and little endian */ |
61 |
|
|
62 |
/* endianness */ |
/* endianness */ |
63 |
static BOOL g_host_be; |
static BOOL g_host_be; |
66 |
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; |
67 |
|
|
68 |
/* software backing store */ |
/* software backing store */ |
69 |
static BOOL g_ownbackstore; |
extern BOOL g_ownbackstore; |
70 |
static Pixmap g_backstore; |
static Pixmap g_backstore = 0; |
71 |
|
|
72 |
/* Moving in single app mode */ |
/* Moving in single app mode */ |
73 |
static BOOL g_moving_wnd; |
static BOOL g_moving_wnd; |
115 |
} |
} |
116 |
|
|
117 |
/* colour maps */ |
/* colour maps */ |
118 |
BOOL g_owncolmap = False; |
extern BOOL g_owncolmap; |
119 |
static Colormap g_xcolmap; |
static Colormap g_xcolmap; |
120 |
static uint32 *g_colmap = NULL; |
static uint32 *g_colmap = NULL; |
121 |
|
|
171 |
split_colour15(uint32 colour) |
split_colour15(uint32 colour) |
172 |
{ |
{ |
173 |
PixelColour rv; |
PixelColour rv; |
174 |
rv.red = (colour & 0x7c00) >> 10; |
rv.red = (colour & 0x7c00) >> 7; |
175 |
rv.red = (rv.red * 0xff) / 0x1f; |
rv.green = (colour & 0x03e0) >> 2; |
176 |
rv.green = (colour & 0x03e0) >> 5; |
rv.blue = (colour & 0x001f) << 3; |
|
rv.green = (rv.green * 0xff) / 0x1f; |
|
|
rv.blue = (colour & 0x1f); |
|
|
rv.blue = (rv.blue * 0xff) / 0x1f; |
|
177 |
return rv; |
return rv; |
178 |
} |
} |
179 |
|
|
181 |
split_colour16(uint32 colour) |
split_colour16(uint32 colour) |
182 |
{ |
{ |
183 |
PixelColour rv; |
PixelColour rv; |
184 |
rv.red = (colour & 0xf800) >> 11; |
rv.red = (colour & 0xf800) >> 8; |
185 |
rv.red = (rv.red * 0xff) / 0x1f; |
rv.green = (colour & 0x07e0) >> 3; |
186 |
rv.green = (colour & 0x07e0) >> 5; |
rv.blue = (colour & 0x001f) << 3; |
|
rv.green = (rv.green * 0xff) / 0x3f; |
|
|
rv.blue = (colour & 0x001f); |
|
|
rv.blue = (rv.blue * 0xff) / 0x1f; |
|
187 |
return rv; |
return rv; |
188 |
} |
} |
189 |
|
|
192 |
{ |
{ |
193 |
PixelColour rv; |
PixelColour rv; |
194 |
rv.blue = (colour & 0xff0000) >> 16; |
rv.blue = (colour & 0xff0000) >> 16; |
195 |
rv.green = (colour & 0xff00) >> 8; |
rv.green = (colour & 0x00ff00) >> 8; |
196 |
rv.red = (colour & 0xff); |
rv.red = (colour & 0x0000ff); |
197 |
return rv; |
return rv; |
198 |
} |
} |
199 |
|
|
229 |
return make_colour(pc); |
return make_colour(pc); |
230 |
} |
} |
231 |
|
|
232 |
|
#define UNROLL8(stm) { stm stm stm stm stm stm stm stm } |
233 |
|
#define REPEAT(stm) \ |
234 |
|
{ \ |
235 |
|
while (out <= end - 8 * 4) \ |
236 |
|
UNROLL8(stm) \ |
237 |
|
while (out < end) \ |
238 |
|
{ stm } \ |
239 |
|
} |
240 |
|
|
241 |
static void |
static void |
242 |
translate8to8(uint8 * data, uint8 * out, uint8 * end) |
translate8to8(uint8 * data, uint8 * out, uint8 * end) |
243 |
{ |
{ |
250 |
{ |
{ |
251 |
uint16 value; |
uint16 value; |
252 |
|
|
253 |
while (out < end) |
if (g_arch_match) |
254 |
|
REPEAT(*(((uint16*)out)++) = g_colmap[*(data++)];) |
255 |
|
else if (g_xserver_be) |
256 |
{ |
{ |
257 |
value = (uint16) g_colmap[*(data++)]; |
while (out < end) |
|
|
|
|
if (g_xserver_be) |
|
258 |
{ |
{ |
259 |
|
value = (uint16) g_colmap[*(data++)]; |
260 |
*(out++) = value >> 8; |
*(out++) = value >> 8; |
261 |
*(out++) = value; |
*(out++) = value; |
262 |
} |
} |
263 |
else |
} |
264 |
|
else |
265 |
|
{ |
266 |
|
while (out < end) |
267 |
{ |
{ |
268 |
|
value = (uint16) g_colmap[*(data++)]; |
269 |
*(out++) = value; |
*(out++) = value; |
270 |
*(out++) = value >> 8; |
*(out++) = value >> 8; |
271 |
} |
} |
278 |
{ |
{ |
279 |
uint32 value; |
uint32 value; |
280 |
|
|
281 |
while (out < end) |
if (g_xserver_be) |
282 |
{ |
{ |
283 |
value = g_colmap[*(data++)]; |
while (out < end) |
|
|
|
|
if (g_xserver_be) |
|
284 |
{ |
{ |
285 |
|
value = g_colmap[*(data++)]; |
286 |
*(out++) = value >> 16; |
*(out++) = value >> 16; |
287 |
*(out++) = value >> 8; |
*(out++) = value >> 8; |
288 |
*(out++) = value; |
*(out++) = value; |
289 |
} |
} |
290 |
else |
} |
291 |
|
else |
292 |
|
{ |
293 |
|
while (out < end) |
294 |
{ |
{ |
295 |
|
value = g_colmap[*(data++)]; |
296 |
*(out++) = value; |
*(out++) = value; |
297 |
*(out++) = value >> 8; |
*(out++) = value >> 8; |
298 |
*(out++) = value >> 16; |
*(out++) = value >> 16; |
305 |
{ |
{ |
306 |
uint32 value; |
uint32 value; |
307 |
|
|
308 |
while (out < end) |
if (g_arch_match) |
309 |
|
REPEAT(*(((uint32*)out)++) = g_colmap[*(data++)];) |
310 |
|
else if (g_xserver_be) |
311 |
{ |
{ |
312 |
value = g_colmap[*(data++)]; |
while (out < end) |
|
|
|
|
if (g_xserver_be) |
|
313 |
{ |
{ |
314 |
|
value = g_colmap[*(data++)]; |
315 |
*(out++) = value >> 24; |
*(out++) = value >> 24; |
316 |
*(out++) = value >> 16; |
*(out++) = value >> 16; |
317 |
*(out++) = value >> 8; |
*(out++) = value >> 8; |
318 |
*(out++) = value; |
*(out++) = value; |
319 |
} |
} |
320 |
else |
} |
321 |
|
else |
322 |
|
{ |
323 |
|
while (out < end) |
324 |
{ |
{ |
325 |
|
value = g_colmap[*(data++)]; |
326 |
*(out++) = value; |
*(out++) = value; |
327 |
*(out++) = value >> 8; |
*(out++) = value >> 8; |
328 |
*(out++) = value >> 16; |
*(out++) = value >> 16; |
611 |
static uint8 * |
static uint8 * |
612 |
translate_image(int width, int height, uint8 * data) |
translate_image(int width, int height, uint8 * data) |
613 |
{ |
{ |
614 |
int size = width * height * g_bpp / 8; |
int size; |
615 |
uint8 *out = (uint8 *) xmalloc(size); |
uint8 *out; |
616 |
uint8 *end = out + size; |
uint8 *end; |
617 |
|
|
618 |
|
/* if server and xserver bpp match, */ |
619 |
|
/* and arch(endian) matches, no need to translate */ |
620 |
|
/* just return data */ |
621 |
|
if (g_arch_match) |
622 |
|
{ |
623 |
|
if (g_depth == 15 && g_server_bpp == 15) |
624 |
|
return data; |
625 |
|
if (g_depth == 16 && g_server_bpp == 16) |
626 |
|
return data; |
627 |
|
} |
628 |
|
|
629 |
|
size = width * height * (g_bpp / 8); |
630 |
|
out = (uint8 *) xmalloc(size); |
631 |
|
end = out + size; |
632 |
|
|
633 |
switch (g_server_bpp) |
switch (g_server_bpp) |
634 |
{ |
{ |
734 |
XVisualInfo vi; |
XVisualInfo vi; |
735 |
XPixmapFormatValues *pfm; |
XPixmapFormatValues *pfm; |
736 |
uint16 test; |
uint16 test; |
737 |
int i, screen_num; |
int i, screen_num, nvisuals; |
738 |
|
XVisualInfo *vmatches = NULL; |
739 |
|
XVisualInfo template; |
740 |
|
Bool TrueColorVisual = False; |
741 |
|
|
742 |
g_display = XOpenDisplay(NULL); |
g_display = XOpenDisplay(NULL); |
743 |
if (g_display == NULL) |
if (g_display == NULL) |
751 |
g_screen = ScreenOfDisplay(g_display, screen_num); |
g_screen = ScreenOfDisplay(g_display, screen_num); |
752 |
g_depth = DefaultDepthOfScreen(g_screen); |
g_depth = DefaultDepthOfScreen(g_screen); |
753 |
|
|
754 |
if (g_server_bpp == 8) |
/* Search for best TrueColor depth */ |
755 |
|
template.class = TrueColor; |
756 |
|
vmatches = XGetVisualInfo(g_display, VisualClassMask, &template, &nvisuals); |
757 |
|
|
758 |
|
nvisuals--; |
759 |
|
while (nvisuals >= 0) |
760 |
|
{ |
761 |
|
if ((vmatches + nvisuals)->depth > g_depth) |
762 |
|
{ |
763 |
|
g_depth = (vmatches + nvisuals)->depth; |
764 |
|
} |
765 |
|
nvisuals--; |
766 |
|
TrueColorVisual = True; |
767 |
|
} |
768 |
|
|
769 |
|
test = 1; |
770 |
|
g_host_be = !(BOOL) (*(uint8 *) (&test)); |
771 |
|
g_xserver_be = (ImageByteOrder(g_display) == MSBFirst); |
772 |
|
|
773 |
|
if ((g_server_bpp == 8) && ((!TrueColorVisual) || (g_depth <= 8))) |
774 |
{ |
{ |
775 |
/* we use a colourmap, so any visual should do */ |
/* we use a colourmap, so the default visual should do */ |
776 |
g_visual = DefaultVisualOfScreen(g_screen); |
g_visual = DefaultVisualOfScreen(g_screen); |
777 |
|
g_depth = DefaultDepthOfScreen(g_screen); |
778 |
|
|
779 |
|
/* Do not allocate colours on a TrueColor visual */ |
780 |
|
if (g_visual->class == TrueColor) |
781 |
|
{ |
782 |
|
g_owncolmap = False; |
783 |
|
} |
784 |
} |
} |
785 |
else |
else |
786 |
{ |
{ |
796 |
calculate_shifts(vi.red_mask, &g_red_shift_r, &g_red_shift_l); |
calculate_shifts(vi.red_mask, &g_red_shift_r, &g_red_shift_l); |
797 |
calculate_shifts(vi.blue_mask, &g_blue_shift_r, &g_blue_shift_l); |
calculate_shifts(vi.blue_mask, &g_blue_shift_r, &g_blue_shift_l); |
798 |
calculate_shifts(vi.green_mask, &g_green_shift_r, &g_green_shift_l); |
calculate_shifts(vi.green_mask, &g_green_shift_r, &g_green_shift_l); |
799 |
|
|
800 |
|
/* if RGB video and averything is little endian */ |
801 |
|
if (vi.red_mask > vi.green_mask && vi.green_mask > vi.blue_mask) |
802 |
|
if (!g_xserver_be && !g_host_be) |
803 |
|
g_arch_match = True; |
804 |
} |
} |
805 |
|
|
806 |
pfm = XListPixmapFormats(g_display, &i); |
pfm = XListPixmapFormats(g_display, &i); |
827 |
|
|
828 |
if (!g_owncolmap) |
if (!g_owncolmap) |
829 |
{ |
{ |
830 |
g_xcolmap = DefaultColormapOfScreen(g_screen); |
g_xcolmap = |
831 |
|
XCreateColormap(g_display, RootWindowOfScreen(g_screen), g_visual, |
832 |
|
AllocNone); |
833 |
if (g_depth <= 8) |
if (g_depth <= 8) |
834 |
warning("Screen depth is 8 bits or lower: you may want to use -C for a private colourmap\n"); |
warning("Screen depth is 8 bits or lower: you may want to use -C for a private colourmap\n"); |
835 |
} |
} |
836 |
|
|
837 |
g_gc = XCreateGC(g_display, RootWindowOfScreen(g_screen), 0, NULL); |
if ((!g_ownbackstore) && (DoesBackingStore(g_screen) != Always)) |
838 |
|
{ |
839 |
if (DoesBackingStore(g_screen) != Always) |
warning("External BackingStore not available, using internal\n"); |
840 |
g_ownbackstore = True; |
g_ownbackstore = True; |
841 |
|
} |
|
test = 1; |
|
|
g_host_be = !(BOOL) (*(uint8 *) (&test)); |
|
|
g_xserver_be = (ImageByteOrder(g_display) == MSBFirst); |
|
842 |
|
|
843 |
/* |
/* |
844 |
* Determine desktop size |
* Determine desktop size |
875 |
/* make sure width is a multiple of 4 */ |
/* make sure width is a multiple of 4 */ |
876 |
g_width = (g_width + 3) & ~3; |
g_width = (g_width + 3) & ~3; |
877 |
|
|
|
if (g_ownbackstore) |
|
|
{ |
|
|
g_backstore = |
|
|
XCreatePixmap(g_display, RootWindowOfScreen(g_screen), g_width, g_height, |
|
|
g_depth); |
|
|
|
|
|
/* clear to prevent rubbish being exposed at startup */ |
|
|
XSetForeground(g_display, g_gc, BlackPixelOfScreen(g_screen)); |
|
|
XFillRectangle(g_display, g_backstore, g_gc, 0, 0, g_width, g_height); |
|
|
} |
|
|
|
|
878 |
g_mod_map = XGetModifierMapping(g_display); |
g_mod_map = XGetModifierMapping(g_display); |
879 |
|
|
880 |
xkeymap_init(); |
xkeymap_init(); |
895 |
if (g_IM != NULL) |
if (g_IM != NULL) |
896 |
XCloseIM(g_IM); |
XCloseIM(g_IM); |
897 |
|
|
898 |
|
if (g_null_cursor != NULL) |
899 |
|
ui_destroy_cursor(g_null_cursor); |
900 |
|
|
901 |
XFreeModifiermap(g_mod_map); |
XFreeModifiermap(g_mod_map); |
902 |
|
|
903 |
if (g_ownbackstore) |
if (g_ownbackstore) |
924 |
wndheight = g_fullscreen ? HeightOfScreen(g_screen) : g_height; |
wndheight = g_fullscreen ? HeightOfScreen(g_screen) : g_height; |
925 |
|
|
926 |
attribs.background_pixel = BlackPixelOfScreen(g_screen); |
attribs.background_pixel = BlackPixelOfScreen(g_screen); |
927 |
|
attribs.border_pixel = WhitePixelOfScreen(g_screen); |
928 |
attribs.backing_store = g_ownbackstore ? NotUseful : Always; |
attribs.backing_store = g_ownbackstore ? NotUseful : Always; |
929 |
attribs.override_redirect = g_fullscreen; |
attribs.override_redirect = g_fullscreen; |
930 |
|
attribs.colormap = g_xcolmap; |
931 |
|
|
932 |
g_wnd = XCreateWindow(g_display, RootWindowOfScreen(g_screen), 0, 0, wndwidth, wndheight, |
g_wnd = XCreateWindow(g_display, RootWindowOfScreen(g_screen), 0, 0, wndwidth, wndheight, |
933 |
0, CopyFromParent, InputOutput, CopyFromParent, |
0, g_depth, InputOutput, g_visual, |
934 |
CWBackPixel | CWBackingStore | CWOverrideRedirect, &attribs); |
CWBackPixel | CWBackingStore | CWOverrideRedirect | |
935 |
|
CWColormap | CWBorderPixel, &attribs); |
936 |
|
|
937 |
|
if (g_gc == NULL) |
938 |
|
g_gc = XCreateGC(g_display, g_wnd, 0, NULL); |
939 |
|
|
940 |
|
if ((g_ownbackstore) && (g_backstore == 0)) |
941 |
|
{ |
942 |
|
g_backstore = XCreatePixmap(g_display, g_wnd, g_width, g_height, g_depth); |
943 |
|
|
944 |
|
/* clear to prevent rubbish being exposed at startup */ |
945 |
|
XSetForeground(g_display, g_gc, BlackPixelOfScreen(g_screen)); |
946 |
|
XFillRectangle(g_display, g_backstore, g_gc, 0, 0, g_width, g_height); |
947 |
|
} |
948 |
|
|
949 |
XStoreName(g_display, g_wnd, g_title); |
XStoreName(g_display, g_wnd, g_title); |
950 |
|
|
969 |
XFree(sizehints); |
XFree(sizehints); |
970 |
} |
} |
971 |
|
|
972 |
|
if (g_embed_wnd) |
973 |
|
{ |
974 |
|
XReparentWindow(g_display, g_wnd, (Window) g_embed_wnd, 0, 0); |
975 |
|
} |
976 |
|
|
977 |
input_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | |
input_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | |
978 |
VisibilityChangeMask | FocusChangeMask; |
VisibilityChangeMask | FocusChangeMask; |
979 |
|
|
1015 |
XSetWMProtocols(g_display, g_wnd, &g_kill_atom, 1); |
XSetWMProtocols(g_display, g_wnd, &g_kill_atom, 1); |
1016 |
|
|
1017 |
/* create invisible 1x1 cursor to be used as null cursor */ |
/* create invisible 1x1 cursor to be used as null cursor */ |
1018 |
g_null_cursor = ui_create_cursor(0, 0, 1, 1, null_pointer_mask, null_pointer_data); |
if (g_null_cursor == NULL) |
1019 |
|
g_null_cursor = ui_create_cursor(0, 0, 1, 1, null_pointer_mask, null_pointer_data); |
1020 |
|
|
1021 |
return True; |
return True; |
1022 |
} |
} |
1023 |
|
|
1024 |
void |
void |
1025 |
|
ui_resize_window() |
1026 |
|
{ |
1027 |
|
XSizeHints *sizehints; |
1028 |
|
|
1029 |
|
sizehints = XAllocSizeHints(); |
1030 |
|
if (sizehints) |
1031 |
|
{ |
1032 |
|
sizehints->flags = PMinSize | PMaxSize; |
1033 |
|
sizehints->min_width = sizehints->max_width = g_width; |
1034 |
|
sizehints->min_height = sizehints->max_height = g_height; |
1035 |
|
XSetWMNormalHints(g_display, g_wnd, sizehints); |
1036 |
|
XFree(sizehints); |
1037 |
|
} |
1038 |
|
|
1039 |
|
if (!(g_fullscreen || g_embed_wnd)) |
1040 |
|
{ |
1041 |
|
XResizeWindow(g_display, g_wnd, g_width, g_height); |
1042 |
|
} |
1043 |
|
} |
1044 |
|
|
1045 |
|
void |
1046 |
ui_destroy_window(void) |
ui_destroy_window(void) |
1047 |
{ |
{ |
1048 |
if (g_IC != NULL) |
if (g_IC != NULL) |
1340 |
int |
int |
1341 |
ui_select(int rdp_socket) |
ui_select(int rdp_socket) |
1342 |
{ |
{ |
1343 |
int n = (rdp_socket > g_x_socket) ? rdp_socket + 1 : g_x_socket + 1; |
int n; |
1344 |
fd_set rfds, wfds; |
fd_set rfds, wfds; |
1345 |
|
struct timeval tv; |
1346 |
|
BOOL s_timeout = False; |
1347 |
|
|
1348 |
while (True) |
while (True) |
1349 |
{ |
{ |
1350 |
|
n = (rdp_socket > g_x_socket) ? rdp_socket : g_x_socket; |
1351 |
/* Process any events already waiting */ |
/* Process any events already waiting */ |
1352 |
if (!xwin_process_events()) |
if (!xwin_process_events()) |
1353 |
/* User quit */ |
/* User quit */ |
1363 |
if (g_dsp_busy) |
if (g_dsp_busy) |
1364 |
{ |
{ |
1365 |
FD_SET(g_dsp_fd, &wfds); |
FD_SET(g_dsp_fd, &wfds); |
1366 |
n = (g_dsp_fd + 1 > n) ? g_dsp_fd + 1 : n; |
n = (g_dsp_fd > n) ? g_dsp_fd : n; |
1367 |
} |
} |
1368 |
#endif |
#endif |
1369 |
|
/* default timeout */ |
1370 |
|
tv.tv_sec = 60; |
1371 |
|
tv.tv_usec = 0; |
1372 |
|
|
1373 |
switch (select(n, &rfds, &wfds, NULL, NULL)) |
/* add redirection handles */ |
1374 |
|
rdpdr_add_fds(&n, &rfds, &wfds, &tv, &s_timeout); |
1375 |
|
|
1376 |
|
n++; |
1377 |
|
|
1378 |
|
switch (select(n, &rfds, &wfds, NULL, &tv)) |
1379 |
{ |
{ |
1380 |
case -1: |
case -1: |
1381 |
error("select: %s\n", strerror(errno)); |
error("select: %s\n", strerror(errno)); |
1382 |
|
|
1383 |
case 0: |
case 0: |
1384 |
|
/* TODO: if tv.tv_sec just times out |
1385 |
|
* we will segfault. |
1386 |
|
* FIXME: |
1387 |
|
*/ |
1388 |
|
//s_timeout = True; |
1389 |
|
//rdpdr_check_fds(&rfds, &wfds, (BOOL) True); |
1390 |
continue; |
continue; |
1391 |
} |
} |
1392 |
|
|
1393 |
|
rdpdr_check_fds(&rfds, &wfds, (BOOL) False); |
1394 |
|
|
1395 |
if (FD_ISSET(rdp_socket, &rfds)) |
if (FD_ISSET(rdp_socket, &rfds)) |
1396 |
return 1; |
return 1; |
1397 |
|
|
1436 |
XPutImage(g_display, bitmap, g_gc, image, 0, 0, 0, 0, width, height); |
XPutImage(g_display, bitmap, g_gc, image, 0, 0, 0, 0, width, height); |
1437 |
|
|
1438 |
XFree(image); |
XFree(image); |
1439 |
if (!g_owncolmap) |
if (tdata != data) |
1440 |
xfree(tdata); |
xfree(tdata); |
1441 |
return (HBITMAP) bitmap; |
return (HBITMAP) bitmap; |
1442 |
} |
} |
1475 |
} |
} |
1476 |
|
|
1477 |
XFree(image); |
XFree(image); |
1478 |
if (!g_owncolmap) |
if (tdata != data) |
1479 |
xfree(tdata); |
xfree(tdata); |
1480 |
} |
} |
1481 |
|
|
1847 |
/* src */ int srcx, int srcy) |
/* src */ int srcx, int srcy) |
1848 |
{ |
{ |
1849 |
SET_FUNCTION(opcode); |
SET_FUNCTION(opcode); |
|
XCopyArea(g_display, g_wnd, g_wnd, g_gc, srcx, srcy, cx, cy, x, y); |
|
1850 |
if (g_ownbackstore) |
if (g_ownbackstore) |
1851 |
|
{ |
1852 |
|
XCopyArea(g_display, g_backstore, g_wnd, g_gc, srcx, srcy, cx, cy, x, y); |
1853 |
XCopyArea(g_display, g_backstore, g_backstore, g_gc, srcx, srcy, cx, cy, x, y); |
XCopyArea(g_display, g_backstore, g_backstore, g_gc, srcx, srcy, cx, cy, x, y); |
1854 |
|
} |
1855 |
|
else |
1856 |
|
{ |
1857 |
|
XCopyArea(g_display, g_wnd, g_wnd, g_gc, srcx, srcy, cx, cy, x, y); |
1858 |
|
} |
1859 |
RESET_FUNCTION(opcode); |
RESET_FUNCTION(opcode); |
1860 |
} |
} |
1861 |
|
|
1992 |
|
|
1993 |
SET_FOREGROUND(bgcolour); |
SET_FOREGROUND(bgcolour); |
1994 |
|
|
1995 |
|
/* Sometimes, the boxcx value is something really large, like |
1996 |
|
32691. This makes XCopyArea fail with Xvnc. The code below |
1997 |
|
is a quick fix. */ |
1998 |
|
if (boxx + boxcx > g_width) |
1999 |
|
boxcx = g_width - boxx; |
2000 |
|
|
2001 |
if (boxcx > 1) |
if (boxcx > 1) |
2002 |
{ |
{ |
2003 |
FILL_RECTANGLE_BACKSTORE(boxx, boxy, boxcx, boxcy); |
FILL_RECTANGLE_BACKSTORE(boxx, boxy, boxcx, boxcy); |