LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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-23-2008, 07:51 PM   #1
mirsoft
LQ Newbie
 
Registered: Oct 2007
Posts: 15

Rep: Reputation: 0
Lightbulb a error when create irregular window using xlib


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
xlib



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
how to draw a bitmap in the window using xlib mirsoft Programming 1 02-10-2008 09:38 AM
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
topmost window with xlib CarzyIvan Programming 0 03-21-2006 03:18 PM
xlib & window titlebar?!?!?! tilo Programming 0 09-25-2004 04:13 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:17 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration