LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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

Reply
 
Search this Thread
Old 01-24-2008, 01:52 AM   #1
mirsoft
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:
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
 
  


Reply

Tags
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


All times are GMT -5. The time now is 10:06 PM.

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