34 |
static Visual *visual; |
static Visual *visual; |
35 |
static int depth; |
static int depth; |
36 |
static int bpp; |
static int bpp; |
37 |
static BOOL backpixmap; |
|
38 |
|
static BOOL ownbackstore; |
39 |
|
static Pixmap backstore; |
40 |
|
|
41 |
|
#define FILL_RECTANGLE(x,y,cx,cy)\ |
42 |
|
{ \ |
43 |
|
XFillRectangle(display, wnd, gc, x, y, cx, cy); \ |
44 |
|
if (ownbackstore) \ |
45 |
|
XFillRectangle(display, backstore, gc, x, y, cx, cy); \ |
46 |
|
} |
47 |
|
|
48 |
static BOOL owncolmap; |
static BOOL owncolmap; |
49 |
static Colormap xcolmap; |
static Colormap xcolmap; |
201 |
attribs.backing_store = DoesBackingStore(screen); |
attribs.backing_store = DoesBackingStore(screen); |
202 |
|
|
203 |
if (attribs.backing_store == NotUseful) |
if (attribs.backing_store == NotUseful) |
204 |
backpixmap = True; |
ownbackstore = True; |
205 |
|
|
206 |
if (fullscreen) |
if (fullscreen) |
207 |
{ |
{ |
249 |
if (sendmotion) |
if (sendmotion) |
250 |
input_mask |= PointerMotionMask; |
input_mask |= PointerMotionMask; |
251 |
|
|
252 |
|
if (ownbackstore) |
253 |
|
input_mask |= ExposureMask; |
254 |
|
|
255 |
XSelectInput(display, wnd, input_mask); |
XSelectInput(display, wnd, input_mask); |
256 |
gc = XCreateGC(display, wnd, 0, NULL); |
gc = XCreateGC(display, wnd, 0, NULL); |
257 |
|
|
258 |
|
if (ownbackstore) |
259 |
|
backstore = XCreatePixmap(display, wnd, width, height, depth); |
260 |
|
|
261 |
XMapWindow(display, wnd); |
XMapWindow(display, wnd); |
262 |
return True; |
return True; |
263 |
} |
} |
265 |
void |
void |
266 |
ui_destroy_window() |
ui_destroy_window() |
267 |
{ |
{ |
268 |
|
if (ownbackstore) |
269 |
|
XFreePixmap(display, backstore); |
270 |
|
|
271 |
XFreeGC(display, gc); |
XFreeGC(display, gc); |
272 |
XDestroyWindow(display, wnd); |
XDestroyWindow(display, wnd); |
273 |
XCloseDisplay(display); |
XCloseDisplay(display); |
416 |
case LeaveNotify: |
case LeaveNotify: |
417 |
XUngrabKeyboard(display, CurrentTime); |
XUngrabKeyboard(display, CurrentTime); |
418 |
break; |
break; |
419 |
|
|
420 |
|
case Expose: |
421 |
|
XCopyArea(display, backstore, wnd, gc, |
422 |
|
event.xexpose.x, event.xexpose.y, |
423 |
|
event.xexpose.width, event.xexpose.height, |
424 |
|
event.xexpose.x, event.xexpose.y); |
425 |
|
break; |
426 |
} |
} |
427 |
} |
} |
428 |
} |
} |
464 |
image = XCreateImage(display, visual, depth, ZPixmap, |
image = XCreateImage(display, visual, depth, ZPixmap, |
465 |
0, tdata, width, height, 8, 0); |
0, tdata, width, height, 8, 0); |
466 |
|
|
467 |
XPutImage(display, wnd, gc, image, 0, 0, x, y, cx, cy); |
if (ownbackstore) |
468 |
|
{ |
469 |
|
XPutImage(display, backstore, gc, image, 0, 0, x, y, cx, cy); |
470 |
|
XCopyArea(display, backstore, wnd, gc, x, y, cx, cy, x, y); |
471 |
|
} |
472 |
|
else |
473 |
|
{ |
474 |
|
XPutImage(display, wnd, gc, image, 0, 0, x, y, cx, cy); |
475 |
|
} |
476 |
|
|
477 |
XFree(image); |
XFree(image); |
478 |
if (!owncolmap) |
if (!owncolmap) |
704 |
/* dest */ int x, int y, int cx, int cy) |
/* dest */ int x, int y, int cx, int cy) |
705 |
{ |
{ |
706 |
SET_FUNCTION(opcode); |
SET_FUNCTION(opcode); |
707 |
XFillRectangle(display, wnd, gc, x, y, cx, cy); |
FILL_RECTANGLE(x, y, cx, cy); |
708 |
RESET_FUNCTION(opcode); |
RESET_FUNCTION(opcode); |
709 |
} |
} |
710 |
|
|
721 |
{ |
{ |
722 |
case 0: /* Solid */ |
case 0: /* Solid */ |
723 |
SET_FOREGROUND(fgcolour); |
SET_FOREGROUND(fgcolour); |
724 |
XFillRectangle(display, wnd, gc, x, y, cx, cy); |
FILL_RECTANGLE(x, y, cx, cy); |
725 |
break; |
break; |
726 |
|
|
727 |
case 3: /* Pattern */ |
case 3: /* Pattern */ |
733 |
XSetStipple(display, gc, fill); |
XSetStipple(display, gc, fill); |
734 |
XSetTSOrigin(display, gc, brush->xorigin, brush->yorigin); |
XSetTSOrigin(display, gc, brush->xorigin, brush->yorigin); |
735 |
|
|
736 |
XFillRectangle(display, wnd, gc, x, y, cx, cy); |
FILL_RECTANGLE(x, y, cx, cy); |
737 |
|
|
738 |
XSetFillStyle(display, gc, FillSolid); |
XSetFillStyle(display, gc, FillSolid); |
739 |
ui_destroy_glyph((HGLYPH)fill); |
ui_destroy_glyph((HGLYPH)fill); |
753 |
{ |
{ |
754 |
SET_FUNCTION(opcode); |
SET_FUNCTION(opcode); |
755 |
XCopyArea(display, wnd, wnd, gc, srcx, srcy, cx, cy, x, y); |
XCopyArea(display, wnd, wnd, gc, srcx, srcy, cx, cy, x, y); |
756 |
|
if (ownbackstore) |
757 |
|
XCopyArea(display, backstore, backstore, gc, srcx, srcy, |
758 |
|
cx, cy, x, y); |
759 |
RESET_FUNCTION(opcode); |
RESET_FUNCTION(opcode); |
760 |
} |
} |
761 |
|
|
766 |
{ |
{ |
767 |
SET_FUNCTION(opcode); |
SET_FUNCTION(opcode); |
768 |
XCopyArea(display, (Pixmap)src, wnd, gc, srcx, srcy, cx, cy, x, y); |
XCopyArea(display, (Pixmap)src, wnd, gc, srcx, srcy, cx, cy, x, y); |
769 |
|
if (ownbackstore) |
770 |
|
XCopyArea(display, (Pixmap)src, backstore, gc, srcx, srcy, |
771 |
|
cx, cy, x, y); |
772 |
RESET_FUNCTION(opcode); |
RESET_FUNCTION(opcode); |
773 |
} |
} |
774 |
|
|
817 |
SET_FUNCTION(opcode); |
SET_FUNCTION(opcode); |
818 |
SET_FOREGROUND(pen->colour); |
SET_FOREGROUND(pen->colour); |
819 |
XDrawLine(display, wnd, gc, startx, starty, endx, endy); |
XDrawLine(display, wnd, gc, startx, starty, endx, endy); |
820 |
|
if (ownbackstore) |
821 |
|
XDrawLine(display, backstore, gc, startx, starty, endx, endy); |
822 |
RESET_FUNCTION(opcode); |
RESET_FUNCTION(opcode); |
823 |
} |
} |
824 |
|
|
828 |
/* brush */ int colour) |
/* brush */ int colour) |
829 |
{ |
{ |
830 |
SET_FOREGROUND(colour); |
SET_FOREGROUND(colour); |
831 |
XFillRectangle(display, wnd, gc, x, y, cx, cy); |
FILL_RECTANGLE(x, y, cx, cy); |
832 |
} |
} |
833 |
|
|
834 |
void |
void |
845 |
XSetStipple(display, gc, (Pixmap)glyph); |
XSetStipple(display, gc, (Pixmap)glyph); |
846 |
XSetTSOrigin(display, gc, x, y); |
XSetTSOrigin(display, gc, x, y); |
847 |
|
|
848 |
XFillRectangle(display, wnd, gc, x, y, cx, cy); |
FILL_RECTANGLE(x, y, cx, cy); |
849 |
|
|
850 |
XSetFillStyle(display, gc, FillSolid); |
XSetFillStyle(display, gc, FillSolid); |
851 |
} |
} |
862 |
SET_FOREGROUND(bgcolour); |
SET_FOREGROUND(bgcolour); |
863 |
|
|
864 |
if (boxcx > 1) |
if (boxcx > 1) |
865 |
XFillRectangle(display, wnd, gc, boxx, boxy, boxcx, boxcy); |
{ |
866 |
|
FILL_RECTANGLE(boxx, boxy, boxcx, boxcy); |
867 |
|
} |
868 |
else if (mixmode == MIX_OPAQUE) |
else if (mixmode == MIX_OPAQUE) |
869 |
XFillRectangle(display, wnd, gc, clipx, clipy, clipcx, clipcy); |
{ |
870 |
|
FILL_RECTANGLE(clipx, clipy, clipcx, clipcy); |
871 |
|
} |
872 |
|
|
873 |
/* Paint text, character by character */ |
/* Paint text, character by character */ |
874 |
for (i = 0; i < length; i++) |
for (i = 0; i < length; i++) |
907 |
Pixmap pix; |
Pixmap pix; |
908 |
XImage *image; |
XImage *image; |
909 |
|
|
910 |
pix = XCreatePixmap(display, wnd, cx, cy, depth); |
if (ownbackstore) |
911 |
XCopyArea(display, wnd, pix, gc, x, y, cx, cy, 0, 0); |
{ |
912 |
|
image = XGetImage(display, backstore, x, y, cx, cy, AllPlanes, |
913 |
image = XGetImage(display, pix, 0, 0, cx, cy, AllPlanes, ZPixmap); |
ZPixmap); |
914 |
|
} |
915 |
|
else |
916 |
|
{ |
917 |
|
pix = XCreatePixmap(display, wnd, cx, cy, depth); |
918 |
|
XCopyArea(display, wnd, pix, gc, x, y, cx, cy, 0, 0); |
919 |
|
image = XGetImage(display, pix, 0, 0, cx, cy, AllPlanes, |
920 |
|
ZPixmap); |
921 |
|
XFreePixmap(display, pix); |
922 |
|
} |
923 |
|
|
924 |
offset *= bpp/8; |
offset *= bpp/8; |
925 |
cache_put_desktop(offset, cx, cy, image->bytes_per_line, |
cache_put_desktop(offset, cx, cy, image->bytes_per_line, |
926 |
bpp/8, image->data); |
bpp/8, image->data); |
927 |
|
|
928 |
XDestroyImage(image); |
XDestroyImage(image); |
|
XFreePixmap(display, pix); |
|
929 |
} |
} |
930 |
|
|
931 |
void |
void |
943 |
0, data, cx, cy, BitmapPad(display), |
0, data, cx, cy, BitmapPad(display), |
944 |
cx * bpp/8); |
cx * bpp/8); |
945 |
|
|
946 |
XPutImage(display, wnd, gc, image, 0, 0, x, y, cx, cy); |
if (ownbackstore) |
947 |
|
{ |
948 |
|
XPutImage(display, backstore, gc, image, 0, 0, x, y, cx, cy); |
949 |
|
XCopyArea(display, backstore, wnd, gc, x, y, cx, cy, x, y); |
950 |
|
} |
951 |
|
else |
952 |
|
{ |
953 |
|
XPutImage(display, wnd, gc, image, 0, 0, x, y, cx, cy); |
954 |
|
} |
955 |
|
|
956 |
XFree(image); |
XFree(image); |
957 |
} |
} |
|
|
|