VNC problem with specific appliction's control

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

VNC problem with specific appliction's control

Andre Charbonneau
Hello,

I have a weird problem with a control in a GUI application when using it
  through TightVNC.  I'll try to explain what is happening:

- The application has a special (i.e., custom made) control which allows
the user to click on it and then drag the mouse up and down to shift the
displayed data up and down accordingly.  When the user is satisfied with
the new position, he/she releases the mouse button.

- This control seems to be interfering with the position of the mouse
cursor, in order to constantly re-position it at the initial position
(when the user initially clicked on the control) why the mouse is
dragged.  The consequence of this is that while the user drags the mouse
up and down a bit to adjust the displayed date, the mouse cursor does
not move up and down (it flickers a bit as it is being repositioned by
the application).

- This works all fine when using the application directly, but fails
when using the application through VNC (I tried both TightVNC and
x11vnc).  I think the reason is that the local mouse cursor (on the VNC
viewer side) does move up and down, even though the cursor on the VNC
server side gets repositioned by the application.  So the application is
expecting the cursor events to be located around the initial cursor
position, but instead it receives the cursor position at the viewer side
(which has moved up or down a certain amount) and the calculations are
off, resulting in the data scrolling to act eradically (as if the mouse
was dragged way too far up or down...).





So to test this I modified the VncCanvas code a bit as follows (added
the lines with the Robot instance...):


   public void processNormalProtocol() throws Exception {
(...)
          if (rfb.updateRectEncoding == rfb.EncodingPointerPos) {
             if(inputEnabled) {
               Robot robot = new Robot();
               robot.mouseMove((int)(rx +
this.getLocationOnScreen().getX()),
                 (int)(ry + this.getLocationOnScreen().getY()));
             } else {
               softCursorMove(rx, ry);
             }
            cursorPosReceived = true;
            continue;
          }

Using the above modifications at the viewer side, I can work with the
application's control without any problems.  (i.e., the mouse pointer at
the viewer side also gets repositioned, so the app behaves correctly as
I drag the mouse)

I'm afraid this hack I wrote is probably not the way to handle this
issue correctly, and may result in weird behavior if someone sitting at
the real display moves the mouse (on a shared x11vnc display for example).

Any ideas on how this should be correctly implemented/fixed?

Regards,
        Andre
--
Andre Charbonneau
Research Computing Support, IMSB
National Research Council Canada
100 Sussex Drive, Rm 2025
Ottawa, ON, Canada K1A 0R6
613 993-3129

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
___________________________________________________________
TightVNC mailing list, [hidden email]
To change your subscription or to UNSUBSCRIBE, please visit
https://lists.sourceforge.net/lists/listinfo/vnc-tight-list