Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
01-24-2008, 01:52 AM
|
#1
|
|
LQ Newbie
Registered: Oct 2007
Posts: 15
Rep:
|
xlib to create window
i want to create an irregular window using xlib, i use the function: XShapeCombineMask(dpy, win, ShapeBounding, 0, 0, px);
but when i running this application, an error accrues:
Quote:
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 128 (SHAPE)
Minor opcode of failed request: 2 (X_ShapeMask)
Serial number of failed request: 22
Current serial number in output stream: 24
|
and this the codes:
Quote:
win = XCreateWindow(dpy,
XDefaultRootWindow(dpy),
100, 100 ,
w, h,
0,
XDefaultDepth(dpy, screen_num),
InputOutput,
CopyFromParent,
CWBackingStore | CWBackPixel | CWOverrideRedirect,
&attr);
...
RGB rgb[h][w];
memset(rgb, 0, sizeof(RGB) *w * h);
GC gc = XCreateGC(dpy, win, 0, NULL);
char *image32=( char *)malloc(w*h*4);
XImage *im = XCreateImage(dpy, DefaultVisual(dpy, screen_num), 24, ZPixmap, 0, image32, w, h, 32, 0);
unsigned long bk = 0;
if(im == NULL)
return -1;
for(int m = 0; m < h; m++)
for(int n = 0; n < w; n++)
{
fread((void *)&rgb[m][n], 1, sizeof(RGB), fp);
bk = (rgb[m][n].r<<16) + (rgb[m][n].g<<8) + (rgb[m][n].b);
XPutPixel(im, n, m, bk);
}
fclose(fp);
Pixmap px = XCreatePixmap(dpy, win, w, h, 24);
XPutImage(dpy, px, gc, im, 0, 0, 0, 0, w, h);
int t;
XWMHints wmHints;
wmHints.flags = StateHint;
wmHints.initial_state = NormalState;
XSetWMProperties(dpy, win, NULL, NULL, NULL, 0, NULL,
&wmHints, NULL);
XSetTransientForHint(dpy, win, win);
//char *name = "test";
//XQueryExtension(dpy, name, &t, &t, &t);
if(XShapeQueryExtension(dpy, &t, &t) == false)
return -1;
printf("%d\n", t);
XShapeCombineMask(dpy, win, ShapeBounding, 0, 0, px, ShapeSet);
...
|
Guys, who can give me some suggestions or codes to do the work.
tks,best wishs.
Mr. mirsoft
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 11:53 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|