mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-07 19:06:39 +00:00
Don't allow call Exit command (e.g. Cmd+Q on macOS) when there is a foreground window
The same for drop files, we've disabled dropping files when there is a foreground window (at least temporarily to avoid strange UI states).
This commit is contained in:
parent
8a499ae175
commit
9461c5d02c
@ -368,13 +368,12 @@ bool CustomizedGuiManager::onProcessMessage(Message* msg)
|
|||||||
{
|
{
|
||||||
switch (msg->type()) {
|
switch (msg->type()) {
|
||||||
|
|
||||||
case kCloseDisplayMessage:
|
case kCloseDisplayMessage: {
|
||||||
{
|
// Execute the "Exit" command.
|
||||||
// Execute the "Exit" command.
|
Command* command = Commands::instance()->byId(CommandId::Exit());
|
||||||
Command* command = Commands::instance()->byId(CommandId::Exit());
|
UIContext::instance()->executeCommandFromMenuOrShortcut(command);
|
||||||
UIContext::instance()->executeCommand(command);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case kDropFilesMessage:
|
case kDropFilesMessage:
|
||||||
// Files are processed only when the main window is the current
|
// Files are processed only when the main window is the current
|
||||||
@ -410,7 +409,7 @@ bool CustomizedGuiManager::onProcessMessage(Message* msg)
|
|||||||
Command* cmd = Commands::instance()->byId(CommandId::Options());
|
Command* cmd = Commands::instance()->byId(CommandId::Options());
|
||||||
Params params;
|
Params params;
|
||||||
params.set("installExtension", fn.c_str());
|
params.set("installExtension", fn.c_str());
|
||||||
ctx->executeCommand(cmd, params);
|
ctx->executeCommandFromMenuOrShortcut(cmd, params);
|
||||||
}
|
}
|
||||||
// Other extensions will be handled as an image/sprite
|
// Other extensions will be handled as an image/sprite
|
||||||
else {
|
else {
|
||||||
@ -418,7 +417,7 @@ bool CustomizedGuiManager::onProcessMessage(Message* msg)
|
|||||||
Params params;
|
Params params;
|
||||||
params.set("filename", fn.c_str());
|
params.set("filename", fn.c_str());
|
||||||
params.set("repeat_checkbox", "true");
|
params.set("repeat_checkbox", "true");
|
||||||
ctx->executeCommand(&cmd, params);
|
ctx->executeCommandFromMenuOrShortcut(&cmd, params);
|
||||||
|
|
||||||
// Remove all used file names from the "dropped files"
|
// Remove all used file names from the "dropped files"
|
||||||
for (const auto& usedFn : cmd.usedFiles()) {
|
for (const auto& usedFn : cmd.usedFiles()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user