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

  1. Newsgroups: comp.windows.x
  2. Path: sparky!uunet!iWarp.intel.com|daw
  3. From: daw@iwarp.intel.com (David A. White)
  4. Subject: Scrolling a window....
  5. Message-ID: <1992Jul27.003635.4498@iWarp.intel.com>
  6. Sender: daw@iWarp.intel.com
  7. Nntp-Posting-Host: r0.iwarp.intel.com
  8. Organization: Supercomputer Systems Division, Intel Corp.
  9. References: <1992Jul23.163551.371@cine88.cineca.it> <3352@sicsun.epfl.ch>
  10. Date: Mon, 27 Jul 1992 00:36:35 GMT
  11. Lines: 39
  12.  
  13. I have created a Motif application that allows the editting of a graph.
  14. The graph is displayed inside scrolledwindow (application defined) on a 
  15. drawing area widget
  16.  
  17. The Xlib code draws the graph directly onto the window, using
  18. expose, resize, and motion events.
  19.  
  20. I wanted to scroll the contents of the window efficiently when the user uses 
  21. the scrollbar.
  22.  
  23. I tried using XCopyArea() to do this by first copying from the window to a
  24. Pixmap I created, and then copying from the Pixmap back to the window in a new
  25. location.  This worked fine as long as there was no other window on top of the
  26. window being scrolled.  However, if my drawingarea window was obscured, then
  27. the first XCopyArea() would not get the correct information so garbage would 
  28. appear in the window when it was copied back.  I could not get GraphicsExpose
  29. events from this because the destination is not a window.
  30.  
  31. To fix this, I used XCopyArea() iteratively to move the window to itself in
  32. pieces so GraphicsExpose events would be generated.  This worked, but is very
  33. inefficient if the window is scrolled just a few pixels (requires 
  34. WindowDimension/PixelChange XCopyArea() calls).
  35.  
  36. There MUST be an easy and efficient way to do this, but I can not figure
  37. out what it is.
  38.  
  39. I did think about drawing everything into a Pixmap, and then only using
  40. XCopyArea() to display it in the drawingarea window.  But then I would have to
  41. rewrite a lot of code, and my code new works fine except for this problem.
  42.  
  43. Any suggestions would be greatly appreciated.  Email or a followup post is 
  44. acceptable.
  45.  
  46. - Dave White  daw@iWarp.intel.com
  47. --
  48. Dave White
  49. Compiler/Optimizer Group, iWarp Program, Intel Corporation
  50. Cornell Oaks 4 (Zone 5), just right of A4, Mail Stop CO4-02
  51. W: (503) 629-6315   H:(503) 645-5581
  52.