private void UpdateRemotePointer()
        {
            // HACK: this check insures that while in DesignMode, no messages are sent to a VNC Host
            // (i.e., there won't be one--NullReferenceException)
            if (!DesignMode && IsConnected)
            {
                Point current = PointToClient(MousePosition);
                byte  mask    = 0;

                if (Control.MouseButtons == MouseButtons.Left)
                {
                    mask += 1;
                }
                if (Control.MouseButtons == MouseButtons.Middle)
                {
                    mask += 2;
                }
                if (Control.MouseButtons == MouseButtons.Right)
                {
                    mask += 4;
                }

                Point adjusted = desktopPolicy.UpdateRemotePointer(current);
                if (adjusted.X < 0 || adjusted.Y < 0)
                {
                    throw new Exception();
                }

                vnc.WritePointerEvent(mask, desktopPolicy.UpdateRemotePointer(current));
            }
        }
        private void UpdateRemotePointer()
        {
            // HACK: this check insures that while in DesignMode, no messages are sent to a VNC Host
            // (i.e., there won't be one--NullReferenceException)
            if (DesignMode || !IsConnected)
            {
                return;
            }
            var  current = PointToClient(MousePosition);
            byte mask    = 0;

            if (MouseButtons == MouseButtons.Left)
            {
                mask += 1;
            }
            if (MouseButtons == MouseButtons.Middle)
            {
                mask += 2;
            }
            if (MouseButtons == MouseButtons.Right)
            {
                mask += 4;
            }

            var adjusted = desktopPolicy.GetMouseMoveRectangle();

            if (adjusted.Contains(current))
            {
                vnc.WritePointerEvent(mask, desktopPolicy.UpdateRemotePointer(current));
            }
        }
Esempio n. 3
0
        private void UpdateRemotePointer()
        {
            // HACK: this check insures that while in DesignMode, no messages are sent to a VNC Host
            // (i.e., there won't be one--NullReferenceException)
            if (!DesignMode && IsConnected)
            {
                Point current = PointToClient(MousePosition);
                byte  mask    = 0;

                if (Control.MouseButtons == MouseButtons.Left)
                {
                    mask += 1;
                }
                if (Control.MouseButtons == MouseButtons.Middle)
                {
                    mask += 2;
                }
                if (Control.MouseButtons == MouseButtons.Right)
                {
                    mask += 4;
                }

                // If click not client area -black screen area-, it should ignore current
                Rectangle adjusted = desktopPolicy.GetMouseMoveRectangle();
                if (adjusted.Contains(current))
                {
                    vnc.WritePointerEvent(mask, desktopPolicy.UpdateRemotePointer(current));
                }
            }
        }