#include #include Display *dsp; Screen *scrn; void drawCB(Widget w, XtPointer client_data, XmDrawingAreaCallbackStruct *cbk) { XEvent *event; GC gc; Window win; int x, y, width, height; XtVaGetValues(w, XmNuserData, &gc, NULL); win = XtWindow(w); y = x = 10; width = 100; height = 50; XDrawPoint(dsp, win, gc, 50, 50); } int main(int argc, char *argv[]) { Widget top, draw; XtAppContext app; XGCValues gcv; GC gc; top = XtVaOpenApplication(&app, "drawm", NULL, 0, &argc, argv, NULL, sessionShellWidgetClass, NULL); draw = XtVaCreateWidget("draw", xmDrawingAreaWidgetClass, top, XmNwidth, 600, XmNheight, 400, NULL); dsp = XtDisplay(draw); scrn = XtScreen(draw); XtAddCallback(draw, XmNexposeCallback, drawCB, NULL); gcv.foreground = BlackPixelOfScreen(scrn); gc = XCreateGC(dsp, RootWindowOfScreen(scrn), GCForeground, &gcv); XtVaSetValues(draw, XmNuserData, gc, NULL); XtManageChild(draw); XtRealizeWidget(top); XtAppMainLoop(app); return 0; }