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> |
#include <strings.h> |
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 |
|
BOOL g_Unobscured; /* used for screenblt */ |
49 |
static GC g_gc = NULL; |
static GC g_gc = NULL; |
50 |
|
static GC g_create_bitmap_gc = NULL; |
51 |
|
static GC g_create_glyph_gc = NULL; |
52 |
static Visual *g_visual; |
static Visual *g_visual; |
53 |
static int g_depth; |
static int g_depth; |
54 |
static int g_bpp; |
static int g_bpp; |
60 |
static Atom g_protocol_atom, g_kill_atom; |
static Atom g_protocol_atom, g_kill_atom; |
61 |
static BOOL g_focused; |
static BOOL g_focused; |
62 |
static BOOL g_mouse_in_wnd; |
static BOOL g_mouse_in_wnd; |
63 |
|
static BOOL g_arch_match = False; /* set to True if RGB XServer and little endian */ |
64 |
|
|
65 |
/* endianness */ |
/* endianness */ |
66 |
static BOOL g_host_be; |
static BOOL g_host_be; |
69 |
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; |
70 |
|
|
71 |
/* software backing store */ |
/* software backing store */ |
72 |
static BOOL g_ownbackstore; |
extern BOOL g_ownbackstore; |
73 |
static Pixmap g_backstore = 0; |
static Pixmap g_backstore = 0; |
74 |
|
|
75 |
/* Moving in single app mode */ |
/* Moving in single app mode */ |
118 |
} |
} |
119 |
|
|
120 |
/* colour maps */ |
/* colour maps */ |
121 |
BOOL g_owncolmap = False; |
extern BOOL g_owncolmap; |
122 |
static Colormap g_xcolmap; |
static Colormap g_xcolmap; |
123 |
static uint32 *g_colmap = NULL; |
static uint32 *g_colmap = NULL; |
124 |
|
|
174 |
split_colour15(uint32 colour) |
split_colour15(uint32 colour) |
175 |
{ |
{ |
176 |
PixelColour rv; |
PixelColour rv; |
177 |
rv.red = (colour & 0x7c00) >> 10; |
rv.red = ((colour >> 7) & 0xf8) | ((colour >> 12) & 0x7); |
178 |
rv.red = (rv.red * 0xff) / 0x1f; |
rv.green = ((colour >> 2) & 0xf8) | ((colour >> 8) & 0x7); |
179 |
rv.green = (colour & 0x03e0) >> 5; |
rv.blue = ((colour << 3) & 0xf8) | ((colour >> 2) & 0x7); |
|
rv.green = (rv.green * 0xff) / 0x1f; |
|
|
rv.blue = (colour & 0x1f); |
|
|
rv.blue = (rv.blue * 0xff) / 0x1f; |
|
180 |
return rv; |
return rv; |
181 |
} |
} |
182 |
|
|
184 |
split_colour16(uint32 colour) |
split_colour16(uint32 colour) |
185 |
{ |
{ |
186 |
PixelColour rv; |
PixelColour rv; |
187 |
rv.red = (colour & 0xf800) >> 11; |
rv.red = ((colour >> 8) & 0xf8) | ((colour >> 13) & 0x7); |
188 |
rv.red = (rv.red * 0xff) / 0x1f; |
rv.green = ((colour >> 3) & 0xfc) | ((colour >> 9) & 0x3); |
189 |
rv.green = (colour & 0x07e0) >> 5; |
rv.blue = ((colour << 3) & 0xf8) | ((colour >> 2) & 0x7); |
|
rv.green = (rv.green * 0xff) / 0x3f; |
|
|
rv.blue = (colour & 0x001f); |
|
|
rv.blue = (rv.blue * 0xff) / 0x1f; |
|
190 |
return rv; |
return rv; |
191 |
} |
} |
192 |
|
|
195 |
{ |
{ |
196 |
PixelColour rv; |
PixelColour rv; |
197 |
rv.blue = (colour & 0xff0000) >> 16; |
rv.blue = (colour & 0xff0000) >> 16; |
198 |
rv.green = (colour & 0xff00) >> 8; |
rv.green = (colour & 0x00ff00) >> 8; |
199 |
rv.red = (colour & 0xff); |
rv.red = (colour & 0x0000ff); |
200 |
return rv; |
return rv; |
201 |
} |
} |
202 |
|
|
232 |
return make_colour(pc); |
return make_colour(pc); |
233 |
} |
} |
234 |
|
|
235 |
|
/* indent is confused by UNROLL8 */ |
236 |
|
/* *INDENT-OFF* */ |
237 |
|
|
238 |
|
/* repeat and unroll, similar to bitmap.c */ |
239 |
|
/* potentialy any of the following translate */ |
240 |
|
/* functions can use repeat but just doing */ |
241 |
|
/* the most common ones */ |
242 |
|
|
243 |
|
#define UNROLL8(stm) { stm stm stm stm stm stm stm stm } |
244 |
|
/* 2 byte output repeat */ |
245 |
|
#define REPEAT2(stm) \ |
246 |
|
{ \ |
247 |
|
while (out <= end - 8 * 2) \ |
248 |
|
UNROLL8(stm) \ |
249 |
|
while (out < end) \ |
250 |
|
{ stm } \ |
251 |
|
} |
252 |
|
/* 4 byte output repeat */ |
253 |
|
#define REPEAT4(stm) \ |
254 |
|
{ \ |
255 |
|
while (out <= end - 8 * 4) \ |
256 |
|
UNROLL8(stm) \ |
257 |
|
while (out < end) \ |
258 |
|
{ stm } \ |
259 |
|
} |
260 |
|
|
261 |
static void |
static void |
262 |
translate8to8(uint8 * data, uint8 * out, uint8 * end) |
translate8to8(uint8 * data, uint8 * out, uint8 * end) |
263 |
{ |
{ |
270 |
{ |
{ |
271 |
uint16 value; |
uint16 value; |
272 |
|
|
273 |
while (out < end) |
if (g_arch_match) |
274 |
{ |
{ |
275 |
value = (uint16) g_colmap[*(data++)]; |
REPEAT2 |
276 |
|
( |
277 |
if (g_xserver_be) |
*((uint16 *) out) = g_colmap[*(data++)]; |
278 |
|
out += 2; |
279 |
|
) |
280 |
|
} |
281 |
|
else if (g_xserver_be) |
282 |
|
{ |
283 |
|
while (out < end) |
284 |
{ |
{ |
285 |
|
value = (uint16) g_colmap[*(data++)]; |
286 |
*(out++) = value >> 8; |
*(out++) = value >> 8; |
287 |
*(out++) = value; |
*(out++) = value; |
288 |
} |
} |
289 |
else |
} |
290 |
|
else |
291 |
|
{ |
292 |
|
while (out < end) |
293 |
{ |
{ |
294 |
|
value = (uint16) g_colmap[*(data++)]; |
295 |
*(out++) = value; |
*(out++) = value; |
296 |
*(out++) = value >> 8; |
*(out++) = value >> 8; |
297 |
} |
} |
304 |
{ |
{ |
305 |
uint32 value; |
uint32 value; |
306 |
|
|
307 |
while (out < end) |
if (g_xserver_be) |
308 |
{ |
{ |
309 |
value = g_colmap[*(data++)]; |
while (out < end) |
|
|
|
|
if (g_xserver_be) |
|
310 |
{ |
{ |
311 |
|
value = g_colmap[*(data++)]; |
312 |
*(out++) = value >> 16; |
*(out++) = value >> 16; |
313 |
*(out++) = value >> 8; |
*(out++) = value >> 8; |
314 |
*(out++) = value; |
*(out++) = value; |
315 |
} |
} |
316 |
else |
} |
317 |
|
else |
318 |
|
{ |
319 |
|
while (out < end) |
320 |
{ |
{ |
321 |
|
value = g_colmap[*(data++)]; |
322 |
*(out++) = value; |
*(out++) = value; |
323 |
*(out++) = value >> 8; |
*(out++) = value >> 8; |
324 |
*(out++) = value >> 16; |
*(out++) = value >> 16; |
331 |
{ |
{ |
332 |
uint32 value; |
uint32 value; |
333 |
|
|
334 |
while (out < end) |
if (g_arch_match) |
335 |
{ |
{ |
336 |
value = g_colmap[*(data++)]; |
REPEAT4 |
337 |
|
( |
338 |
if (g_xserver_be) |
*((uint32 *) out) = g_colmap[*(data++)]; |
339 |
|
out += 4; |
340 |
|
) |
341 |
|
} |
342 |
|
else if (g_xserver_be) |
343 |
|
{ |
344 |
|
while (out < end) |
345 |
{ |
{ |
346 |
|
value = g_colmap[*(data++)]; |
347 |
*(out++) = value >> 24; |
*(out++) = value >> 24; |
348 |
*(out++) = value >> 16; |
*(out++) = value >> 16; |
349 |
*(out++) = value >> 8; |
*(out++) = value >> 8; |
350 |
*(out++) = value; |
*(out++) = value; |
351 |
} |
} |
352 |
else |
} |
353 |
|
else |
354 |
|
{ |
355 |
|
while (out < end) |
356 |
{ |
{ |
357 |
|
value = g_colmap[*(data++)]; |
358 |
*(out++) = value; |
*(out++) = value; |
359 |
*(out++) = value >> 8; |
*(out++) = value >> 8; |
360 |
*(out++) = value >> 16; |
*(out++) = value >> 16; |
363 |
} |
} |
364 |
} |
} |
365 |
|
|
366 |
|
/* *INDENT-ON* */ |
367 |
|
|
368 |
static void |
static void |
369 |
translate15to16(uint16 * data, uint8 * out, uint8 * end) |
translate15to16(uint16 * data, uint8 * out, uint8 * end) |
370 |
{ |
{ |
645 |
static uint8 * |
static uint8 * |
646 |
translate_image(int width, int height, uint8 * data) |
translate_image(int width, int height, uint8 * data) |
647 |
{ |
{ |
648 |
int size = width * height * g_bpp / 8; |
int size; |
649 |
uint8 *out = (uint8 *) xmalloc(size); |
uint8 *out; |
650 |
uint8 *end = out + size; |
uint8 *end; |
651 |
|
|
652 |
|
/* if server and xserver bpp match, */ |
653 |
|
/* and arch(endian) matches, no need to translate */ |
654 |
|
/* just return data */ |
655 |
|
if (g_arch_match) |
656 |
|
{ |
657 |
|
if (g_depth == 15 && g_server_bpp == 15) |
658 |
|
return data; |
659 |
|
if (g_depth == 16 && g_server_bpp == 16) |
660 |
|
return data; |
661 |
|
} |
662 |
|
|
663 |
|
size = width * height * (g_bpp / 8); |
664 |
|
out = (uint8 *) xmalloc(size); |
665 |
|
end = out + size; |
666 |
|
|
667 |
switch (g_server_bpp) |
switch (g_server_bpp) |
668 |
{ |
{ |
800 |
TrueColorVisual = True; |
TrueColorVisual = True; |
801 |
} |
} |
802 |
|
|
803 |
|
test = 1; |
804 |
|
g_host_be = !(BOOL) (*(uint8 *) (&test)); |
805 |
|
g_xserver_be = (ImageByteOrder(g_display) == MSBFirst); |
806 |
|
|
807 |
if ((g_server_bpp == 8) && ((!TrueColorVisual) || (g_depth <= 8))) |
if ((g_server_bpp == 8) && ((!TrueColorVisual) || (g_depth <= 8))) |
808 |
{ |
{ |
809 |
/* we use a colourmap, so the default visual should do */ |
/* we use a colourmap, so the default visual should do */ |
830 |
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); |
831 |
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); |
832 |
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); |
833 |
|
|
834 |
|
/* if RGB video and averything is little endian */ |
835 |
|
if (vi.red_mask > vi.green_mask && vi.green_mask > vi.blue_mask) |
836 |
|
if (!g_xserver_be && !g_host_be) |
837 |
|
g_arch_match = True; |
838 |
} |
} |
839 |
|
|
840 |
pfm = XListPixmapFormats(g_display, &i); |
pfm = XListPixmapFormats(g_display, &i); |
868 |
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"); |
869 |
} |
} |
870 |
|
|
871 |
if (DoesBackingStore(g_screen) != Always) |
if ((!g_ownbackstore) && (DoesBackingStore(g_screen) != Always)) |
872 |
|
{ |
873 |
|
warning("External BackingStore not available, using internal\n"); |
874 |
g_ownbackstore = True; |
g_ownbackstore = True; |
875 |
|
} |
|
test = 1; |
|
|
g_host_be = !(BOOL) (*(uint8 *) (&test)); |
|
|
g_xserver_be = (ImageByteOrder(g_display) == MSBFirst); |
|
876 |
|
|
877 |
/* |
/* |
878 |
* Determine desktop size |
* Determine desktop size |
946 |
ui_create_window(void) |
ui_create_window(void) |
947 |
{ |
{ |
948 |
uint8 null_pointer_mask[1] = { 0x80 }; |
uint8 null_pointer_mask[1] = { 0x80 }; |
949 |
uint8 null_pointer_data[4] = { 0x00, 0x00, 0x00, 0x00 }; |
uint8 null_pointer_data[24] = { 0x00 }; |
950 |
|
|
951 |
XSetWindowAttributes attribs; |
XSetWindowAttributes attribs; |
952 |
XClassHint *classhints; |
XClassHint *classhints; |
953 |
XSizeHints *sizehints; |
XSizeHints *sizehints; |
972 |
if (g_gc == NULL) |
if (g_gc == NULL) |
973 |
g_gc = XCreateGC(g_display, g_wnd, 0, NULL); |
g_gc = XCreateGC(g_display, g_wnd, 0, NULL); |
974 |
|
|
975 |
|
if (g_create_bitmap_gc == NULL) |
976 |
|
g_create_bitmap_gc = XCreateGC(g_display, g_wnd, 0, NULL); |
977 |
|
|
978 |
if ((g_ownbackstore) && (g_backstore == 0)) |
if ((g_ownbackstore) && (g_backstore == 0)) |
979 |
{ |
{ |
980 |
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); |
1007 |
XFree(sizehints); |
XFree(sizehints); |
1008 |
} |
} |
1009 |
|
|
1010 |
|
if (g_embed_wnd) |
1011 |
|
{ |
1012 |
|
XReparentWindow(g_display, g_wnd, (Window) g_embed_wnd, 0, 0); |
1013 |
|
} |
1014 |
|
|
1015 |
input_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | |
input_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | |
1016 |
VisibilityChangeMask | FocusChangeMask; |
VisibilityChangeMask | FocusChangeMask; |
1017 |
|
|
1043 |
XMaskEvent(g_display, VisibilityChangeMask, &xevent); |
XMaskEvent(g_display, VisibilityChangeMask, &xevent); |
1044 |
} |
} |
1045 |
while (xevent.type != VisibilityNotify); |
while (xevent.type != VisibilityNotify); |
1046 |
|
g_Unobscured = xevent.xvisibility.state == VisibilityUnobscured; |
1047 |
|
|
1048 |
g_focused = False; |
g_focused = False; |
1049 |
g_mouse_in_wnd = False; |
g_mouse_in_wnd = False; |
1061 |
} |
} |
1062 |
|
|
1063 |
void |
void |
1064 |
|
ui_resize_window() |
1065 |
|
{ |
1066 |
|
XSizeHints *sizehints; |
1067 |
|
Pixmap bs; |
1068 |
|
|
1069 |
|
sizehints = XAllocSizeHints(); |
1070 |
|
if (sizehints) |
1071 |
|
{ |
1072 |
|
sizehints->flags = PMinSize | PMaxSize; |
1073 |
|
sizehints->min_width = sizehints->max_width = g_width; |
1074 |
|
sizehints->min_height = sizehints->max_height = g_height; |
1075 |
|
XSetWMNormalHints(g_display, g_wnd, sizehints); |
1076 |
|
XFree(sizehints); |
1077 |
|
} |
1078 |
|
|
1079 |
|
if (!(g_fullscreen || g_embed_wnd)) |
1080 |
|
{ |
1081 |
|
XResizeWindow(g_display, g_wnd, g_width, g_height); |
1082 |
|
} |
1083 |
|
|
1084 |
|
/* create new backstore pixmap */ |
1085 |
|
if (g_backstore != 0) |
1086 |
|
{ |
1087 |
|
bs = XCreatePixmap(g_display, g_wnd, g_width, g_height, g_depth); |
1088 |
|
XSetForeground(g_display, g_gc, BlackPixelOfScreen(g_screen)); |
1089 |
|
XFillRectangle(g_display, bs, g_gc, 0, 0, g_width, g_height); |
1090 |
|
XCopyArea(g_display, g_backstore, bs, g_gc, 0, 0, g_width, g_height, 0, 0); |
1091 |
|
XFreePixmap(g_display, g_backstore); |
1092 |
|
g_backstore = bs; |
1093 |
|
} |
1094 |
|
} |
1095 |
|
|
1096 |
|
void |
1097 |
ui_destroy_window(void) |
ui_destroy_window(void) |
1098 |
{ |
{ |
1099 |
if (g_IC != NULL) |
if (g_IC != NULL) |
1154 |
|
|
1155 |
switch (xevent.type) |
switch (xevent.type) |
1156 |
{ |
{ |
1157 |
|
case VisibilityNotify: |
1158 |
|
g_Unobscured = xevent.xvisibility.state == VisibilityUnobscured; |
1159 |
|
break; |
1160 |
case ClientMessage: |
case ClientMessage: |
1161 |
/* the window manager told us to quit */ |
/* the window manager told us to quit */ |
1162 |
if ((xevent.xclient.message_type == g_protocol_atom) |
if ((xevent.xclient.message_type == g_protocol_atom) |
1394 |
int |
int |
1395 |
ui_select(int rdp_socket) |
ui_select(int rdp_socket) |
1396 |
{ |
{ |
1397 |
int n = (rdp_socket > g_x_socket) ? rdp_socket : g_x_socket; |
int n; |
1398 |
fd_set rfds, wfds; |
fd_set rfds, wfds; |
1399 |
struct timeval tv; |
struct timeval tv; |
1400 |
BOOL s_timeout = False; |
BOOL s_timeout = False; |
1401 |
|
|
1402 |
while (True) |
while (True) |
1403 |
{ |
{ |
1404 |
|
n = (rdp_socket > g_x_socket) ? rdp_socket : g_x_socket; |
1405 |
/* Process any events already waiting */ |
/* Process any events already waiting */ |
1406 |
if (!xwin_process_events()) |
if (!xwin_process_events()) |
1407 |
/* User quit */ |
/* User quit */ |
1487 |
image = XCreateImage(g_display, g_visual, g_depth, ZPixmap, 0, |
image = XCreateImage(g_display, g_visual, g_depth, ZPixmap, 0, |
1488 |
(char *) tdata, width, height, bitmap_pad, 0); |
(char *) tdata, width, height, bitmap_pad, 0); |
1489 |
|
|
1490 |
XPutImage(g_display, bitmap, g_gc, image, 0, 0, 0, 0, width, height); |
XPutImage(g_display, bitmap, g_create_bitmap_gc, image, 0, 0, 0, 0, width, height); |
1491 |
|
|
1492 |
XFree(image); |
XFree(image); |
1493 |
if (!g_owncolmap) |
if (tdata != data) |
1494 |
xfree(tdata); |
xfree(tdata); |
1495 |
return (HBITMAP) bitmap; |
return (HBITMAP) bitmap; |
1496 |
} |
} |
1529 |
} |
} |
1530 |
|
|
1531 |
XFree(image); |
XFree(image); |
1532 |
if (!g_owncolmap) |
if (tdata != data) |
1533 |
xfree(tdata); |
xfree(tdata); |
1534 |
} |
} |
1535 |
|
|
1545 |
XImage *image; |
XImage *image; |
1546 |
Pixmap bitmap; |
Pixmap bitmap; |
1547 |
int scanline; |
int scanline; |
|
GC gc; |
|
1548 |
|
|
1549 |
scanline = (width + 7) / 8; |
scanline = (width + 7) / 8; |
1550 |
|
|
1551 |
bitmap = XCreatePixmap(g_display, g_wnd, width, height, 1); |
bitmap = XCreatePixmap(g_display, g_wnd, width, height, 1); |
1552 |
gc = XCreateGC(g_display, bitmap, 0, NULL); |
if (g_create_glyph_gc == 0) |
1553 |
|
g_create_glyph_gc = XCreateGC(g_display, bitmap, 0, NULL); |
1554 |
|
|
1555 |
image = XCreateImage(g_display, g_visual, 1, ZPixmap, 0, (char *) data, |
image = XCreateImage(g_display, g_visual, 1, ZPixmap, 0, (char *) data, |
1556 |
width, height, 8, scanline); |
width, height, 8, scanline); |
1558 |
image->bitmap_bit_order = MSBFirst; |
image->bitmap_bit_order = MSBFirst; |
1559 |
XInitImage(image); |
XInitImage(image); |
1560 |
|
|
1561 |
XPutImage(g_display, bitmap, gc, image, 0, 0, 0, 0, width, height); |
XPutImage(g_display, bitmap, g_create_glyph_gc, image, 0, 0, 0, 0, width, height); |
1562 |
|
|
1563 |
XFree(image); |
XFree(image); |
|
XFreeGC(g_display, gc); |
|
1564 |
return (HGLYPH) bitmap; |
return (HGLYPH) bitmap; |
1565 |
} |
} |
1566 |
|
|
1852 |
{ |
{ |
1853 |
case 0: /* Solid */ |
case 0: /* Solid */ |
1854 |
SET_FOREGROUND(fgcolour); |
SET_FOREGROUND(fgcolour); |
1855 |
FILL_RECTANGLE(x, y, cx, cy); |
FILL_RECTANGLE_BACKSTORE(x, y, cx, cy); |
1856 |
break; |
break; |
1857 |
|
|
1858 |
case 2: /* Hatch */ |
case 2: /* Hatch */ |
1863 |
XSetFillStyle(g_display, g_gc, FillOpaqueStippled); |
XSetFillStyle(g_display, g_gc, FillOpaqueStippled); |
1864 |
XSetStipple(g_display, g_gc, fill); |
XSetStipple(g_display, g_gc, fill); |
1865 |
XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin); |
XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin); |
1866 |
FILL_RECTANGLE(x, y, cx, cy); |
FILL_RECTANGLE_BACKSTORE(x, y, cx, cy); |
1867 |
XSetFillStyle(g_display, g_gc, FillSolid); |
XSetFillStyle(g_display, g_gc, FillSolid); |
1868 |
XSetTSOrigin(g_display, g_gc, 0, 0); |
XSetTSOrigin(g_display, g_gc, 0, 0); |
1869 |
ui_destroy_glyph((HGLYPH) fill); |
ui_destroy_glyph((HGLYPH) fill); |
1873 |
for (i = 0; i != 8; i++) |
for (i = 0; i != 8; i++) |
1874 |
ipattern[7 - i] = brush->pattern[i]; |
ipattern[7 - i] = brush->pattern[i]; |
1875 |
fill = (Pixmap) ui_create_glyph(8, 8, ipattern); |
fill = (Pixmap) ui_create_glyph(8, 8, ipattern); |
|
|
|
1876 |
SET_FOREGROUND(bgcolour); |
SET_FOREGROUND(bgcolour); |
1877 |
SET_BACKGROUND(fgcolour); |
SET_BACKGROUND(fgcolour); |
1878 |
XSetFillStyle(g_display, g_gc, FillOpaqueStippled); |
XSetFillStyle(g_display, g_gc, FillOpaqueStippled); |
1879 |
XSetStipple(g_display, g_gc, fill); |
XSetStipple(g_display, g_gc, fill); |
1880 |
XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin); |
XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin); |
1881 |
|
FILL_RECTANGLE_BACKSTORE(x, y, cx, cy); |
|
FILL_RECTANGLE(x, y, cx, cy); |
|
|
|
|
1882 |
XSetFillStyle(g_display, g_gc, FillSolid); |
XSetFillStyle(g_display, g_gc, FillSolid); |
1883 |
XSetTSOrigin(g_display, g_gc, 0, 0); |
XSetTSOrigin(g_display, g_gc, 0, 0); |
1884 |
ui_destroy_glyph((HGLYPH) fill); |
ui_destroy_glyph((HGLYPH) fill); |
1889 |
} |
} |
1890 |
|
|
1891 |
RESET_FUNCTION(opcode); |
RESET_FUNCTION(opcode); |
1892 |
|
|
1893 |
|
if (g_ownbackstore) |
1894 |
|
XCopyArea(g_display, g_backstore, g_wnd, g_gc, x, y, cx, cy, x, y); |
1895 |
} |
} |
1896 |
|
|
1897 |
void |
void |
1900 |
/* src */ int srcx, int srcy) |
/* src */ int srcx, int srcy) |
1901 |
{ |
{ |
1902 |
SET_FUNCTION(opcode); |
SET_FUNCTION(opcode); |
|
XCopyArea(g_display, g_wnd, g_wnd, g_gc, srcx, srcy, cx, cy, x, y); |
|
1903 |
if (g_ownbackstore) |
if (g_ownbackstore) |
1904 |
XCopyArea(g_display, g_backstore, g_backstore, g_gc, srcx, srcy, cx, cy, x, y); |
{ |
1905 |
|
if (g_Unobscured) |
1906 |
|
{ |
1907 |
|
XCopyArea(g_display, g_wnd, g_wnd, g_gc, srcx, srcy, cx, cy, x, y); |
1908 |
|
XCopyArea(g_display, g_backstore, g_backstore, g_gc, srcx, srcy, cx, cy, x, |
1909 |
|
y); |
1910 |
|
} |
1911 |
|
else |
1912 |
|
{ |
1913 |
|
XCopyArea(g_display, g_backstore, g_wnd, g_gc, srcx, srcy, cx, cy, x, y); |
1914 |
|
XCopyArea(g_display, g_backstore, g_backstore, g_gc, srcx, srcy, cx, cy, x, |
1915 |
|
y); |
1916 |
|
} |
1917 |
|
} |
1918 |
|
else |
1919 |
|
{ |
1920 |
|
XCopyArea(g_display, g_wnd, g_wnd, g_gc, srcx, srcy, cx, cy, x, y); |
1921 |
|
} |
1922 |
RESET_FUNCTION(opcode); |
RESET_FUNCTION(opcode); |
1923 |
} |
} |
1924 |
|
|
2055 |
|
|
2056 |
SET_FOREGROUND(bgcolour); |
SET_FOREGROUND(bgcolour); |
2057 |
|
|
2058 |
|
/* Sometimes, the boxcx value is something really large, like |
2059 |
|
32691. This makes XCopyArea fail with Xvnc. The code below |
2060 |
|
is a quick fix. */ |
2061 |
|
if (boxx + boxcx > g_width) |
2062 |
|
boxcx = g_width - boxx; |
2063 |
|
|
2064 |
if (boxcx > 1) |
if (boxcx > 1) |
2065 |
{ |
{ |
2066 |
FILL_RECTANGLE_BACKSTORE(boxx, boxy, boxcx, boxcy); |
FILL_RECTANGLE_BACKSTORE(boxx, boxy, boxcx, boxcy); |
2188 |
|
|
2189 |
XFree(image); |
XFree(image); |
2190 |
} |
} |
2191 |
|
|
2192 |
|
/* these do nothing here but are used in uiports */ |
2193 |
|
void |
2194 |
|
ui_begin_update(void) |
2195 |
|
{ |
2196 |
|
} |
2197 |
|
|
2198 |
|
void |
2199 |
|
ui_end_update(void) |
2200 |
|
{ |
2201 |
|
} |