home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / windows / x / 14496 < prev    next >
Encoding:
Text File  |  1992-07-28  |  4.0 KB  |  103 lines

  1. Newsgroups: comp.windows.x
  2. Path: sparky!uunet!europa.asd.contel.com!darwin.sura.net!jvnc.net!yale.edu!ira.uka.de!chx400!josef!sinkwitz
  3. From: sinkwitz@ifi.unizh.ch (Rainer Sinkwitz)
  4. Subject: Re: X: User simplicity vs code complexity
  5. Message-ID: <1992Jul28.143441.1968@ifi.unizh.ch>
  6. Sender: sinkwitz@ifi.unizh.ch (Rainer Sinkwitz)
  7. Organization: University of Zurich, Department of Computer Science
  8. References:  <TPAQUETTE.92Jul23134924@gumby.ita.lgc.com>
  9. Date: Tue, 28 Jul 92 14:34:41 GMT
  10. Lines: 91
  11.  
  12.  
  13. In article <TPAQUETTE.92Jul23134924@gumby.ita.lgc.com>, tpaquette@ita.lgc.com (Trevor Paquette) writes:
  14. >    I was talking to a cohort at work and we got to the subject of X and how
  15. >  many lines of code it takes to do things in X etc..
  16. >    I came up with "X is the perfect example of User simplicity is directly
  17. >  proportional to code complexity." Do you agree/disagree with this statement
  18. >  and why?
  19. >  To open up a window, create a button, attach a callback to that button
  20. >  when pushed, released and held, while tracking the mouse, takes up a alot
  21. >  of lines of code. (Granted that will take alot of lines in any GFX system
  22. >  but most likely more in X then any other)
  23. >    To know X and all the in/outs of it takes about 8 700 page manuals (O'Reilly
  24. >  & Associate) to learn. Is there ANYONE out there who knows EVERYTHING in
  25. >  these manuals? X is difficult to learn to program with, basically because
  26. >  you don't know where to start!! There are many calls that do basically the
  27. >  same thing (XAllocColor vs XAllocColorCells).
  28. >    How big is X going to get? When will it stop getting bigger? Who created
  29. >  this monster in the first place? Oh well.. back to those manuals..
  30.  
  31. If you compare the Xlib and IRIS GL on Silicon Graphics you see that 
  32. many things can be done a lot easier.
  33.  
  34. IRIS GL heavily relies on defaults and most of the function calls 
  35. only specify what has not been specified before. 
  36.  
  37. The following opens two windows and draws two different triangles in them:
  38. If you compare Xlib : -------------------------------
  39.  
  40.     XPoint points[3]; 
  41.  
  42.     dpy = XOpenDisplay( (char *) NULL );    /* Initialization */
  43.     screen_num = DefaultScreen(display);
  44.     win1 = XCreateSimpleWindow(display, RootWindow(display,screen_num),
  45.                   x1, y1, width1, height1, border_width, BlackPixel(display,
  46.                   screen_num), WhitePixel(display,screen_num));
  47.     win2 = XCreateSimpleWindow(display, RootWindow(display,screen_num),
  48.                   x2, y2, width2, height2, border_width, BlackPixel(display,
  49.                   screen_num), WhitePixel(display,screen_num));
  50.         gc = DefaultGC(dpy, screen_num);
  51.         .......
  52.         points[0].x = 0;        points[0].y = height-1;   /* Redraw */
  53.         points[1].x = (width-1)/2;    points[1].y = 0;
  54.         points[2].x = width-1;        points[2].y = height-1;
  55.         XDrawLines(dpy, win1, gc, points, 3, CoordModeOrigin);
  56.         
  57.         points[0].x = 0;        points[0].y = 0;
  58.         points[1].x = (width-1)/2;    points[1].y = height-1;
  59.         points[2].x = width-1;        points[2].y = 0;
  60.         XDrawLines(dpy, win3, gc, points, 3, CoordModeOrigin);
  61.         
  62. ... with IRIS GL  : -------------------------------
  63.     
  64.     prefposition(x1, y1);        /* Initialization */
  65.     prefsize(width1, height1);
  66.     win1 = winopen(window_name1);
  67.     
  68.     prefposition(x2, y2);
  69.     prefsize(width2, height2);
  70.     win2 = winopen(window_name2);
  71.     .......
  72.     winset(win1);            /* Redraw */
  73.     bgnclosedline();
  74.     v2i(0, 0);
  75.     v2i((width-1)/2, height-1);
  76.     v2i(width-1, 0);
  77.     endclosedline();
  78.     
  79.     winset(win2);
  80.     bgnclosedline();
  81.     v2i(0, height-1);
  82.     v2i((width-1)/2, 0);
  83.     v2i(width-1, height-1);
  84.     endclosedline();
  85.     
  86. ... you see that IRIS GL is concise and Xlib is not. This mostly also
  87. applies to the rest of the X world as long as the language is C (XView
  88. probably excluded).
  89.  
  90. Desperately waiting for the OpenGL extension... :-)
  91.  
  92. -- 
  93. oooooo    oooo  Rainer Sinkwitz, Multimedia Lab         sinkwitz@ifi.unizh.ch
  94.  $   $   $   "  University of Zurich, Switzerland        VOICE +41-1-257-4346
  95.  $"$$    """"$  Inst.f.Informatik, Winterthurerstr. 190   FAX +41-1-363-00-35
  96. o$o "$o  $ooo"  CH-8057-Z\"urich
  97.