mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-06-04 03:04:18 +08:00
Mac: Fix close events on close by command-Q
This commit is contained in:
parent
66f998bdbf
commit
6ac54896fa
@ -428,17 +428,25 @@ void MainFrame::init_menubar()
|
|||||||
// menubar
|
// menubar
|
||||||
// assign menubar to frame after appending items, otherwise special items
|
// assign menubar to frame after appending items, otherwise special items
|
||||||
// will not be handled correctly
|
// will not be handled correctly
|
||||||
{
|
auto menubar = new wxMenuBar();
|
||||||
auto menubar = new wxMenuBar();
|
menubar->Append(fileMenu, L("&File"));
|
||||||
menubar->Append(fileMenu, L("&File"));
|
if (editMenu) menubar->Append(editMenu, L("&Edit"));
|
||||||
if (editMenu) menubar->Append(editMenu, L("&Edit"));
|
menubar->Append(windowMenu, L("&Window"));
|
||||||
menubar->Append(windowMenu, L("&Window"));
|
if (viewMenu) menubar->Append(viewMenu, L("&View"));
|
||||||
if (viewMenu) menubar->Append(viewMenu, L("&View"));
|
// Add additional menus from C++
|
||||||
// Add additional menus from C++
|
wxGetApp().add_config_menu(menubar);
|
||||||
wxGetApp().add_config_menu(menubar);
|
menubar->Append(helpMenu, L("&Help"));
|
||||||
menubar->Append(helpMenu, L("&Help"));
|
SetMenuBar(menubar);
|
||||||
SetMenuBar(menubar);
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
// This fixes a bug (?) on Mac OS where the quit command doesn't emit window close events
|
||||||
|
wxMenu *apple_menu = menubar->OSXGetAppleMenu();
|
||||||
|
if (apple_menu != nullptr) {
|
||||||
|
apple_menu->Bind(wxEVT_MENU, [this](wxCommandEvent &) {
|
||||||
|
Close();
|
||||||
|
}, wxID_EXIT);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// To perform the "Quck Slice", "Quick Slice and Save As", "Repeat last Quick Slice" and "Slice to SVG".
|
// To perform the "Quck Slice", "Quick Slice and Save As", "Repeat last Quick Slice" and "Slice to SVG".
|
||||||
|
Loading…
x
Reference in New Issue
Block a user