0

I write a npapi plugin for Safari, and I write a framework to show a modal window dialog to get password . Safari invoke plugin and plugin invoke framework. everything works well but when I close the dialog , Safari do not get the focus , I must click on the html to active safari , so it get the focus .

I show the modal dialog with following code:

NSModalSession session = [NSApp beginModalSessionForWindow:[self window]];
for (;;)
{
    if ([NSApp runModalSession:session] != NSModalResponseContinue)
        break;
}
[NSApp endModalSession:session];

and close the modal window with:

[self stopModal];

But if I show the modal window with:

[NSApp runModalForWindow:[self window]];

it works well .

what is the problem?

1 Answer 1

0

Showing modal dialogs (in fact, opening windows in general) is not a supported part of NPAPI, and is strongly discouraged. The problem is that you are doing something that NPAPI isn't designed to do, and that interacts poorly with out-of-process plugin hosting.

2
  • may be you are right smorgan ,but I found a solution, in my framework, when I close the modal window . I make the Safari active,so it get focued.
    – wayne liu
    Feb 27, 2015 at 10:50
  • Your question was why it was broken, not whether there was a workaround, which is why my answer is what it is.
    – smorgan
    Feb 28, 2015 at 0:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.