[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
using Xlib in gdk
- To: linux-il list <linux-il(at-nospam)linux.org.il>
- Subject: using Xlib in gdk
- From: Efraim Yawitz <fyawitz(at-nospam)actcom.co.il>
- Date: Mon, 5 Nov 2001 20:34:26 +0200 (IST)
- Delivered-To: linux.org.il-linux-il@linux.org.il
- Sender: linux-il-bounce(at-nospam)cs.huji.ac.il
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