protected override bool OnButtonPressEvent(EventButton evnt) { var t = FindTab((int)evnt.X, (int)evnt.Y); if (t != null) { if (evnt.IsContextMenuButton()) { notebook.DoPopupMenu(t.Index, evnt); return(true); } // Don't select the tab if we are clicking the close button if (IsOverCloseButton(t, (int)evnt.X, (int)evnt.Y)) { overCloseOnPress = true; return(true); } overCloseOnPress = false; if (evnt.Type == Gdk.EventType.TwoButtonPress) { if (allowDoubleClick) { notebook.OnActivateTab(t); buttonPressedOnTab = false; } return(true); } if (evnt.Button == 2) { notebook.OnCloseTab(t); return(true); } buttonPressedOnTab = true; notebook.CurrentTab = t; return(true); } else { buttonPressedOnTab = true; } QueueDraw(); return(base.OnButtonPressEvent(evnt)); }