[Xcb] how to draw a point ?

Jamey Sharp jamey at minilop.net
Sat Nov 6 16:05:18 PST 2004


On Sat, Nov 06, 2004 at 05:07:52PM +0100, Vincent Torri wrote:
> i'm learning xcb (my aim is to port a program to xcb) and i want to draw a
> point in a window.

Cool!

> Here is my short program:
> 
> ...
> 
> I see no point at coord (100, 100). Where is (are) my mistake(s) ?

I see a couple of problems off-hand.

You haven't assigned a value returned from XCBPIXMAPNew to p.pixmap, so
you might have gotten an error that you didn't see. (We have some ideas
about how to make that easier, but for now you probably want to check
for X errors returned by XCBWaitEvent.) So make sure to assign to
p.pixmap before calling XCBCreatePixmap on it.

Also, you haven't copied the contents of your pixmap to your window,
which you should make sure you only do after you've received an Expose
event. I think. (I'm not actually an X expert.)

> In addition, when i close the window, there's a seg fault. Where does it
> come from ?

When you close this window, your window manager is calling XKillClient,
which causes the X server to close the socket connection to your
program. When the connection closes, XCBWaitEvent returns null, which
you're dereferencing in the condition of your switch statement.

> Thank you very much !

Sure!
-- 
Jamey Sharp <jamey at minilop.net> - http://minilop.net/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://freedesktop.org/pipermail/xcb/attachments/20041106/485632c7/attachment.pgp


More information about the xcb mailing list