328 |
if (display == NULL) |
if (display == NULL) |
329 |
return; |
return; |
330 |
|
|
331 |
while (XCheckWindowEvent(display, wnd, ~0, &event)) |
while (XCheckMaskEvent(display, ~0, &event)) |
332 |
{ |
{ |
333 |
ev_time = time(NULL); |
ev_time = time(NULL); |
334 |
|
|
863 |
XSetFillStyle(display, gc, FillSolid); |
XSetFillStyle(display, gc, FillSolid); |
864 |
} |
} |
865 |
|
|
866 |
|
#define DO_GLYPH(ttext,idx) \ |
867 |
|
{\ |
868 |
|
glyph = cache_get_font (font, ttext[idx]);\ |
869 |
|
if (!(flags & TEXT2_IMPLICIT_X))\ |
870 |
|
{\ |
871 |
|
xyoffset = ttext[++idx];\ |
872 |
|
if ((xyoffset & 0x80))\ |
873 |
|
{\ |
874 |
|
if (flags & TEXT2_VERTICAL) \ |
875 |
|
y += ttext[++idx] | (ttext[++idx] << 8);\ |
876 |
|
else\ |
877 |
|
x += ttext[++idx] | (ttext[++idx] << 8);\ |
878 |
|
}\ |
879 |
|
else\ |
880 |
|
{\ |
881 |
|
if (flags & TEXT2_VERTICAL) \ |
882 |
|
y += xyoffset;\ |
883 |
|
else\ |
884 |
|
x += xyoffset;\ |
885 |
|
}\ |
886 |
|
}\ |
887 |
|
if (glyph != NULL)\ |
888 |
|
{\ |
889 |
|
ui_draw_glyph (mixmode, x + (short) glyph->offset,\ |
890 |
|
y + (short) glyph->baseline,\ |
891 |
|
glyph->width, glyph->height,\ |
892 |
|
glyph->pixmap, 0, 0, bgcolour, fgcolour);\ |
893 |
|
if (flags & TEXT2_IMPLICIT_X)\ |
894 |
|
x += glyph->width;\ |
895 |
|
}\ |
896 |
|
} |
897 |
|
|
898 |
void |
void |
899 |
ui_draw_text(uint8 font, uint8 flags, int mixmode, int x, int y, |
ui_draw_text(uint8 font, uint8 flags, int mixmode, int x, int y, |
900 |
int clipx, int clipy, int clipcx, int clipcy, |
int clipx, int clipy, int clipcx, int clipcy, int boxx, |
901 |
int boxx, int boxy, int boxcx, int boxcy, |
int boxy, int boxcx, int boxcy, int bgcolour, |
902 |
int bgcolour, int fgcolour, uint8 *text, uint8 length) |
int fgcolour, uint8 * text, uint8 length) |
903 |
{ |
{ |
904 |
FONTGLYPH *glyph; |
FONTGLYPH *glyph; |
905 |
int i, offset; |
int i, j, xyoffset; |
906 |
|
DATABLOB *entry; |
907 |
|
|
908 |
SET_FOREGROUND(bgcolour); |
SET_FOREGROUND(bgcolour); |
909 |
|
|
917 |
} |
} |
918 |
|
|
919 |
/* Paint text, character by character */ |
/* Paint text, character by character */ |
920 |
for (i = 0; i < length; i++) |
for (i = 0; i < length;) { |
921 |
{ |
switch (text[i]) { |
922 |
glyph = cache_get_font(font, text[i]); |
case 0xff: |
923 |
|
if (i + 2 < length) |
924 |
|
cache_put_text(text[i + 1], text, text[i + 2]); |
925 |
|
else { |
926 |
|
error("this shouldn't be happening\n"); |
927 |
|
break; |
928 |
|
} |
929 |
|
/* this will move pointer from start to first character after FF command */ |
930 |
|
length -= i + 3; |
931 |
|
text = &(text[i + 3]); |
932 |
|
i = 0; |
933 |
|
break; |
934 |
|
|
935 |
if (!(flags & TEXT2_IMPLICIT_X)) |
case 0xfe: |
936 |
{ |
entry = cache_get_text(text[i + 1]); |
937 |
offset = text[++i]; |
if (entry != NULL) { |
938 |
if (offset & 0x80) |
if ((((uint8 *) (entry->data))[1] == 0) |
939 |
offset = ((offset & 0x7f) << 8) | text[++i]; |
&& (!(flags & TEXT2_IMPLICIT_X))) { |
940 |
|
if (flags & TEXT2_VERTICAL) |
941 |
|
y += text[i + 2]; |
942 |
|
else |
943 |
|
x += text[i + 2]; |
944 |
|
} |
945 |
|
if (i + 2 < length) |
946 |
|
i += 3; |
947 |
|
else |
948 |
|
i += 2; |
949 |
|
length -= i; |
950 |
|
/* this will move pointer from start to first character after FE command */ |
951 |
|
text = &(text[i]); |
952 |
|
i = 0; |
953 |
|
for (j = 0; j < entry->size; j++) |
954 |
|
DO_GLYPH(((uint8 *) (entry->data)), j); |
955 |
|
} |
956 |
|
break; |
957 |
|
|
958 |
if (flags & TEXT2_VERTICAL) |
default: |
959 |
y += offset; |
DO_GLYPH(text, i); |
960 |
else |
i++; |
961 |
x += offset; |
break; |
962 |
} |
} |
963 |
|
} |
964 |
|
|
|
if (glyph != NULL) |
|
|
{ |
|
|
ui_draw_glyph(mixmode, x + (short) glyph->offset, |
|
|
y + (short) glyph->baseline, |
|
|
glyph->width, glyph->height, |
|
|
glyph->pixmap, 0, 0, |
|
|
bgcolour, fgcolour); |
|
965 |
|
|
|
if (flags & TEXT2_IMPLICIT_X) |
|
|
x += glyph->width; |
|
|
} |
|
|
} |
|
966 |
} |
} |
967 |
|
|
968 |
void |
void |