45 |
Window g_wnd; |
Window g_wnd; |
46 |
extern uint32 g_embed_wnd; |
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 Visual *g_visual; |
static Visual *g_visual; |
51 |
static int g_depth; |
static int g_depth; |
172 |
split_colour15(uint32 colour) |
split_colour15(uint32 colour) |
173 |
{ |
{ |
174 |
PixelColour rv; |
PixelColour rv; |
175 |
rv.red = (colour & 0x7c00) >> 7; |
rv.red = ((colour >> 7) & 0xf8) | ((colour >> 12) & 0x7); |
176 |
rv.green = (colour & 0x03e0) >> 2; |
rv.green = ((colour >> 2) & 0xf8) | ((colour >> 8) & 0x7); |
177 |
rv.blue = (colour & 0x001f) << 3; |
rv.blue = ((colour << 3) & 0xf8) | ((colour >> 2) & 0x7); |
178 |
return rv; |
return rv; |
179 |
} |
} |
180 |
|
|
182 |
split_colour16(uint32 colour) |
split_colour16(uint32 colour) |
183 |
{ |
{ |
184 |
PixelColour rv; |
PixelColour rv; |
185 |
rv.red = (colour & 0xf800) >> 8; |
rv.red = ((colour >> 8) & 0xf8) | ((colour >> 13) & 0x7); |
186 |
rv.green = (colour & 0x07e0) >> 3; |
rv.green = ((colour >> 3) & 0xfc) | ((colour >> 9) & 0x3); |
187 |
rv.blue = (colour & 0x001f) << 3; |
rv.blue = ((colour << 3) & 0xf8) | ((colour >> 2) & 0x7); |
188 |
return rv; |
return rv; |
189 |
} |
} |
190 |
|
|
230 |
return make_colour(pc); |
return make_colour(pc); |
231 |
} |
} |
232 |
|
|
233 |
|
/* indent is confused by UNROLL8 */ |
234 |
|
/* *INDENT-OFF* */ |
235 |
|
|
236 |
|
/* repeat and unroll, similar to bitmap.c */ |
237 |
|
/* potentialy any of the following translate */ |
238 |
|
/* functions can use repeat but just doing */ |
239 |
|
/* the most common ones */ |
240 |
|
|
241 |
#define UNROLL8(stm) { stm stm stm stm stm stm stm stm } |
#define UNROLL8(stm) { stm stm stm stm stm stm stm stm } |
242 |
#define REPEAT(stm) \ |
/* 2 byte output repeat */ |
243 |
|
#define REPEAT2(stm) \ |
244 |
|
{ \ |
245 |
|
while (out <= end - 8 * 2) \ |
246 |
|
UNROLL8(stm) \ |
247 |
|
while (out < end) \ |
248 |
|
{ stm } \ |
249 |
|
} |
250 |
|
/* 4 byte output repeat */ |
251 |
|
#define REPEAT4(stm) \ |
252 |
{ \ |
{ \ |
253 |
while (out <= end - 8 * 4) \ |
while (out <= end - 8 * 4) \ |
254 |
UNROLL8(stm) \ |
UNROLL8(stm) \ |
269 |
uint16 value; |
uint16 value; |
270 |
|
|
271 |
if (g_arch_match) |
if (g_arch_match) |
272 |
REPEAT(*(((uint16*)out)++) = g_colmap[*(data++)];) |
{ |
273 |
|
REPEAT2 |
274 |
|
( |
275 |
|
*((uint16 *) out) = g_colmap[*(data++)]; |
276 |
|
out += 2; |
277 |
|
) |
278 |
|
} |
279 |
else if (g_xserver_be) |
else if (g_xserver_be) |
280 |
{ |
{ |
281 |
while (out < end) |
while (out < end) |
330 |
uint32 value; |
uint32 value; |
331 |
|
|
332 |
if (g_arch_match) |
if (g_arch_match) |
333 |
REPEAT(*(((uint32*)out)++) = g_colmap[*(data++)];) |
{ |
334 |
|
REPEAT4 |
335 |
|
( |
336 |
|
*((uint32 *) out) = g_colmap[*(data++)]; |
337 |
|
out += 4; |
338 |
|
) |
339 |
|
} |
340 |
else if (g_xserver_be) |
else if (g_xserver_be) |
341 |
{ |
{ |
342 |
while (out < end) |
while (out < end) |
361 |
} |
} |
362 |
} |
} |
363 |
|
|
364 |
|
/* *INDENT-ON* */ |
365 |
|
|
366 |
static void |
static void |
367 |
translate15to16(uint16 * data, uint8 * out, uint8 * end) |
translate15to16(uint16 * data, uint8 * out, uint8 * end) |
368 |
{ |
{ |
1037 |
XMaskEvent(g_display, VisibilityChangeMask, &xevent); |
XMaskEvent(g_display, VisibilityChangeMask, &xevent); |
1038 |
} |
} |
1039 |
while (xevent.type != VisibilityNotify); |
while (xevent.type != VisibilityNotify); |
1040 |
|
g_Unobscured = xevent.xvisibility.state == VisibilityUnobscured; |
1041 |
|
|
1042 |
g_focused = False; |
g_focused = False; |
1043 |
g_mouse_in_wnd = False; |
g_mouse_in_wnd = False; |
1058 |
ui_resize_window() |
ui_resize_window() |
1059 |
{ |
{ |
1060 |
XSizeHints *sizehints; |
XSizeHints *sizehints; |
1061 |
|
Pixmap bs; |
1062 |
|
|
1063 |
sizehints = XAllocSizeHints(); |
sizehints = XAllocSizeHints(); |
1064 |
if (sizehints) |
if (sizehints) |
1074 |
{ |
{ |
1075 |
XResizeWindow(g_display, g_wnd, g_width, g_height); |
XResizeWindow(g_display, g_wnd, g_width, g_height); |
1076 |
} |
} |
1077 |
|
|
1078 |
|
/* create new backstore pixmap */ |
1079 |
|
if (g_backstore != 0) |
1080 |
|
{ |
1081 |
|
bs = XCreatePixmap(g_display, g_wnd, g_width, g_height, g_depth); |
1082 |
|
XSetForeground(g_display, g_gc, BlackPixelOfScreen(g_screen)); |
1083 |
|
XFillRectangle(g_display, bs, g_gc, 0, 0, g_width, g_height); |
1084 |
|
XCopyArea(g_display, g_backstore, bs, g_gc, 0, 0, g_width, g_height, 0, 0); |
1085 |
|
XFreePixmap(g_display, g_backstore); |
1086 |
|
g_backstore = bs; |
1087 |
|
} |
1088 |
} |
} |
1089 |
|
|
1090 |
void |
void |
1148 |
|
|
1149 |
switch (xevent.type) |
switch (xevent.type) |
1150 |
{ |
{ |
1151 |
|
case VisibilityNotify: |
1152 |
|
g_Unobscured = xevent.xvisibility.state == VisibilityUnobscured; |
1153 |
|
break; |
1154 |
case ClientMessage: |
case ClientMessage: |
1155 |
/* the window manager told us to quit */ |
/* the window manager told us to quit */ |
1156 |
if ((xevent.xclient.message_type == g_protocol_atom) |
if ((xevent.xclient.message_type == g_protocol_atom) |
1847 |
{ |
{ |
1848 |
case 0: /* Solid */ |
case 0: /* Solid */ |
1849 |
SET_FOREGROUND(fgcolour); |
SET_FOREGROUND(fgcolour); |
1850 |
FILL_RECTANGLE(x, y, cx, cy); |
FILL_RECTANGLE_BACKSTORE(x, y, cx, cy); |
1851 |
break; |
break; |
1852 |
|
|
1853 |
case 2: /* Hatch */ |
case 2: /* Hatch */ |
1858 |
XSetFillStyle(g_display, g_gc, FillOpaqueStippled); |
XSetFillStyle(g_display, g_gc, FillOpaqueStippled); |
1859 |
XSetStipple(g_display, g_gc, fill); |
XSetStipple(g_display, g_gc, fill); |
1860 |
XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin); |
XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin); |
1861 |
FILL_RECTANGLE(x, y, cx, cy); |
FILL_RECTANGLE_BACKSTORE(x, y, cx, cy); |
1862 |
XSetFillStyle(g_display, g_gc, FillSolid); |
XSetFillStyle(g_display, g_gc, FillSolid); |
1863 |
XSetTSOrigin(g_display, g_gc, 0, 0); |
XSetTSOrigin(g_display, g_gc, 0, 0); |
1864 |
ui_destroy_glyph((HGLYPH) fill); |
ui_destroy_glyph((HGLYPH) fill); |
1868 |
for (i = 0; i != 8; i++) |
for (i = 0; i != 8; i++) |
1869 |
ipattern[7 - i] = brush->pattern[i]; |
ipattern[7 - i] = brush->pattern[i]; |
1870 |
fill = (Pixmap) ui_create_glyph(8, 8, ipattern); |
fill = (Pixmap) ui_create_glyph(8, 8, ipattern); |
|
|
|
1871 |
SET_FOREGROUND(bgcolour); |
SET_FOREGROUND(bgcolour); |
1872 |
SET_BACKGROUND(fgcolour); |
SET_BACKGROUND(fgcolour); |
1873 |
XSetFillStyle(g_display, g_gc, FillOpaqueStippled); |
XSetFillStyle(g_display, g_gc, FillOpaqueStippled); |
1874 |
XSetStipple(g_display, g_gc, fill); |
XSetStipple(g_display, g_gc, fill); |
1875 |
XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin); |
XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin); |
1876 |
|
FILL_RECTANGLE_BACKSTORE(x, y, cx, cy); |
|
FILL_RECTANGLE(x, y, cx, cy); |
|
|
|
|
1877 |
XSetFillStyle(g_display, g_gc, FillSolid); |
XSetFillStyle(g_display, g_gc, FillSolid); |
1878 |
XSetTSOrigin(g_display, g_gc, 0, 0); |
XSetTSOrigin(g_display, g_gc, 0, 0); |
1879 |
ui_destroy_glyph((HGLYPH) fill); |
ui_destroy_glyph((HGLYPH) fill); |
1884 |
} |
} |
1885 |
|
|
1886 |
RESET_FUNCTION(opcode); |
RESET_FUNCTION(opcode); |
1887 |
|
|
1888 |
|
if (g_ownbackstore) |
1889 |
|
XCopyArea(g_display, g_backstore, g_wnd, g_gc, x, y, cx, cy, x, y); |
1890 |
} |
} |
1891 |
|
|
1892 |
void |
void |
1897 |
SET_FUNCTION(opcode); |
SET_FUNCTION(opcode); |
1898 |
if (g_ownbackstore) |
if (g_ownbackstore) |
1899 |
{ |
{ |
1900 |
XCopyArea(g_display, g_backstore, g_wnd, g_gc, srcx, srcy, cx, cy, x, y); |
if (g_Unobscured) |
1901 |
XCopyArea(g_display, g_backstore, g_backstore, g_gc, srcx, srcy, cx, cy, x, y); |
{ |
1902 |
|
XCopyArea(g_display, g_wnd, g_wnd, g_gc, srcx, srcy, cx, cy, x, y); |
1903 |
|
XCopyArea(g_display, g_backstore, g_backstore, g_gc, srcx, srcy, cx, cy, x, |
1904 |
|
y); |
1905 |
|
} |
1906 |
|
else |
1907 |
|
{ |
1908 |
|
XCopyArea(g_display, g_backstore, g_wnd, g_gc, srcx, srcy, cx, cy, x, y); |
1909 |
|
XCopyArea(g_display, g_backstore, g_backstore, g_gc, srcx, srcy, cx, cy, x, |
1910 |
|
y); |
1911 |
|
} |
1912 |
} |
} |
1913 |
else |
else |
1914 |
{ |
{ |
2183 |
|
|
2184 |
XFree(image); |
XFree(image); |
2185 |
} |
} |
2186 |
|
|
2187 |
|
/* these do nothing here but are used in uiports */ |
2188 |
|
void |
2189 |
|
ui_begin_update(void) |
2190 |
|
{ |
2191 |
|
} |
2192 |
|
|
2193 |
|
void |
2194 |
|
ui_end_update(void) |
2195 |
|
{ |
2196 |
|
} |