protected override bool OnMotionNotifyEvent(EventMotion evnt) { string newTooltip = null; if (!draggingTab) { var t = FindTab((int)evnt.X, (int)evnt.Y); // If the user clicks and drags on the 'x' which closes the current // tab we can end up with a null tab here if (t == null) { return(base.OnMotionNotifyEvent(evnt)); } ; SetHighlightedTab(t); var newOver = IsOverCloseButton(t, (int)evnt.X, (int)evnt.Y); if (newOver != overCloseButton) { overCloseButton = newOver; QueueDraw(); } if (!overCloseButton && !draggingTab && buttonPressedOnTab) { draggingTab = true; dragXProgress = 1.0f; int x = (int)evnt.X; dragOffset = x - t.Allocation.X; dragX = x - dragOffset; lastDragX = (int)evnt.X; } else if (t != null) { newTooltip = t.Tooltip; } } else if (evnt.State.HasFlag(ModifierType.Button1Mask)) { dragX = (int)evnt.X - dragOffset; QueueDraw(); var t = FindTab((int)evnt.X, TopPadding + 3); if (t == null) { var last = (DockNotebookTab)notebook.Tabs.Last(); if (dragX > last.Allocation.Right) { t = last; } if (dragX < 0) { t = (DockNotebookTab)notebook.Tabs.First(); } } if (t != null && t != notebook.CurrentTab && ( ((int)evnt.X > lastDragX && t.Index > notebook.CurrentTab.Index) || ((int)evnt.X < lastDragX && t.Index < notebook.CurrentTab.Index))) { t.SaveAllocation(); t.SaveStrength = 1; notebook.ReorderTab((DockNotebookTab)notebook.CurrentTab, t); t.Animate("TabMotion", f => t.SaveStrength = f, start: 1.0f, end: 0.0f, easing: Easing.CubicInOut); } lastDragX = (int)evnt.X; } if (newTooltip != null && TooltipText != null && TooltipText != newTooltip) { TooltipText = null; } else { TooltipText = newTooltip; } return(base.OnMotionNotifyEvent(evnt)); }