home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dziuxsolim.rutgers.edu!caip.rutgers.edu!jayesh
- From: jayesh@caip.rutgers.edu (jayesh patel)
- Newsgroups: comp.windows.x
- Subject: Help in using XDrawLine()
- Message-ID: <Jan.12.15.49.54.1993.10085@caip.rutgers.edu>
- Date: 12 Jan 93 20:49:55 GMT
- Organization: Rutgers Univ., New Brunswick, N.J.
- Lines: 47
-
- Hi Friends,
- I am novice to x-window programming. Can anyone tell me
- why line does'nt appear in the window when i run the following program.
-
- #include <stdio.h>
- #include <X11/Xlib.h>
- #include <X11/Xutil.h>
-
- main(argc,argv)
- int argc;
- char **argv;
- {
- int x,y,width,height;
- Display *display;
- Window win,root;
- XEvent event;
- int screen;
- XGCValues value;
- GC gc;
-
- x=atoi(argv[1]);
- y=atoi(argv[2]);
- width=atoi(argv[3]);
- height=atoi(argv[4]);
-
- display = XOpenDisplay(NULL);
- root = XDefaultRootWindow(display);
- win = XCreateSimpleWindow(display,root,x,y,width,height,0,0,0);
-
- XMapWindow(display,win);
- gc = XCreateGC(display,win,0,0);
- screen = DefaultScreen(display);
- XSetForeground(display,gc,BlackPixel(display,screen));
- XSetBackground(display,gc,WhitePixel(display,screen));
-
- while(1)
- {
- XNextEvent(display,&event);
- switch(event.type){
- case Expose:
- XDrawPoint(display,win,gc,10,10);
- XDrawPoint(display,win,gc,20,20);
- XDrawLine(display,win,gc,10,10,20,20);
- break;
- }
- }
- }
-