示例#1
0
        public DockRequest(DockRequest copy)
        {
            applicant = copy.Applicant;
            target    = copy.Target;
            x         = copy.X;
            y         = copy.Y;
            width     = copy.Width;
            height    = copy.Height;
            position  = copy.Position;

            extra = copy.Extra;
        }
示例#2
0
        public DockRequest(DockRequest copy)
        {
            applicant = copy.Applicant;
            target = copy.Target;
            x = copy.X;
            y = copy.Y;
            width = copy.Width;
            height = copy.Height;
            position = copy.Position;

            extra = copy.Extra;
        }
示例#3
0
        private void OnDragBegin(DockItem item)
        {
            /* Set the target to itself so it won't go floating with just a click. */
            request           = new DockRequest();
            request.Applicant = item;
            request.Target    = item;
            request.Position  = DockPlacement.Floating;
            request.Extra     = IntPtr.Zero;

            rectDrawn = false;
            rectOwner = null;
        }
示例#4
0
        public override bool OnDockRequest(int x, int y, ref DockRequest request)
        {
            bool mayDock = false;

            /* we get (x,y) in our allocation coordinates system */

            /* Get item's allocation. */
            Gdk.Rectangle alloc = Allocation;
            int           bw    = (int)BorderWidth;

            /* Get coordinates relative to our window. */
            int relX = x - alloc.X;
            int relY = y - alloc.Y;

            /* Check if coordinates are inside the widget. */
            if (relX > 0 && relX < alloc.Width &&
                relY > 0 && relY < alloc.Height)
            {
                int divider = -1;

                /* It's inside our area. */
                mayDock = true;

                /* these are for calculating the extra docking parameter */
                Requisition other = ((DockItem)request.Applicant).PreferredSize;
                Requisition my    = PreferredSize;

                /* Set docking indicator rectangle to the Dock size. */
                request.X      = bw;
                request.Y      = bw;
                request.Width  = alloc.Width - 2 * bw;
                request.Height = alloc.Height - 2 * bw;
                request.Target = this;

                /* See if it's in the BorderWidth band. */
                if (relX < bw)
                {
                    request.Position = DockPlacement.Left;
                    request.Width    = (int)(request.Width * SplitRatio);
                    divider          = other.Width;
                }
                else if (relX > alloc.Width - bw)
                {
                    request.Position = DockPlacement.Right;
                    request.X       += (int)(request.Width * (1 - SplitRatio));
                    request.Width    = (int)(request.Width * SplitRatio);
                    divider          = Math.Max(0, my.Width - other.Width);
                }
                else if (relY < bw)
                {
                    request.Position = DockPlacement.Top;
                    request.Height   = (int)(request.Height * SplitRatio);
                    divider          = other.Height;
                }
                else if (relY > alloc.Height - bw)
                {
                    request.Position = DockPlacement.Bottom;
                    request.Y       += (int)(request.Height * (1 - SplitRatio));
                    request.Height   = (int)(request.Height * SplitRatio);
                    divider          = Math.Max(0, my.Height - other.Height);
                }
                else                     /* Otherwise try our children. */
                {
                    mayDock = false;
                    DockRequest myRequest = new DockRequest(request);
                    foreach (DockObject item in Children)
                    {
                        if (item.OnDockRequest(relX, relY, ref myRequest))
                        {
                            mayDock = true;
                            request = myRequest;
                            break;
                        }
                    }

                    if (!mayDock)
                    {
                        /* the pointer is on the handle, so snap
                         * to top/bottom or left/right */
                        mayDock = true;

                        if (Orientation == Orientation.Horizontal)
                        {
                            if (relY < alloc.Height / 2)
                            {
                                request.Position = DockPlacement.Top;
                                request.Height   = (int)(request.Height * SplitRatio);
                                divider          = other.Height;
                            }
                            else
                            {
                                request.Position = DockPlacement.Bottom;
                                request.Y       += (int)(request.Height * (1 - SplitRatio));
                                request.Height   = (int)(request.Height * SplitRatio);
                                divider          = Math.Max(0, my.Height - other.Height);
                            }
                        }
                        else
                        {
                            if (relX < alloc.Width / 2)
                            {
                                request.Position = DockPlacement.Left;
                                request.Width    = (int)(request.Width * SplitRatio);
                                divider          = other.Width;
                            }
                            else
                            {
                                request.Position = DockPlacement.Right;
                                request.X       += (int)(request.Width * (1 - SplitRatio));
                                request.Width    = (int)(request.Width * SplitRatio);
                                divider          = Math.Max(0, my.Width - other.Width);
                            }
                        }
                    }
                }

                if (divider >= 0 && request.Position != DockPlacement.Center)
                {
                    request.Extra = divider;
                }

                if (mayDock)
                {
                    /* adjust returned coordinates so they are
                     * relative to our allocation */
                    request.X += alloc.X;
                    request.Y += alloc.Y;
                }
            }

            return(mayDock);
        }
示例#5
0
        private void OnDragMotion(DockItem item, int rootX, int rootY)
        {
            Dock        dock = null;
            int         winX, winY;
            int         x, y;
            bool        mayDock   = false;
            DockRequest myRequest = new DockRequest(request);

            if (item != request.Applicant)
            {
                Console.WriteLine("Dragged item is not the same as the one we started with");
                return;
            }

            /* first look under the pointer */
            Gdk.Window window = Gdk.Window.AtPointer(out winX, out winY);
            if (window != null && window.UserData != IntPtr.Zero)
            {
                /* ok, now get the widget who owns that window and see if we can
                 * get to a Dock by walking up the hierarchy */
                Widget widget = GLib.Object.GetObject(window.UserData, false) as Widget;
                while (widget != null && (!(widget is Dock) ||
                                          (widget is DockObject && ((DockObject)widget).Master != this)))
                {
                    widget = widget.Parent;
                }

                if (widget != null)
                {
                    int winW, winH, depth;

                    /* verify that the pointer is still in that dock
                     * (the user could have moved it) */
                    widget.GdkWindow.GetGeometry(out winX, out winY,
                                                 out winW, out winH,
                                                 out depth);
                    widget.GdkWindow.GetOrigin(out winX, out winY);
                    if (rootX >= winX && rootX < winX + winW &&
                        rootY >= winY && rootY < winY + winH)
                    {
                        dock = widget as Dock;
                    }
                }
            }

            if (dock != null)
            {
                /* translate root coordinates into dock object coordinates
                 * (i.e. widget coordinates) */
                dock.GdkWindow.GetOrigin(out winX, out winY);
                x       = rootX - winX;
                y       = rootY - winY;
                mayDock = dock.OnDockRequest(x, y, ref myRequest);
            }
            else
            {
                /* try to dock the item in all the docks in the ring in turn */
                foreach (Dock topDock in toplevelDocks)
                {
                    if (topDock.GdkWindow == null)
                    {
                        Console.WriteLine("Dock has no GdkWindow: {0}, {1}", topDock.Name, topDock);
                    }

                    /* translate root coordinates into dock object
                     * coordinates (i.e. widget coordinates) */
                    topDock.GdkWindow.GetOrigin(out winX, out winY);
                    x       = rootX - winX;
                    y       = rootY - winY;
                    mayDock = topDock.OnDockRequest(x, y, ref myRequest);
                    if (mayDock)
                    {
                        break;
                    }
                }
            }

            if (!mayDock)
            {
                dock = null;

                myRequest.Target   = Dock.GetTopLevel(item);
                myRequest.Position = DockPlacement.Floating;
                Requisition preferredSize = item.PreferredSize;
                myRequest.Width  = preferredSize.Width;
                myRequest.Height = preferredSize.Height;
                myRequest.X      = rootX - item.DragOffX;
                myRequest.Y      = rootY - item.DragOffY;

                Gdk.Rectangle rect = new Gdk.Rectangle(myRequest.X,
                                                       myRequest.Y,
                                                       myRequest.Width,
                                                       myRequest.Height);

                // setup extra docking information
                myRequest.Extra = rect;
            }

            if (!(myRequest.X == request.X &&
                  myRequest.Y == request.Y &&
                  myRequest.Width == request.Width &&
                  myRequest.Height == request.Height &&
                  dock == rectOwner))
            {
                /* erase the previous rectangle */
                if (rectDrawn)
                {
                    XorRect();
                }
            }

            // set the new values
            request   = myRequest;
            rectOwner = dock;

            /* draw the previous rectangle */
            if (!rectDrawn)
            {
                XorRect();
            }
        }
示例#6
0
        public override bool OnDockRequest(int x, int y, ref DockRequest request)
        {
            /* we get (x,y) in our allocation coordinates system */

            /* Get item's allocation. */
            Gdk.Rectangle alloc = Allocation;

            /* Get coordinates relative to our window. */
            int relX = x - alloc.X;
            int relY = y - alloc.Y;

            /* Location is inside. */
            if (relX > 0 && relX < alloc.Width &&
                relY > 0 && relY < alloc.Height)
            {
                int divider = -1;

                /* these are for calculating the extra docking parameter */
                Requisition other = ((DockItem)request.Applicant).PreferredSize;
                Requisition my    = PreferredSize;

                /* Calculate location in terms of the available space (0-100%). */
                float rx = (float)relX / alloc.Width;
                float ry = (float)relY / alloc.Height;

                /* Determine dock location. */
                if (rx < SplitRatio)
                {
                    request.Position = DockPlacement.Left;
                    divider          = other.Width;
                }
                else if (rx > (1 - SplitRatio))
                {
                    request.Position = DockPlacement.Right;
                    rx      = 1 - rx;
                    divider = Math.Max(0, my.Width - other.Width);
                }
                else if (ry < SplitRatio && ry < rx)
                {
                    request.Position = DockPlacement.Top;
                    divider          = other.Height;
                }
                else if (ry > (1 - SplitRatio) && (1 - ry) < rx)
                {
                    request.Position = DockPlacement.Bottom;
                    divider          = Math.Max(0, my.Height - other.Height);
                }
                else
                {
                    request.Position = DockPlacement.Center;
                }

                /* Reset rectangle coordinates to entire item. */
                request.X      = 0;
                request.Y      = 0;
                request.Width  = alloc.Width;
                request.Height = alloc.Height;

                /* Calculate docking indicator rectangle size for new locations.
                *  Only do this when we're not over the item's current location. */
                if (request.Applicant != this)
                {
                    switch (request.Position)
                    {
                    case DockPlacement.Top:
                        request.Height = (int)(request.Height * SplitRatio);
                        break;

                    case DockPlacement.Bottom:
                        request.Y     += (int)(request.Height * (1 - SplitRatio));
                        request.Height = (int)(request.Height * SplitRatio);
                        break;

                    case DockPlacement.Left:
                        request.Width = (int)(request.Width * SplitRatio);
                        break;

                    case DockPlacement.Right:
                        request.X    += (int)(request.Width * (1 - SplitRatio));
                        request.Width = (int)(request.Width * SplitRatio);
                        break;

                    case DockPlacement.Center:
                        request.X      = (int)(request.Width * SplitRatio / 2);
                        request.Y      = (int)(request.Height * SplitRatio / 2);
                        request.Width  = (int)(request.Width * (1 - SplitRatio / 2)) - request.X;
                        request.Height = (int)(request.Height * (1 - SplitRatio / 2)) - request.Y;
                        break;

                    default:
                        break;
                    }
                }

                /* adjust returned coordinates so they have the same
                 * origin as our window */
                request.X += alloc.X;
                request.Y += alloc.Y;

                /* Set possible target location and return true. */
                request.Target = this;

                /* fill-in other dock information */
                if (request.Position != DockPlacement.Center && divider >= 0)
                {
                    request.Extra = divider;
                }

                return(true);
            }
            else                 /* No docking possible at this location. */
            {
                return(false);
            }
        }
示例#7
0
 public virtual bool OnDockRequest(int x, int y, ref DockRequest request)
 {
     return(false);
 }
示例#8
0
        private void OnDragMotion(DockItem item, int rootX, int rootY)
        {
            Dock dock = null;
            int winX, winY;
            int x, y;
            bool mayDock = false;
            DockRequest myRequest = new DockRequest (request);

            if (item != request.Applicant)  {
                Console.WriteLine ("Dragged item is not the same as the one we started with");
                return;
            }

            /* first look under the pointer */
            Gdk.Window window = Gdk.Window.AtPointer (out winX, out winY);
            if (window != null && window.UserData != IntPtr.Zero) {
                /* ok, now get the widget who owns that window and see if we can
                   get to a Dock by walking up the hierarchy */
                Widget widget = GLib.Object.GetObject (window.UserData, false) as Widget;
                while (widget != null && (!(widget is Dock) ||
                       (widget is DockObject && ((DockObject)widget).Master != this)))
                        widget = widget.Parent;

                if (widget != null) {
                    int winW, winH, depth;

                    /* verify that the pointer is still in that dock
                       (the user could have moved it) */
                    widget.GdkWindow.GetGeometry (out winX, out winY,
                                      out winW, out winH,
                                      out depth);
                    widget.GdkWindow.GetOrigin (out winX, out winY);
                    if (rootX >= winX && rootX < winX + winW &&
                        rootY >= winY && rootY < winY + winH)
                        dock = widget as Dock;
                }
            }

            if (dock != null) {
                /* translate root coordinates into dock object coordinates
                   (i.e. widget coordinates) */
                dock.GdkWindow.GetOrigin (out winX, out winY);
                x = rootX - winX;
                y = rootY - winY;
                mayDock = dock.OnDockRequest (x, y, ref myRequest);
            } else {
                /* try to dock the item in all the docks in the ring in turn */
                foreach (Dock topDock in toplevelDocks) {
                    if (topDock.GdkWindow == null)
                        Console.WriteLine ("Dock has no GdkWindow: {0}, {1}", topDock.Name, topDock);
                    /* translate root coordinates into dock object
                       coordinates (i.e. widget coordinates) */
                    topDock.GdkWindow.GetOrigin (out winX, out winY);
                    x = rootX - winX;
                    y = rootY - winY;
                    mayDock = topDock.OnDockRequest (x, y, ref myRequest);
                    if (mayDock)
                        break;
                }
            }

            if (!mayDock) {
                dock = null;

                myRequest.Target = Dock.GetTopLevel (item);
                myRequest.Position = DockPlacement.Floating;
                Requisition preferredSize = item.PreferredSize;
                myRequest.Width = preferredSize.Width;
                myRequest.Height = preferredSize.Height;
                myRequest.X = rootX - item.DragOffX;
                myRequest.Y = rootY - item.DragOffY;

                Gdk.Rectangle rect = new Gdk.Rectangle (myRequest.X,
                                    myRequest.Y,
                                    myRequest.Width,
                                    myRequest.Height);

                // setup extra docking information
                myRequest.Extra = rect;
            }

            if (!(myRequest.X == request.X &&
                  myRequest.Y == request.Y &&
                  myRequest.Width == request.Width &&
                  myRequest.Height == request.Height &&
                  dock == rectOwner)) {

                /* erase the previous rectangle */
                if (rectDrawn)
                    XorRect ();
            }

            // set the new values
            request = myRequest;
            rectOwner = dock;

            /* draw the previous rectangle */
            if (!rectDrawn)
                XorRect ();
        }
        public override bool OnDockRequest(int x, int y, ref DockRequest request)
        {
            /* we get (x,y) in our allocation coordinates system */

            /* Get item's allocation. */
            Gdk.Rectangle alloc = Allocation;

            /* Get coordinates relative to our window. */
            int relX = x - alloc.X;
            int relY = y - alloc.Y;

            /* Location is inside. */
            if (relX > 0 && relX < alloc.Width &&
                relY > 0 && relY < alloc.Height) {
                int divider = -1;

                /* these are for calculating the extra docking parameter */
                Requisition other = ((DockItem)request.Applicant).PreferredSize;
                Requisition my = PreferredSize;

                /* Calculate location in terms of the available space (0-100%). */
                float rx = (float) relX / alloc.Width;
                float ry = (float) relY / alloc.Height;

                /* Determine dock location. */
                if (rx < SplitRatio) {
                    request.Position = DockPlacement.Left;
                    divider = other.Width;
                } else if (rx > (1 - SplitRatio)) {
                    request.Position = DockPlacement.Right;
                    rx = 1 - rx;
                    divider = Math.Max (0, my.Width - other.Width);
                } else if (ry < SplitRatio && ry < rx) {
                    request.Position = DockPlacement.Top;
                    divider = other.Height;
                } else if (ry > (1 - SplitRatio) && (1 - ry) < rx) {
                    request.Position = DockPlacement.Bottom;
                    divider = Math.Max (0, my.Height - other.Height);
                } else {
                    request.Position = DockPlacement.Center;
                }

                /* Reset rectangle coordinates to entire item. */
                request.X = 0;
                request.Y = 0;
                request.Width = alloc.Width;
                request.Height = alloc.Height;

                /* Calculate docking indicator rectangle size for new locations.
                   Only do this when we're not over the item's current location. */
                if (request.Applicant != this) {
                    switch (request.Position) {
                    case DockPlacement.Top:
                        request.Height = (int)(request.Height * SplitRatio);
                        break;
                    case DockPlacement.Bottom:
                        request.Y += (int)(request.Height * (1 - SplitRatio));
                        request.Height = (int)(request.Height * SplitRatio);
                        break;
                    case DockPlacement.Left:
                        request.Width = (int)(request.Width * SplitRatio);
                        break;
                    case DockPlacement.Right:
                        request.X += (int)(request.Width * (1 - SplitRatio));
                        request.Width = (int)(request.Width * SplitRatio);
                        break;
                    case DockPlacement.Center:
                        request.X = (int)(request.Width * SplitRatio / 2);
                        request.Y = (int)(request.Height * SplitRatio / 2);
                        request.Width = (int)(request.Width * (1 - SplitRatio / 2)) - request.X;
                        request.Height = (int)(request.Height * (1 - SplitRatio / 2)) - request.Y;
                        break;
                    default:
                        break;
                    }
                }

                /* adjust returned coordinates so they have the same
                   origin as our window */
                request.X += alloc.X;
                request.Y += alloc.Y;

                /* Set possible target location and return true. */
                request.Target = this;

                /* fill-in other dock information */
                if (request.Position != DockPlacement.Center && divider >= 0)
                    request.Extra = divider;

                return true;
            } else { /* No docking possible at this location. */
                return false;
            }
        }
示例#10
0
        private void OnDragBegin(DockItem item)
        {
            /* Set the target to itself so it won't go floating with just a click. */
            request = new DockRequest ();
            request.Applicant = item;
            request.Target = item;
            request.Position = DockPlacement.Floating;
            request.Extra = IntPtr.Zero;

            rectDrawn = false;
            rectOwner = null;
        }
示例#11
0
 public virtual bool OnDockRequest(int x, int y, ref DockRequest request)
 {
     return false;
 }
示例#12
0
        public override bool OnDockRequest(int x, int y, ref DockRequest request)
        {
            bool mayDock = false;

            /* we get (x,y) in our allocation coordinates system */

            /* Get item's allocation. */
            Gdk.Rectangle alloc = Allocation;
            int bw = (int)BorderWidth;

            /* Get coordinates relative to our window. */
            int relX = x - alloc.X;
            int relY = y - alloc.Y;

            /* Check if coordinates are inside the widget. */
            if (relX > 0 && relX < alloc.Width &&
                relY > 0 && relY < alloc.Height) {
                    int divider = -1;

                /* It's inside our area. */
                mayDock = true;

                /* these are for calculating the extra docking parameter */
                Requisition other = ((DockItem)request.Applicant).PreferredSize;
                Requisition my = PreferredSize;

                /* Set docking indicator rectangle to the Dock size. */
                request.X = bw;
                request.Y = bw;
                request.Width = alloc.Width - 2 * bw;
                request.Height = alloc.Height - 2 * bw;
                request.Target = this;

                /* See if it's in the BorderWidth band. */
                if (relX < bw) {
                    request.Position = DockPlacement.Left;
                    request.Width = (int)(request.Width * SplitRatio);
                    divider = other.Width;
                } else if (relX > alloc.Width - bw) {
                    request.Position = DockPlacement.Right;
                    request.X += (int)(request.Width * (1 - SplitRatio));
                    request.Width = (int)(request.Width * SplitRatio);
                    divider = Math.Max (0, my.Width - other.Width);
                } else if (relY < bw) {
                    request.Position = DockPlacement.Top;
                    request.Height = (int)(request.Height * SplitRatio);
                    divider = other.Height;
                } else if (relY > alloc.Height - bw) {
                    request.Position = DockPlacement.Bottom;
                    request.Y += (int)(request.Height * (1 - SplitRatio));
                    request.Height = (int)(request.Height * SplitRatio);
                    divider = Math.Max (0, my.Height - other.Height);
                } else { /* Otherwise try our children. */
                    mayDock = false;
                    DockRequest myRequest = new DockRequest (request);
                    foreach (DockObject item in Children) {
                        if (item.OnDockRequest (relX, relY, ref myRequest)) {
                            mayDock = true;
                            request = myRequest;
                            break;
                        }
                    }

                    if (!mayDock) {
                        /* the pointer is on the handle, so snap
                           to top/bottom or left/right */
                        mayDock = true;

                        if (Orientation == Orientation.Horizontal) {
                            if (relY < alloc.Height / 2) {
                                request.Position = DockPlacement.Top;
                                request.Height = (int)(request.Height * SplitRatio);
                                divider = other.Height;
                            } else {
                                request.Position = DockPlacement.Bottom;
                                request.Y += (int)(request.Height * (1 - SplitRatio));
                                request.Height = (int)(request.Height * SplitRatio);
                                divider = Math.Max (0, my.Height - other.Height);
                            }
                        } else {
                            if (relX < alloc.Width / 2) {
                                request.Position = DockPlacement.Left;
                                request.Width = (int)(request.Width * SplitRatio);
                                divider = other.Width;
                            } else {
                                request.Position = DockPlacement.Right;
                                request.X += (int)(request.Width * (1 - SplitRatio));
                                request.Width = (int)(request.Width * SplitRatio);
                                divider = Math.Max (0, my.Width - other.Width);
                            }
                        }
                    }
                }

                if (divider >= 0 && request.Position != DockPlacement.Center)
                    request.Extra = divider;

                if (mayDock) {
                    /* adjust returned coordinates so they are
                       relative to our allocation */
                    request.X += alloc.X;
                    request.Y += alloc.Y;
                }
            }

            return mayDock;
        }
示例#13
0
        public override bool OnDockRequest(int x, int y, ref DockRequest request)
        {
            bool mayDock = false;

            /* we get (x,y) in our allocation coordinates system */

            /* Get dock size. */
            Gdk.Rectangle alloc = Allocation;
            int bw = (int)BorderWidth;

            /* Get coordinates relative to our allocation area. */
            int relX = x - alloc.X;
            int relY = y - alloc.Y;

            /* Check if coordinates are in GdlDock widget. */
            if (relX > 0 && relX < alloc.Width &&
                relY > 0 && relY < alloc.Height) {

                /* It's inside our area. */
                mayDock = true;

                /* Set docking indicator rectangle to the Dock size. */
                request.X = alloc.X + bw;
                request.Y = alloc.Y + bw;
                request.Width = alloc.Width - 2 * bw;
                request.Height = alloc.Height - 2 * bw;

                /* If Dock has no root item yet, set the dock
                   itself as possible target. */
                if (root == null) {
                    request.Position = DockPlacement.Top;
                    request.Target = this;
                } else {
                    request.Target = root;

                    /* See if it's in the BorderWidth band. */
                    if (relX < bw) {
                        request.Position = DockPlacement.Left;
                        request.Width = (int)(request.Width * SplitRatio);
                    } else if (relX > alloc.Width - bw) {
                        request.Position = DockPlacement.Right;
                        request.X += (int)(request.Width * (1 - SplitRatio));
                        request.Width = (int)(request.Width * SplitRatio);
                    } else if (relY < bw) {
                        request.Position = DockPlacement.Top;
                        request.Height = (int)(request.Height * SplitRatio);
                    } else if (relY > alloc.Height - bw) {
                        request.Position = DockPlacement.Bottom;
                        request.Y += (int)(request.Height * (1 - SplitRatio));
                        request.Height = (int)(request.Height * SplitRatio);
                    } else {
                        /* Otherwise try our children. */
                        /* give them allocation coordinates
                           (we are a NoWindow widget) */
                        mayDock = root.OnDockRequest (x, y, ref request);
                    }
                }
            }

            return mayDock;
        }
示例#14
0
        public override bool OnDockRequest(int x, int y, ref DockRequest request)
        {
            bool mayDock = false;

            /* we get (x,y) in our allocation coordinates system */

            /* Get dock size. */
            Gdk.Rectangle alloc = Allocation;
            int           bw    = (int)BorderWidth;

            /* Get coordinates relative to our allocation area. */
            int relX = x - alloc.X;
            int relY = y - alloc.Y;

            /* Check if coordinates are in GdlDock widget. */
            if (relX > 0 && relX < alloc.Width &&
                relY > 0 && relY < alloc.Height)
            {
                /* It's inside our area. */
                mayDock = true;

                /* Set docking indicator rectangle to the Dock size. */
                request.X      = alloc.X + bw;
                request.Y      = alloc.Y + bw;
                request.Width  = alloc.Width - 2 * bw;
                request.Height = alloc.Height - 2 * bw;

                /* If Dock has no root item yet, set the dock
                 * itself as possible target. */
                if (root == null)
                {
                    request.Position = DockPlacement.Top;
                    request.Target   = this;
                }
                else
                {
                    request.Target = root;

                    /* See if it's in the BorderWidth band. */
                    if (relX < bw)
                    {
                        request.Position = DockPlacement.Left;
                        request.Width    = (int)(request.Width * SplitRatio);
                    }
                    else if (relX > alloc.Width - bw)
                    {
                        request.Position = DockPlacement.Right;
                        request.X       += (int)(request.Width * (1 - SplitRatio));
                        request.Width    = (int)(request.Width * SplitRatio);
                    }
                    else if (relY < bw)
                    {
                        request.Position = DockPlacement.Top;
                        request.Height   = (int)(request.Height * SplitRatio);
                    }
                    else if (relY > alloc.Height - bw)
                    {
                        request.Position = DockPlacement.Bottom;
                        request.Y       += (int)(request.Height * (1 - SplitRatio));
                        request.Height   = (int)(request.Height * SplitRatio);
                    }
                    else
                    {
                        /* Otherwise try our children. */

                        /* give them allocation coordinates
                         * (we are a NoWindow widget) */
                        mayDock = root.OnDockRequest(x, y, ref request);
                    }
                }
            }

            return(mayDock);
        }