On Sat, 5 Mar 2016 19:09:00 +0100
=?UTF-8?Q?Heinz-Mario_Fr=c3=bchbeis?= <
D...@Earlybite.individcore.de> wrote:
>Hi,
>
>I'm searching for a way to create a ARGB-window that has its children
>opaque.
I'm afraid I haven't got time to debug your code, but here's a test program
for the shape extension that I wrote some years ago which I think does what
you want. Hope it helps.
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Intrinsic.h>
#include <X11/extensions/shape.h>
int main(int argc, char **argv)
{
Display *display;
Window rootwin;
Window win;
GC gc;
XGCValues gcvals;
XFontStruct *font;
XEvent event;
XRectangle rect[3];
int screen;
int a,b,c;
u_int black,white;
char *text="This demonstrates the use of shapes";
if (!(display=XOpenDisplay(NULL)))
{
fprintf(stderr,"XOpenDisplay(): Can't connect to: %s\n",
XDisplayName(NULL));
return 1;
}
/* See if the shape extension is available on this server */
if (!XQueryExtension(display,"SHAPE",&a,&b,&c))
{
printf("SHAPE extension not available on this X server.\n");
return 1;
}
screen = DefaultScreen(display);
rootwin = RootWindow(display,screen);
black = BlackPixel(display,screen);
white = WhitePixel(display,screen);
/* Make the window big enough to hold the rectangles. Use unmanaged
window if don't want WM stuff around edges */
win = XCreateSimpleWindow(display,rootwin,0,0,400,400,0,black,white);
font = XLoadQueryFont(display,"*9x15");
gcvals.font = font->fid;
gcvals.foreground = black;
gcvals.background = white;
gc = XCreateGC(display,win,GCForeground | GCBackground | GCFont,&gcvals)
;
/* Set up shape */
rect[0].x = 0;
rect[0].y = 0;
rect[0].width = 100;
rect[0].height = 100;
rect[1].x = 100;
rect[1].y = 90;
rect[1].width = 150;
rect[1].height = 100;
rect[2].x = 300;
rect[2].y = 50;
rect[2].width = 90;
rect[2].height = 100;
/* ShapeSet and ShapeSubtract are the most useful */
XShapeCombineRectangles(display,win,0,0,0,rect,3,ShapeSet,0);
XSelectInput(display,win,ExposureMask | PointerMotionMask);
XMapWindow(display,win);
while(1)
{
XNextEvent(display,&event);
XDrawLine(display,win,gc,0,0,500,400);
XDrawString(display,win,gc,0,105,text,strlen(text));
}
return 0;
}
--
Spud