🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.x
Article #24853

Help in using XDrawLine()

#24853
From: jayesh patel
Date: Tue, 12 Jan 1993 20:49
47 lines
1430 bytes
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;
      }
    }
}
Technical Details
Message-ID: <Jan.12.15.49.54.1993.10085@caip.rutgers.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!dziuxsolim.rutgers.edu!caip.rutgers.edu!jayesh

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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