bool HandleMotionTimeout()
        {
            // do scroll
            double newVadj = Vadjustment.Value;

            if (deltaVscroll < 130)
            {
                deltaVscroll += 15;
            }

            Display.GetPointer(out var new_x, out var new_y, out var new_mod);
            GetPointer(out new_x, out new_y);

            if (new_y <= 0)
            {
                newVadj -= deltaVscroll;
                if (newVadj < 0)
                {
                    newVadj = 0;
                }
            }
            else if ((new_y > Allocation.Height) &&
                     (newVadj < Vadjustment.Upper - Allocation.Height - deltaVscroll))
            {
                newVadj += deltaVscroll;
            }
            Vadjustment.Value = newVadj;

            UpdateRubberband();             // (new Point (new_x + (int) Hadjustment.Value, new_y + (int) Vadjustment.Value));

            Vadjustment.ChangeValue();

            // stop firing timeout when no button pressed
            return((new_mod & (ModifierType.Button1Mask | ModifierType.Button3Mask)) != 0);
        }
Пример #2
0
        private void SetSize(int x, int y, int width, int height)
        {
            Hadjustment.Upper = Math.Max(Allocation.Width, width);
            Vadjustment.Upper = Math.Max(Allocation.Height, height);

            bool xchange = scroll && (int)(Hadjustment.Value) != x;
            bool ychange = scroll && (int)(Vadjustment.Value) != y;

            // reset scroll
            scroll = false;

            if (IsRealized)
            {
                BinWindow.FreezeUpdates();
            }

            if (xchange || ychange)
            {
                if (IsRealized)
                {
                    BinWindow.MoveResize(-x, -y, (int)(Hadjustment.Upper), (int)(Vadjustment.Upper));
                }
                Vadjustment.Value = y;
                Hadjustment.Value = x;
            }

            if (this.Width != Allocation.Width || this.Height != Allocation.Height)
            {
                SetSize((uint)Allocation.Width, (uint)height);
            }

            if (xchange || ychange)
            {
                Vadjustment.ChangeValue();
                Hadjustment.ChangeValue();
            }

            if (IsRealized)
            {
                BinWindow.ThawUpdates();
                BinWindow.ProcessUpdates(true);
            }
        }