Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!gem.mps.ohio-state.edu!ginosko!uunet!mcsun!unido!uklirb!incas!tbecker From: tbecker@incas.UUCP (3295) Newsgroups: comp.windows.x Subject: Re: rubberbanding with Xlib Message-ID: <2597@incas.UUCP> Date: 29 Aug 89 07:05:15 GMT References: <303@ccu.UManitoba.CA> <8908212319.AA02977@xenon.lcs.mit.edu> <123886@sun.Eng.Sun.COM> Organization: University of Kaiserslautern, W-Germany Lines: 43 satyen@xwis.Sun.COM (satyendra Dhingra) writes: >Does anyone have a good way of doing rubberbanding with Xlib, by good >I mean where rubberband box keeps up with the cursor. The normal way of >doing rubberbanding >erasebox(flush buffer)-redrawbox(flush buffer)-erasebox.. >requires a roundtrip for each request (batching requests makes it even >worse) and the cursor is always ahead of the box being drawn. Has anyone >worked a solution where rubberbanding box always tracks thr cursor very >closely. I have written several applications with Xlib, using X11R3 on a Sun3/60, each application used rubberbanding as you described it. However, in none of them, the cursor was much ahead of the bounding box, though I have used exactly the same mecahnism as you described above. Maybe this has to do with the way you determine when to move the box. Moving the pointer might generate a great number of PointerMotion events. If you use each of them to update your rubberband, too much action is necessary to follow the pointer. Instead, set the PointerMotionHintMask and consider only PointerMotionEvents with the is_hint member set to NotifyHint. Then use XQueryPointer to get the current pointer location and update your rubberband. This way you make sure the bounding box follows the pointer tightly. >thanks, >satyendra >satyen@sun.com Hope this helps ... Thomas Becker ------------------------------------------------------------------------------- Thomas Becker-----------University of Kaiserslautern---------------West Germany ---------------P.O. 3049------------------------D-6750 Kaiserslautern---------- ---------------------e-mail: incas!tbecker@uklirb.uucp------------------------- --------------------------phone: +49 631 205 3295------------------------------ -------------------------------------------------------------------------------