protected override bool OnButtonPressEvent(EventButton evnt) { Gdk.Point global_point = new Gdk.Point((int)evnt.XRoot, (int)evnt.YRoot); Gdk.Point local_point = new Gdk.Point((int)evnt.X, (int)evnt.Y); switch (bezel_drawing_area.GetPointLocation(local_point)) { case PointLocation.Close: case PointLocation.Outside: controller.ButtonPressOffWindow(); break; case PointLocation.Preferences: // We need to let the window manager handle the Do window before popping up the // preferences menu so that it can place the menu over the top. GdkWindow.OverrideRedirect = false; Services.Windowing.ShowMainMenu(global_point.X, global_point.Y); // Have to re-grab the pane from the menu. Interface.Windowing.PresentWindow(this); GdkWindow.OverrideRedirect = true; break; } return(base.OnButtonPressEvent(evnt)); }
protected override bool OnButtonPressEvent(EventButton evnt) { int start_x, start_y, end_x, end_y; int click_x, click_y; bool click_on_window, click_near_settings_icon; GetPosition(out start_x, out start_y); GetSize(out end_x, out end_y); end_x += start_x; end_y += start_y; click_x = (int)evnt.XRoot; click_y = (int)evnt.YRoot; click_on_window = start_x <= click_x && click_x < end_x && start_y <= click_y && click_y < end_y; click_near_settings_icon = (end_x - 27) <= click_x && click_x < end_x && start_y <= click_y && click_y < (start_y + 27); if (click_near_settings_icon) { Services.Windowing.ShowMainMenu(end_x - 21, start_y + 16); // Have to re-grab the pane from the menu. Interface.Windowing.PresentWindow(this); } else if (!click_on_window) { controller.ButtonPressOffWindow(); } return(base.OnButtonPressEvent(evnt)); }