Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 01-24-2008, 01:52 AM   #1
LQ Newbie
Registered: Oct 2007
Posts: 15

Rep: Reputation: 0
Post 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:
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:
win = XCreateWindow(dpy,
100, 100 ,
w, h,
XDefaultDepth(dpy, screen_num),
CWBackingStore | CWBackPixel | CWOverrideRedirect,
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);

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


window, xlib

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
a error when create irregular window using xlib mirsoft Programming 0 01-23-2008 07:51 PM
how to draw a bitmap in the window using xlib mirsoft Programming 4 01-23-2008 06:56 PM
xlib: how to create a window without title bar mirsoft Programming 3 01-20-2008 06:49 PM
Writing out an XLib window to an image? siepmann Programming 4 06-07-2007 05:32 AM
topmost window with xlib CarzyIvan Programming 0 03-21-2006 03:18 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:56 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration