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; |
230 |
return make_colour(pc); |
return make_colour(pc); |
231 |
} |
} |
232 |
|
|
233 |
|
#define UNROLL8(stm) { stm stm stm stm stm stm stm stm } |
234 |
|
#define REPEAT(stm) \ |
235 |
|
{ \ |
236 |
|
while (out <= end - 8 * 4) \ |
237 |
|
UNROLL8(stm) \ |
238 |
|
while (out < end) \ |
239 |
|
{ stm } \ |
240 |
|
} |
241 |
|
|
242 |
static void |
static void |
243 |
translate8to8(uint8 * data, uint8 * out, uint8 * end) |
translate8to8(uint8 * data, uint8 * out, uint8 * end) |
244 |
{ |
{ |
251 |
{ |
{ |
252 |
uint16 value; |
uint16 value; |
253 |
|
|
254 |
if (g_xserver_be) |
if (g_arch_match) |
255 |
|
REPEAT(*(((uint16*)out)++) = g_colmap[*(data++)];) |
256 |
|
else if (g_xserver_be) |
257 |
{ |
{ |
258 |
while (out < end) |
while (out < end) |
259 |
{ |
{ |
306 |
{ |
{ |
307 |
uint32 value; |
uint32 value; |
308 |
|
|
309 |
if (g_xserver_be) |
if (g_arch_match) |
310 |
|
REPEAT(*(((uint32*)out)++) = g_colmap[*(data++)];) |
311 |
|
else if (g_xserver_be) |
312 |
{ |
{ |
313 |
while (out < end) |
while (out < end) |
314 |
{ |
{ |
1006 |
XMaskEvent(g_display, VisibilityChangeMask, &xevent); |
XMaskEvent(g_display, VisibilityChangeMask, &xevent); |
1007 |
} |
} |
1008 |
while (xevent.type != VisibilityNotify); |
while (xevent.type != VisibilityNotify); |
1009 |
|
g_Unobscured = xevent.xvisibility.state == VisibilityUnobscured; |
1010 |
|
|
1011 |
g_focused = False; |
g_focused = False; |
1012 |
g_mouse_in_wnd = False; |
g_mouse_in_wnd = False; |
1024 |
} |
} |
1025 |
|
|
1026 |
void |
void |
1027 |
|
ui_resize_window() |
1028 |
|
{ |
1029 |
|
XSizeHints *sizehints; |
1030 |
|
|
1031 |
|
sizehints = XAllocSizeHints(); |
1032 |
|
if (sizehints) |
1033 |
|
{ |
1034 |
|
sizehints->flags = PMinSize | PMaxSize; |
1035 |
|
sizehints->min_width = sizehints->max_width = g_width; |
1036 |
|
sizehints->min_height = sizehints->max_height = g_height; |
1037 |
|
XSetWMNormalHints(g_display, g_wnd, sizehints); |
1038 |
|
XFree(sizehints); |
1039 |
|
} |
1040 |
|
|
1041 |
|
if (!(g_fullscreen || g_embed_wnd)) |
1042 |
|
{ |
1043 |
|
XResizeWindow(g_display, g_wnd, g_width, g_height); |
1044 |
|
} |
1045 |
|
} |
1046 |
|
|
1047 |
|
void |
1048 |
ui_destroy_window(void) |
ui_destroy_window(void) |
1049 |
{ |
{ |
1050 |
if (g_IC != NULL) |
if (g_IC != NULL) |
1105 |
|
|
1106 |
switch (xevent.type) |
switch (xevent.type) |
1107 |
{ |
{ |
1108 |
|
case VisibilityNotify: |
1109 |
|
g_Unobscured = xevent.xvisibility.state == VisibilityUnobscured; |
1110 |
|
break; |
1111 |
case ClientMessage: |
case ClientMessage: |
1112 |
/* the window manager told us to quit */ |
/* the window manager told us to quit */ |
1113 |
if ((xevent.xclient.message_type == g_protocol_atom) |
if ((xevent.xclient.message_type == g_protocol_atom) |
1804 |
{ |
{ |
1805 |
case 0: /* Solid */ |
case 0: /* Solid */ |
1806 |
SET_FOREGROUND(fgcolour); |
SET_FOREGROUND(fgcolour); |
1807 |
FILL_RECTANGLE(x, y, cx, cy); |
FILL_RECTANGLE_BACKSTORE(x, y, cx, cy); |
1808 |
break; |
break; |
1809 |
|
|
1810 |
case 2: /* Hatch */ |
case 2: /* Hatch */ |
1815 |
XSetFillStyle(g_display, g_gc, FillOpaqueStippled); |
XSetFillStyle(g_display, g_gc, FillOpaqueStippled); |
1816 |
XSetStipple(g_display, g_gc, fill); |
XSetStipple(g_display, g_gc, fill); |
1817 |
XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin); |
XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin); |
1818 |
FILL_RECTANGLE(x, y, cx, cy); |
FILL_RECTANGLE_BACKSTORE(x, y, cx, cy); |
1819 |
XSetFillStyle(g_display, g_gc, FillSolid); |
XSetFillStyle(g_display, g_gc, FillSolid); |
1820 |
XSetTSOrigin(g_display, g_gc, 0, 0); |
XSetTSOrigin(g_display, g_gc, 0, 0); |
1821 |
ui_destroy_glyph((HGLYPH) fill); |
ui_destroy_glyph((HGLYPH) fill); |
1825 |
for (i = 0; i != 8; i++) |
for (i = 0; i != 8; i++) |
1826 |
ipattern[7 - i] = brush->pattern[i]; |
ipattern[7 - i] = brush->pattern[i]; |
1827 |
fill = (Pixmap) ui_create_glyph(8, 8, ipattern); |
fill = (Pixmap) ui_create_glyph(8, 8, ipattern); |
|
|
|
1828 |
SET_FOREGROUND(bgcolour); |
SET_FOREGROUND(bgcolour); |
1829 |
SET_BACKGROUND(fgcolour); |
SET_BACKGROUND(fgcolour); |
1830 |
XSetFillStyle(g_display, g_gc, FillOpaqueStippled); |
XSetFillStyle(g_display, g_gc, FillOpaqueStippled); |
1831 |
XSetStipple(g_display, g_gc, fill); |
XSetStipple(g_display, g_gc, fill); |
1832 |
XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin); |
XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin); |
1833 |
|
FILL_RECTANGLE_BACKSTORE(x, y, cx, cy); |
|
FILL_RECTANGLE(x, y, cx, cy); |
|
|
|
|
1834 |
XSetFillStyle(g_display, g_gc, FillSolid); |
XSetFillStyle(g_display, g_gc, FillSolid); |
1835 |
XSetTSOrigin(g_display, g_gc, 0, 0); |
XSetTSOrigin(g_display, g_gc, 0, 0); |
1836 |
ui_destroy_glyph((HGLYPH) fill); |
ui_destroy_glyph((HGLYPH) fill); |
1841 |
} |
} |
1842 |
|
|
1843 |
RESET_FUNCTION(opcode); |
RESET_FUNCTION(opcode); |
1844 |
|
|
1845 |
|
if (g_ownbackstore) |
1846 |
|
XCopyArea(g_display, g_backstore, g_wnd, g_gc, x, y, cx, cy, x, y); |
1847 |
} |
} |
1848 |
|
|
1849 |
void |
void |
1854 |
SET_FUNCTION(opcode); |
SET_FUNCTION(opcode); |
1855 |
if (g_ownbackstore) |
if (g_ownbackstore) |
1856 |
{ |
{ |
1857 |
XCopyArea(g_display, g_backstore, g_wnd, g_gc, srcx, srcy, cx, cy, x, y); |
if (g_Unobscured) |
1858 |
XCopyArea(g_display, g_backstore, g_backstore, g_gc, srcx, srcy, cx, cy, x, y); |
{ |
1859 |
|
XCopyArea(g_display, g_wnd, g_wnd, g_gc, srcx, srcy, cx, cy, x, y); |
1860 |
|
XCopyArea(g_display, g_backstore, g_backstore, g_gc, srcx, srcy, cx, cy, x, y); |
1861 |
|
} |
1862 |
|
else |
1863 |
|
{ |
1864 |
|
XCopyArea(g_display, g_backstore, g_wnd, g_gc, srcx, srcy, cx, cy, x, y); |
1865 |
|
XCopyArea(g_display, g_backstore, g_backstore, g_gc, srcx, srcy, cx, cy, x, y); |
1866 |
|
} |
1867 |
} |
} |
1868 |
else |
else |
1869 |
{ |
{ |