Bug 425844 - clean up menu state after Carbon print dialogs. r=josh, a=dveditz
git-svn-id: svn://10.0.0.236/trunk@256050 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
0febd7a927
commit
8bea0d6ace
@ -229,6 +229,10 @@ nsPrintingPromptService::ShowPrintDialog(nsIDOMWindow *parent, nsIWebBrowserPrin
|
||||
if (!printSettingsX)
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
|
||||
nsCOMPtr<nsIPrintSettingsX_MOZILLA_1_9_BRANCH> printSettingsX_1_9(do_QueryInterface(printSettings));
|
||||
if (!printSettingsX_1_9)
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
|
||||
PMPrintSession printSession;
|
||||
rv = printSettingsX->GetNativePrintSession(&printSession);
|
||||
if (NS_FAILED(rv))
|
||||
@ -346,6 +350,8 @@ nsPrintingPromptService::ShowPrintDialog(nsIDOMWindow *parent, nsIWebBrowserPrin
|
||||
|
||||
Boolean accepted;
|
||||
status = ::PMSessionPrintDialog(printSession, nativePrintSettings, pageFormat, &accepted);
|
||||
printSettingsX_1_9->CleanUpAfterCarbonDialog();
|
||||
|
||||
if (status == noErr && accepted) {
|
||||
int pageRange = -1;
|
||||
|
||||
@ -463,6 +469,10 @@ nsPrintingPromptService::ShowPageSetup(nsIDOMWindow *parent, nsIPrintSettings *p
|
||||
if (!printSettingsX)
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
|
||||
nsCOMPtr<nsIPrintSettingsX_MOZILLA_1_9_BRANCH> printSettingsX_1_9(do_QueryInterface(printSettings));
|
||||
if (!printSettingsX_1_9)
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
|
||||
OSStatus status;
|
||||
|
||||
PMPrintSession printSession;
|
||||
@ -484,6 +494,8 @@ nsPrintingPromptService::ShowPageSetup(nsIDOMWindow *parent, nsIPrintSettings *p
|
||||
|
||||
Boolean accepted = false;
|
||||
status = ::PMSessionPageSetupDialog(printSession, pageFormat, &accepted);
|
||||
printSettingsX_1_9->CleanUpAfterCarbonDialog();
|
||||
|
||||
OSStatus tempStatus = ::PMRelease(printSession);
|
||||
if (status == noErr)
|
||||
status = tempStatus;
|
||||
|
||||
@ -88,3 +88,16 @@ interface nsIPrintSettingsX : nsISupports
|
||||
[noscript] void readPageFormatFromPrefs();
|
||||
[noscript] void writePageFormatToPrefs();
|
||||
};
|
||||
|
||||
[scriptable, uuid(30B29956-7E22-412A-82C2-31086B248102)]
|
||||
|
||||
interface nsIPrintSettingsX_MOZILLA_1_9_BRANCH : nsISupports
|
||||
{
|
||||
/**
|
||||
* cleanUpAfterCarbonDialog
|
||||
*
|
||||
* After bringing up Carbon print dialogs, clean up menus.
|
||||
* See bug 425844 for details.
|
||||
*/
|
||||
[noscript] void cleanUpAfterCarbonDialog();
|
||||
};
|
||||
|
||||
@ -47,11 +47,13 @@
|
||||
//*****************************************************************************
|
||||
|
||||
class nsPrintSettingsX : public nsPrintSettings,
|
||||
public nsIPrintSettingsX
|
||||
public nsIPrintSettingsX,
|
||||
public nsIPrintSettingsX_MOZILLA_1_9_BRANCH
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIPRINTSETTINGSX
|
||||
NS_DECL_NSIPRINTSETTINGSX_MOZILLA_1_9_BRANCH
|
||||
|
||||
nsPrintSettingsX();
|
||||
virtual ~nsPrintSettingsX();
|
||||
|
||||
@ -59,6 +59,8 @@ struct FrozenHandle {
|
||||
#define PRINTING_PREF_BRANCH "print."
|
||||
#define MAC_OS_X_PAGE_SETUP_PREFNAME "macosx.pagesetup-2"
|
||||
|
||||
#include "nsCocoaWindow.h"
|
||||
#include "nsMenuBarX.h"
|
||||
|
||||
|
||||
/** ------------------------------------------------------------
|
||||
@ -141,9 +143,10 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsPrintSettingsX,
|
||||
NS_IMPL_ISUPPORTS_INHERITED2(nsPrintSettingsX,
|
||||
nsPrintSettings,
|
||||
nsIPrintSettingsX)
|
||||
nsIPrintSettingsX,
|
||||
nsIPrintSettingsX_MOZILLA_1_9_BRANCH)
|
||||
|
||||
/** ---------------------------------------------------
|
||||
*/
|
||||
@ -557,3 +560,20 @@ OSStatus nsPrintSettingsX::CreateDefaultPrintSettings(PMPrintSession aSession, P
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(noErr);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPrintSettingsX::CleanUpAfterCarbonDialog()
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
NSWindow* mainWindow = [NSApp mainWindow];
|
||||
if (mainWindow) {
|
||||
[WindowDelegate paintMenubarForWindow:mainWindow];
|
||||
} else {
|
||||
nsIMenuBar* hiddenWindowMenuBar = MenuHelpersX::GetHiddenWindowMenuBar();
|
||||
if (hiddenWindowMenuBar)
|
||||
hiddenWindowMenuBar->Paint();
|
||||
}
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user