20 |
|
|
21 |
#include <X11/Xlib.h> |
#include <X11/Xlib.h> |
22 |
#include <X11/Xutil.h> |
#include <X11/Xutil.h> |
23 |
|
#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 |
|
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; |
65 |
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; |
66 |
|
|
67 |
/* software backing store */ |
/* software backing store */ |
68 |
static BOOL g_ownbackstore; |
BOOL g_ownbackstore = True; /* We can't rely on external BackingStore */ |
69 |
static Pixmap g_backstore; |
static Pixmap g_backstore = 0; |
70 |
|
|
71 |
/* Moving in single app mode */ |
/* Moving in single app mode */ |
72 |
static BOOL g_moving_wnd; |
static BOOL g_moving_wnd; |
170 |
split_colour15(uint32 colour) |
split_colour15(uint32 colour) |
171 |
{ |
{ |
172 |
PixelColour rv; |
PixelColour rv; |
173 |
rv.red = (colour & 0x7c00) >> 10; |
rv.red = (colour & 0x7c00) >> 7; |
174 |
rv.red = (rv.red * 0xff) / 0x1f; |
rv.green = (colour & 0x03e0) >> 2; |
175 |
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; |
|
176 |
return rv; |
return rv; |
177 |
} |
} |
178 |
|
|
180 |
split_colour16(uint32 colour) |
split_colour16(uint32 colour) |
181 |
{ |
{ |
182 |
PixelColour rv; |
PixelColour rv; |
183 |
rv.red = (colour & 0xf800) >> 11; |
rv.red = (colour & 0xf800) >> 8; |
184 |
rv.red = (rv.red * 0xff) / 0x1f; |
rv.green = (colour & 0x07e0) >> 3; |
185 |
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; |
|
186 |
return rv; |
return rv; |
187 |
} |
} |
188 |
|
|
191 |
{ |
{ |
192 |
PixelColour rv; |
PixelColour rv; |
193 |
rv.blue = (colour & 0xff0000) >> 16; |
rv.blue = (colour & 0xff0000) >> 16; |
194 |
rv.green = (colour & 0xff00) >> 8; |
rv.green = (colour & 0x00ff00) >> 8; |
195 |
rv.red = (colour & 0xff); |
rv.red = (colour & 0x0000ff); |
196 |
return rv; |
return rv; |
197 |
} |
} |
198 |
|
|
240 |
{ |
{ |
241 |
uint16 value; |
uint16 value; |
242 |
|
|
243 |
while (out < end) |
if (g_xserver_be) |
244 |
{ |
{ |
245 |
value = (uint16) g_colmap[*(data++)]; |
while (out < end) |
|
|
|
|
if (g_xserver_be) |
|
246 |
{ |
{ |
247 |
|
value = (uint16) g_colmap[*(data++)]; |
248 |
*(out++) = value >> 8; |
*(out++) = value >> 8; |
249 |
*(out++) = value; |
*(out++) = value; |
250 |
} |
} |
251 |
else |
} |
252 |
|
else |
253 |
|
{ |
254 |
|
while (out < end) |
255 |
{ |
{ |
256 |
|
value = (uint16) g_colmap[*(data++)]; |
257 |
*(out++) = value; |
*(out++) = value; |
258 |
*(out++) = value >> 8; |
*(out++) = value >> 8; |
259 |
} |
} |
266 |
{ |
{ |
267 |
uint32 value; |
uint32 value; |
268 |
|
|
269 |
while (out < end) |
if (g_xserver_be) |
270 |
{ |
{ |
271 |
value = g_colmap[*(data++)]; |
while (out < end) |
|
|
|
|
if (g_xserver_be) |
|
272 |
{ |
{ |
273 |
|
value = g_colmap[*(data++)]; |
274 |
*(out++) = value >> 16; |
*(out++) = value >> 16; |
275 |
*(out++) = value >> 8; |
*(out++) = value >> 8; |
276 |
*(out++) = value; |
*(out++) = value; |
277 |
} |
} |
278 |
else |
} |
279 |
|
else |
280 |
|
{ |
281 |
|
while (out < end) |
282 |
{ |
{ |
283 |
|
value = g_colmap[*(data++)]; |
284 |
*(out++) = value; |
*(out++) = value; |
285 |
*(out++) = value >> 8; |
*(out++) = value >> 8; |
286 |
*(out++) = value >> 16; |
*(out++) = value >> 16; |
293 |
{ |
{ |
294 |
uint32 value; |
uint32 value; |
295 |
|
|
296 |
while (out < end) |
if (g_xserver_be) |
297 |
{ |
{ |
298 |
value = g_colmap[*(data++)]; |
while (out < end) |
|
|
|
|
if (g_xserver_be) |
|
299 |
{ |
{ |
300 |
|
value = g_colmap[*(data++)]; |
301 |
*(out++) = value >> 24; |
*(out++) = value >> 24; |
302 |
*(out++) = value >> 16; |
*(out++) = value >> 16; |
303 |
*(out++) = value >> 8; |
*(out++) = value >> 8; |
304 |
*(out++) = value; |
*(out++) = value; |
305 |
} |
} |
306 |
else |
} |
307 |
|
else |
308 |
|
{ |
309 |
|
while (out < end) |
310 |
{ |
{ |
311 |
|
value = g_colmap[*(data++)]; |
312 |
*(out++) = value; |
*(out++) = value; |
313 |
*(out++) = value >> 8; |
*(out++) = value >> 8; |
314 |
*(out++) = value >> 16; |
*(out++) = value >> 16; |
317 |
} |
} |
318 |
} |
} |
319 |
|
|
|
/* todo the remaining translate function might need some big endian check ?? */ |
|
|
|
|
320 |
static void |
static void |
321 |
translate15to16(uint16 * data, uint8 * out, uint8 * end) |
translate15to16(uint16 * data, uint8 * out, uint8 * end) |
322 |
{ |
{ |
547 |
pixel |= *(data++); |
pixel |= *(data++); |
548 |
|
|
549 |
value = make_colour(split_colour24(pixel)); |
value = make_colour(split_colour24(pixel)); |
550 |
|
|
551 |
if (g_xserver_be) |
if (g_xserver_be) |
552 |
{ |
{ |
553 |
*(out++) = value >> 16; |
*(out++) = value >> 16; |
705 |
XVisualInfo vi; |
XVisualInfo vi; |
706 |
XPixmapFormatValues *pfm; |
XPixmapFormatValues *pfm; |
707 |
uint16 test; |
uint16 test; |
708 |
int i, screen_num; |
int i, screen_num, nvisuals; |
709 |
|
XVisualInfo *vmatches = NULL; |
710 |
|
XVisualInfo template; |
711 |
|
Bool TrueColorVisual = False; |
712 |
|
|
713 |
g_display = XOpenDisplay(NULL); |
g_display = XOpenDisplay(NULL); |
714 |
if (g_display == NULL) |
if (g_display == NULL) |
722 |
g_screen = ScreenOfDisplay(g_display, screen_num); |
g_screen = ScreenOfDisplay(g_display, screen_num); |
723 |
g_depth = DefaultDepthOfScreen(g_screen); |
g_depth = DefaultDepthOfScreen(g_screen); |
724 |
|
|
725 |
if (g_server_bpp == 8) |
/* Search for best TrueColor depth */ |
726 |
|
template.class = TrueColor; |
727 |
|
vmatches = XGetVisualInfo(g_display, VisualClassMask, &template, &nvisuals); |
728 |
|
|
729 |
|
nvisuals--; |
730 |
|
while (nvisuals >= 0) |
731 |
|
{ |
732 |
|
if ((vmatches + nvisuals)->depth > g_depth) |
733 |
|
{ |
734 |
|
g_depth = (vmatches + nvisuals)->depth; |
735 |
|
} |
736 |
|
nvisuals--; |
737 |
|
TrueColorVisual = True; |
738 |
|
} |
739 |
|
|
740 |
|
if ((g_server_bpp == 8) && ((!TrueColorVisual) || (g_depth <= 8))) |
741 |
{ |
{ |
742 |
/* we use a colourmap, so any visual should do */ |
/* we use a colourmap, so the default visual should do */ |
743 |
g_visual = DefaultVisualOfScreen(g_screen); |
g_visual = DefaultVisualOfScreen(g_screen); |
744 |
|
g_depth = DefaultDepthOfScreen(g_screen); |
745 |
|
|
746 |
|
/* Do not allocate colours on a TrueColor visual */ |
747 |
|
if (g_visual->class == TrueColor) |
748 |
|
{ |
749 |
|
g_owncolmap = False; |
750 |
|
} |
751 |
} |
} |
752 |
else |
else |
753 |
{ |
{ |
789 |
|
|
790 |
if (!g_owncolmap) |
if (!g_owncolmap) |
791 |
{ |
{ |
792 |
g_xcolmap = DefaultColormapOfScreen(g_screen); |
g_xcolmap = |
793 |
|
XCreateColormap(g_display, RootWindowOfScreen(g_screen), g_visual, |
794 |
|
AllocNone); |
795 |
if (g_depth <= 8) |
if (g_depth <= 8) |
796 |
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"); |
797 |
} |
} |
798 |
|
|
799 |
g_gc = XCreateGC(g_display, RootWindowOfScreen(g_screen), 0, NULL); |
if ((!g_ownbackstore) && (DoesBackingStore(g_screen) != Always)) |
800 |
|
{ |
801 |
if (DoesBackingStore(g_screen) != Always) |
warning("External BackingStore not available, using internal\n"); |
802 |
g_ownbackstore = True; |
g_ownbackstore = True; |
803 |
|
} |
804 |
|
|
805 |
test = 1; |
test = 1; |
806 |
g_host_be = !(BOOL) (*(uint8 *) (&test)); |
g_host_be = !(BOOL) (*(uint8 *) (&test)); |
809 |
/* |
/* |
810 |
* Determine desktop size |
* Determine desktop size |
811 |
*/ |
*/ |
812 |
if (g_width < 0) |
if (g_fullscreen) |
813 |
|
{ |
814 |
|
g_width = WidthOfScreen(g_screen); |
815 |
|
g_height = HeightOfScreen(g_screen); |
816 |
|
} |
817 |
|
else if (g_width < 0) |
818 |
{ |
{ |
819 |
/* Percent of screen */ |
/* Percent of screen */ |
820 |
g_height = HeightOfScreen(g_screen) * (-g_width) / 100; |
g_height = HeightOfScreen(g_screen) * (-g_width) / 100; |
837 |
g_height = 600; |
g_height = 600; |
838 |
} |
} |
839 |
} |
} |
|
else if (g_fullscreen) |
|
|
{ |
|
|
g_width = WidthOfScreen(g_screen); |
|
|
g_height = HeightOfScreen(g_screen); |
|
|
} |
|
840 |
|
|
841 |
/* make sure width is a multiple of 4 */ |
/* make sure width is a multiple of 4 */ |
842 |
g_width = (g_width + 3) & ~3; |
g_width = (g_width + 3) & ~3; |
843 |
|
|
|
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); |
|
|
} |
|
|
|
|
844 |
g_mod_map = XGetModifierMapping(g_display); |
g_mod_map = XGetModifierMapping(g_display); |
845 |
|
|
846 |
xkeymap_init(); |
xkeymap_init(); |
861 |
if (g_IM != NULL) |
if (g_IM != NULL) |
862 |
XCloseIM(g_IM); |
XCloseIM(g_IM); |
863 |
|
|
864 |
|
if (g_null_cursor != NULL) |
865 |
|
ui_destroy_cursor(g_null_cursor); |
866 |
|
|
867 |
XFreeModifiermap(g_mod_map); |
XFreeModifiermap(g_mod_map); |
868 |
|
|
869 |
if (g_ownbackstore) |
if (g_ownbackstore) |
874 |
g_display = NULL; |
g_display = NULL; |
875 |
} |
} |
876 |
|
|
|
#define NULL_POINTER_MASK "\x80" |
|
|
#define NULL_POINTER_DATA "\x0\x0\x0" |
|
|
|
|
877 |
BOOL |
BOOL |
878 |
ui_create_window(void) |
ui_create_window(void) |
879 |
{ |
{ |
880 |
|
uint8 null_pointer_mask[1] = { 0x80 }; |
881 |
|
uint8 null_pointer_data[4] = { 0x00, 0x00, 0x00, 0x00 }; |
882 |
XSetWindowAttributes attribs; |
XSetWindowAttributes attribs; |
883 |
XClassHint *classhints; |
XClassHint *classhints; |
884 |
XSizeHints *sizehints; |
XSizeHints *sizehints; |
890 |
wndheight = g_fullscreen ? HeightOfScreen(g_screen) : g_height; |
wndheight = g_fullscreen ? HeightOfScreen(g_screen) : g_height; |
891 |
|
|
892 |
attribs.background_pixel = BlackPixelOfScreen(g_screen); |
attribs.background_pixel = BlackPixelOfScreen(g_screen); |
893 |
|
attribs.border_pixel = WhitePixelOfScreen(g_screen); |
894 |
attribs.backing_store = g_ownbackstore ? NotUseful : Always; |
attribs.backing_store = g_ownbackstore ? NotUseful : Always; |
895 |
attribs.override_redirect = g_fullscreen; |
attribs.override_redirect = g_fullscreen; |
896 |
|
attribs.colormap = g_xcolmap; |
897 |
|
|
898 |
g_wnd = XCreateWindow(g_display, RootWindowOfScreen(g_screen), 0, 0, wndwidth, wndheight, |
g_wnd = XCreateWindow(g_display, RootWindowOfScreen(g_screen), 0, 0, wndwidth, wndheight, |
899 |
0, CopyFromParent, InputOutput, CopyFromParent, |
0, g_depth, InputOutput, g_visual, |
900 |
CWBackPixel | CWBackingStore | CWOverrideRedirect, &attribs); |
CWBackPixel | CWBackingStore | CWOverrideRedirect | |
901 |
|
CWColormap | CWBorderPixel, &attribs); |
902 |
|
|
903 |
|
if (g_gc == NULL) |
904 |
|
g_gc = XCreateGC(g_display, g_wnd, 0, NULL); |
905 |
|
|
906 |
|
if ((g_ownbackstore) && (g_backstore == 0)) |
907 |
|
{ |
908 |
|
g_backstore = XCreatePixmap(g_display, g_wnd, g_width, g_height, g_depth); |
909 |
|
|
910 |
|
/* clear to prevent rubbish being exposed at startup */ |
911 |
|
XSetForeground(g_display, g_gc, BlackPixelOfScreen(g_screen)); |
912 |
|
XFillRectangle(g_display, g_backstore, g_gc, 0, 0, g_width, g_height); |
913 |
|
} |
914 |
|
|
915 |
XStoreName(g_display, g_wnd, g_title); |
XStoreName(g_display, g_wnd, g_title); |
916 |
|
|
935 |
XFree(sizehints); |
XFree(sizehints); |
936 |
} |
} |
937 |
|
|
938 |
|
if ( g_embed_wnd ) |
939 |
|
{ |
940 |
|
XReparentWindow(g_display, g_wnd, (Window)g_embed_wnd, 0, 0); |
941 |
|
} |
942 |
|
|
943 |
input_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | |
input_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | |
944 |
VisibilityChangeMask | FocusChangeMask; |
VisibilityChangeMask | FocusChangeMask; |
945 |
|
|
981 |
XSetWMProtocols(g_display, g_wnd, &g_kill_atom, 1); |
XSetWMProtocols(g_display, g_wnd, &g_kill_atom, 1); |
982 |
|
|
983 |
/* create invisible 1x1 cursor to be used as null cursor */ |
/* create invisible 1x1 cursor to be used as null cursor */ |
984 |
g_null_cursor = ui_create_cursor(0, 0, 1, 1, NULL_POINTER_MASK, NULL_POINTER_DATA); |
if (g_null_cursor == NULL) |
985 |
|
g_null_cursor = ui_create_cursor(0, 0, 1, 1, null_pointer_mask, null_pointer_data); |
986 |
|
|
987 |
return True; |
return True; |
988 |
} |
} |
990 |
void |
void |
991 |
ui_destroy_window(void) |
ui_destroy_window(void) |
992 |
{ |
{ |
|
ui_destroy_cursor(g_null_cursor); |
|
|
|
|
993 |
if (g_IC != NULL) |
if (g_IC != NULL) |
994 |
XDestroyIC(g_IC); |
XDestroyIC(g_IC); |
995 |
|
|
1033 |
key_translation tr; |
key_translation tr; |
1034 |
char str[256]; |
char str[256]; |
1035 |
Status status; |
Status status; |
|
unsigned int state; |
|
|
Window wdummy; |
|
|
int dummy; |
|
1036 |
|
|
1037 |
while (XPending(g_display) > 0) |
while (XPending(g_display) > 0) |
1038 |
{ |
{ |
1205 |
if (xevent.xfocus.mode == NotifyGrab) |
if (xevent.xfocus.mode == NotifyGrab) |
1206 |
break; |
break; |
1207 |
g_focused = True; |
g_focused = True; |
1208 |
XQueryPointer(g_display, g_wnd, &wdummy, &wdummy, &dummy, &dummy, |
reset_modifier_keys(); |
|
&dummy, &dummy, &state); |
|
|
reset_modifier_keys(state); |
|
1209 |
if (g_grab_keyboard && g_mouse_in_wnd) |
if (g_grab_keyboard && g_mouse_in_wnd) |
1210 |
XGrabKeyboard(g_display, g_wnd, True, |
XGrabKeyboard(g_display, g_wnd, True, |
1211 |
GrabModeAsync, GrabModeAsync, CurrentTime); |
GrabModeAsync, GrabModeAsync, CurrentTime); |
1285 |
int |
int |
1286 |
ui_select(int rdp_socket) |
ui_select(int rdp_socket) |
1287 |
{ |
{ |
1288 |
int n = (rdp_socket > g_x_socket) ? rdp_socket + 1 : g_x_socket + 1; |
int n; |
1289 |
fd_set rfds, wfds; |
fd_set rfds, wfds; |
1290 |
|
struct timeval tv; |
1291 |
|
BOOL s_timeout = False; |
1292 |
|
|
1293 |
while (True) |
while (True) |
1294 |
{ |
{ |
1295 |
|
n = (rdp_socket > g_x_socket) ? rdp_socket : g_x_socket; |
1296 |
/* Process any events already waiting */ |
/* Process any events already waiting */ |
1297 |
if (!xwin_process_events()) |
if (!xwin_process_events()) |
1298 |
/* User quit */ |
/* User quit */ |
1308 |
if (g_dsp_busy) |
if (g_dsp_busy) |
1309 |
{ |
{ |
1310 |
FD_SET(g_dsp_fd, &wfds); |
FD_SET(g_dsp_fd, &wfds); |
1311 |
n = (g_dsp_fd + 1 > n) ? g_dsp_fd + 1 : n; |
n = (g_dsp_fd > n) ? g_dsp_fd : n; |
1312 |
} |
} |
1313 |
#endif |
#endif |
1314 |
|
/* default timeout */ |
1315 |
|
tv.tv_sec = 60; |
1316 |
|
tv.tv_usec = 0; |
1317 |
|
|
1318 |
|
/* add redirection handles */ |
1319 |
|
rdpdr_add_fds(&n, &rfds, &wfds, &tv, &s_timeout); |
1320 |
|
|
1321 |
switch (select(n, &rfds, &wfds, NULL, NULL)) |
n++; |
1322 |
|
|
1323 |
|
switch (select(n, &rfds, &wfds, NULL, &tv)) |
1324 |
{ |
{ |
1325 |
case -1: |
case -1: |
1326 |
error("select: %s\n", strerror(errno)); |
error("select: %s\n", strerror(errno)); |
1327 |
|
|
1328 |
case 0: |
case 0: |
1329 |
|
/* TODO: if tv.tv_sec just times out |
1330 |
|
* we will segfault. |
1331 |
|
* FIXME: |
1332 |
|
*/ |
1333 |
|
//s_timeout = True; |
1334 |
|
//rdpdr_check_fds(&rfds, &wfds, (BOOL) True); |
1335 |
continue; |
continue; |
1336 |
} |
} |
1337 |
|
|
1338 |
|
rdpdr_check_fds(&rfds, &wfds, (BOOL) False); |
1339 |
|
|
1340 |
if (FD_ISSET(rdp_socket, &rfds)) |
if (FD_ISSET(rdp_socket, &rfds)) |
1341 |
return 1; |
return 1; |
1342 |
|
|
1792 |
/* src */ int srcx, int srcy) |
/* src */ int srcx, int srcy) |
1793 |
{ |
{ |
1794 |
SET_FUNCTION(opcode); |
SET_FUNCTION(opcode); |
|
XCopyArea(g_display, g_wnd, g_wnd, g_gc, srcx, srcy, cx, cy, x, y); |
|
1795 |
if (g_ownbackstore) |
if (g_ownbackstore) |
1796 |
|
{ |
1797 |
|
XCopyArea(g_display, g_backstore, g_wnd, g_gc, srcx, srcy, cx, cy, x, y); |
1798 |
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); |
1799 |
|
} |
1800 |
|
else |
1801 |
|
{ |
1802 |
|
XCopyArea(g_display, g_wnd, g_wnd, g_gc, srcx, srcy, cx, cy, x, y); |
1803 |
|
} |
1804 |
RESET_FUNCTION(opcode); |
RESET_FUNCTION(opcode); |
1805 |
} |
} |
1806 |
|
|
1895 |
{\ |
{\ |
1896 |
glyph = cache_get_font (font, ttext[idx]);\ |
glyph = cache_get_font (font, ttext[idx]);\ |
1897 |
if (!(flags & TEXT2_IMPLICIT_X))\ |
if (!(flags & TEXT2_IMPLICIT_X))\ |
1898 |
|
{\ |
1899 |
|
xyoffset = ttext[++idx];\ |
1900 |
|
if ((xyoffset & 0x80))\ |
1901 |
{\ |
{\ |
1902 |
xyoffset = ttext[++idx];\ |
if (flags & TEXT2_VERTICAL)\ |
1903 |
if ((xyoffset & 0x80))\ |
y += ttext[idx+1] | (ttext[idx+2] << 8);\ |
|
{\ |
|
|
if (flags & TEXT2_VERTICAL) \ |
|
|
y += ttext[idx+1] | (ttext[idx+2] << 8);\ |
|
|
else\ |
|
|
x += ttext[idx+1] | (ttext[idx+2] << 8);\ |
|
|
idx += 2;\ |
|
|
}\ |
|
1904 |
else\ |
else\ |
1905 |
{\ |
x += ttext[idx+1] | (ttext[idx+2] << 8);\ |
1906 |
if (flags & TEXT2_VERTICAL) \ |
idx += 2;\ |
|
y += xyoffset;\ |
|
|
else\ |
|
|
x += xyoffset;\ |
|
|
}\ |
|
1907 |
}\ |
}\ |
1908 |
if (glyph != NULL)\ |
else\ |
1909 |
{\ |
{\ |
1910 |
ui_draw_glyph (mixmode, x + glyph->offset,\ |
if (flags & TEXT2_VERTICAL)\ |
1911 |
y + glyph->baseline,\ |
y += xyoffset;\ |
1912 |
glyph->width, glyph->height,\ |
else\ |
1913 |
glyph->pixmap, 0, 0, bgcolour, fgcolour);\ |
x += xyoffset;\ |
|
if (flags & TEXT2_IMPLICIT_X)\ |
|
|
x += glyph->width;\ |
|
1914 |
}\ |
}\ |
1915 |
|
}\ |
1916 |
|
if (glyph != NULL)\ |
1917 |
|
{\ |
1918 |
|
x1 = x + glyph->offset;\ |
1919 |
|
y1 = y + glyph->baseline;\ |
1920 |
|
XSetStipple(g_display, g_gc, (Pixmap) glyph->pixmap);\ |
1921 |
|
XSetTSOrigin(g_display, g_gc, x1, y1);\ |
1922 |
|
FILL_RECTANGLE_BACKSTORE(x1, y1, glyph->width, glyph->height);\ |
1923 |
|
if (flags & TEXT2_IMPLICIT_X)\ |
1924 |
|
x += glyph->width;\ |
1925 |
|
}\ |
1926 |
} |
} |
1927 |
|
|
1928 |
void |
void |
1932 |
int fgcolour, uint8 * text, uint8 length) |
int fgcolour, uint8 * text, uint8 length) |
1933 |
{ |
{ |
1934 |
FONTGLYPH *glyph; |
FONTGLYPH *glyph; |
1935 |
int i, j, xyoffset; |
int i, j, xyoffset, x1, y1; |
1936 |
DATABLOB *entry; |
DATABLOB *entry; |
1937 |
|
|
1938 |
SET_FOREGROUND(bgcolour); |
SET_FOREGROUND(bgcolour); |
1939 |
|
|
1940 |
|
/* Sometimes, the boxcx value is something really large, like |
1941 |
|
32691. This makes XCopyArea fail with Xvnc. The code below |
1942 |
|
is a quick fix. */ |
1943 |
|
if (boxx + boxcx > g_width) |
1944 |
|
boxcx = g_width - boxx; |
1945 |
|
|
1946 |
if (boxcx > 1) |
if (boxcx > 1) |
1947 |
{ |
{ |
1948 |
FILL_RECTANGLE_BACKSTORE(boxx, boxy, boxcx, boxcy); |
FILL_RECTANGLE_BACKSTORE(boxx, boxy, boxcx, boxcy); |
1952 |
FILL_RECTANGLE_BACKSTORE(clipx, clipy, clipcx, clipcy); |
FILL_RECTANGLE_BACKSTORE(clipx, clipy, clipcx, clipcy); |
1953 |
} |
} |
1954 |
|
|
1955 |
|
SET_FOREGROUND(fgcolour); |
1956 |
|
SET_BACKGROUND(bgcolour); |
1957 |
|
XSetFillStyle(g_display, g_gc, FillStippled); |
1958 |
|
|
1959 |
/* Paint text, character by character */ |
/* Paint text, character by character */ |
1960 |
for (i = 0; i < length;) |
for (i = 0; i < length;) |
1961 |
{ |
{ |
2006 |
break; |
break; |
2007 |
} |
} |
2008 |
} |
} |
2009 |
|
|
2010 |
|
XSetFillStyle(g_display, g_gc, FillSolid); |
2011 |
|
|
2012 |
if (g_ownbackstore) |
if (g_ownbackstore) |
2013 |
{ |
{ |
2014 |
if (boxcx > 1) |
if (boxcx > 1) |