[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

using Xlib in gdk



To gtk/gdk gurus,

Yes, I've searched the web quite a bit on this and even found some code,
but my code doesn't work.

What do I have to do to draw in a window with Xlib functions inside a gtk
program. Here is the code I have, which compiles and runs but doesn't draw
anything:


void xdraw(GtkWidget *window)
{
	Window xwindow;
	Display *xdisplay;
	GdkGC* gc = gdk_gc_new(window->window);
	GC xgc = GDK_GC_XGC(gc);
	xwindow = GDK_WINDOW_XWINDOW(window->window);
	xdisplay = GDK_WINDOW_XDISPLAY(window->window);
	XClearWindow(xdisplay, xwindow);
	XSetForeground(xdisplay, xgc, BlackPixel(xdisplay, DefaultScreen(xdisplay)));
	XSetBackground(xdisplay, xgc, WhitePixel(xdisplay, DefaultScreen(xdisplay)));
	XSetFillStyle(xdisplay, xgc, FillSolid);
	XFillRectangle(xdisplay, xwindow, xgc, 0, 0, 3, 3);
}

(This is a callback which gets called -- I saw it in gdb.)  What am I doing wrong?

TIA,

Ephraim Yawitz


=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il