From: Chang Hu (changhu_at_cs.umd.edu)
Date: Sat Apr 29 2006 - 21:05:37 CDT

John,

I went through the user's guide and succeeded in tracing the
"vmd_pick_mol_silent", resulting in outputing some messae when one
molecule is picked. However, I tried "vmd_pick_client" hoping it will
output the same message whenever the cursor is moved, but with no luck.
In short, I have several problems:

1. How to obtain the mouse position whenever it's moved?
2. How to determine if the mouse is near some atom?

I went through the programmer's guide and got something that returns the
mouse's x and y position, but that's in source code, I still don't know
how to get it via the Tcl script.

Thanks,
 Chang

John Stone wrote:

>Chang,
> That could probably be made to work by disabling the system's mouse
>cursor while your code is active, and querying the mouse position etc
>for yourself. You might be able to prototype this for yourself very
>quickly with VMD 1.8.4 by using the new mouse position callback and
>writing some simple scripts to test the idea on a tiny molecule.
>(no need to recompile the code even)
>You could render the cursor with graphics/draw commands and redraw for
>every mouse position update. If you like I can give you more suggestions
>about this tomorrow when I have a bit more time to talk. For now, you
>might look at the User's Guide section on callbacks, and the Tcl 'trace'
>command. From there you can user the new position callback and the new
>userpoint mouse mode. (see mouse command)
>If you wanted to hack the source code directly rather than prototyping in
>scripting, then you'll need to pick your favorite display device subclass
>and disable the mouse cursor and add cursor rendering there,
>followed by edits to Mouse.C for the new behavior, or something like that.
>
> John Stone
> vmd_at_ks.uiuc.edu
>
>On Thu, Apr 27, 2006 at 01:36:23PM -0400, Chang Hu wrote:
>
>
>>Thanks a lot, John,
>>
>>In that case I'd want to render a cursor inside VMD display because in
>>our system the display of a system window and OpenGL rendering are on
>>seperate screens. Is there any way to do that? I'd imagine getting the
>>mouse movement from the OS and rendering a cursor for each frame
>>rendered. I am not sure if I can creat a Displayable object and if it's
>>the easiest way...
>>
>>Chang
>>
>>
>>John Stone wrote:
>>
>>
>>
>>>Hi,
>>>VMD doesn't actually directly manipulate the mouse cursor position,
>>>this is done completely by the host operating system. The farthest VMD
>>>goes in that direction is to set the active mouse cursor style, among the
>>>choices available on the host operating system. This is the reason you
>>>haven't
>>>found any code of that sort in VMD. All of the important mouse behavior
>>>code is contained in Mouse.C, with the lowest level mouse I/O calls found
>>>in each of the DisplayDevice subclasses for OpenGL, Win32 OpenGL, FLTK,
>>>CAVE, and FreeVR. I'm not even sure there's a means of altering the
>>>mouse acceleration by application control in most windowing systems.
>>>There may be a way to do this on some, but I'm sure you'll find that
>>>to be a difficult thing to write portable code for, if it's even possible.
>>>
>>>John Stone
>>>vmd_at_ks.uiuc.edu
>>>
>>>On Thu, Apr 27, 2006 at 12:19:57AM -0400, Chang Hu wrote:
>>>
>>>
>>>
>>>
>>>>Hi,
>>>>
>>>>I am trying to implement enhanced picking in VMD. To do this, I am
>>>>planning to decrease the mouse speed whenever it's near an atom,
>>>>according to the distance between the mouse cursor and the atom. I
>>>>looked into the Programmer's Guide and had no luck finding related
>>>>source code. (I guess I need the part where the mouse cursor is
>>>>rendered.) Could anybody help me out with this?
>>>>
>>>>Thanks,
>>>>Chang
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>
>
>