Bug 239835 debug builds try to share notification icons r=bienvenu sr=mscott
git-svn-id: svn://10.0.0.236/trunk@161661 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -79,6 +79,7 @@
|
||||
#define XP_SHSetUnreadMailCounts "SHSetUnreadMailCountW"
|
||||
#define XP_SHEnumerateUnreadMailAccounts "SHEnumerateUnreadMailAccountsW"
|
||||
#define ShellNotifyWideVersion "Shell_NotifyIconW"
|
||||
#define NOTIFICATIONCLASSNAME "MailBiffNotificationMessageWindow"
|
||||
#define UNREADMAILNODEKEY "Software\\Microsoft\\Windows\\CurrentVersion\\UnreadMail\\"
|
||||
#define SHELL32_DLL NS_LITERAL_CSTRING("shell32.dll")
|
||||
#define DOUBLE_QUOTE "\""
|
||||
@@ -166,110 +167,51 @@ static void openMailWindow(const PRUnichar * aMailWindowName, const char * aFold
|
||||
}
|
||||
}
|
||||
|
||||
// Message window encapsulation.
|
||||
struct MessageWindow
|
||||
// Window proc.
|
||||
static long CALLBACK MessageWindowProc( HWND msgWindow, UINT msg, WPARAM wp, LPARAM lp )
|
||||
{
|
||||
// ctor/dtor are simplistic
|
||||
MessageWindow()
|
||||
{
|
||||
Create();
|
||||
// dummy code to force creation of our string
|
||||
const char * fakeName = mailWinName();
|
||||
}
|
||||
|
||||
// Act like an HWND.
|
||||
operator HWND()
|
||||
{
|
||||
return mHandle;
|
||||
}
|
||||
|
||||
// for some reason WindowProc can't access the string literal "mail:3pane", we need to copy that string
|
||||
// into a static buffer outside of the WindowProc call.
|
||||
static const char * mailWinName()
|
||||
{
|
||||
static char mailNameBuffer[128];
|
||||
static char *mMailWinName = 0;
|
||||
if ( !mMailWinName )
|
||||
{
|
||||
::_snprintf( mailNameBuffer,
|
||||
sizeof mailNameBuffer,
|
||||
"%s",
|
||||
"mail:3pane" );
|
||||
mMailWinName = mailNameBuffer;
|
||||
}
|
||||
return mMailWinName;
|
||||
}
|
||||
|
||||
// Class name: appName + "MessageWindow"
|
||||
static const char *className()
|
||||
{
|
||||
static char classNameBuffer[128];
|
||||
static char *mClassName = 0;
|
||||
if ( !mClassName )
|
||||
{
|
||||
::_snprintf( classNameBuffer,
|
||||
sizeof classNameBuffer,
|
||||
"%s%s",
|
||||
"MailBiffNotification",
|
||||
"MessageWindow" );
|
||||
mClassName = classNameBuffer;
|
||||
}
|
||||
return mClassName;
|
||||
}
|
||||
|
||||
// Create: Register class and create window.
|
||||
NS_IMETHOD Create()
|
||||
{
|
||||
// Try to find window.
|
||||
mHandle = ::FindWindow( className(), 0 );
|
||||
if (mHandle)
|
||||
return NS_OK;
|
||||
|
||||
WNDCLASS classStruct = { 0, // style
|
||||
&MessageWindow::WindowProc, // lpfnWndProc
|
||||
0, // cbClsExtra
|
||||
0, // cbWndExtra
|
||||
0, // hInstance
|
||||
0, // hIcon
|
||||
0, // hCursor
|
||||
0, // hbrBackground
|
||||
0, // lpszMenuName
|
||||
className() }; // lpszClassName
|
||||
|
||||
// Register the window class.
|
||||
NS_ENSURE_TRUE( ::RegisterClass( &classStruct ), NS_ERROR_FAILURE );
|
||||
// Create the window.
|
||||
NS_ENSURE_TRUE( ( mHandle = ::CreateWindow( className(),
|
||||
0, // title
|
||||
WS_CAPTION, // style
|
||||
0,0,0,0, // x, y, cx, cy
|
||||
0, // parent
|
||||
0, // menu
|
||||
0, // instance
|
||||
0 ) ), // create struct
|
||||
NS_ERROR_FAILURE );
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Window proc.
|
||||
static long CALLBACK WindowProc( HWND msgWindow, UINT msg, WPARAM wp, LPARAM lp )
|
||||
{
|
||||
if ( msg == WM_USER )
|
||||
{
|
||||
if ( lp == WM_LBUTTONDBLCLK )
|
||||
{
|
||||
nsAutoString mailName;
|
||||
mailName.AssignWithConversion(mailWinName());
|
||||
openMailWindow(mailName.get(), nsnull);
|
||||
}
|
||||
}
|
||||
if (msg == WM_USER && lp == WM_LBUTTONDBLCLK)
|
||||
{
|
||||
NS_NAMED_LITERAL_STRING(mailName, "mail:3pane");
|
||||
openMailWindow(mailName.get(), nsnull);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
private:
|
||||
HWND mHandle;
|
||||
}; // struct MessageWindow
|
||||
static HWND msgWindow;
|
||||
|
||||
// Create: Register class and create window.
|
||||
static nsresult Create()
|
||||
{
|
||||
if (msgWindow)
|
||||
return NS_OK;
|
||||
|
||||
WNDCLASS classStruct = { 0, // style
|
||||
&MessageWindowProc, // lpfnWndProc
|
||||
0, // cbClsExtra
|
||||
0, // cbWndExtra
|
||||
0, // hInstance
|
||||
0, // hIcon
|
||||
0, // hCursor
|
||||
0, // hbrBackground
|
||||
0, // lpszMenuName
|
||||
NOTIFICATIONCLASSNAME }; // lpszClassName
|
||||
|
||||
// Register the window class.
|
||||
NS_ENSURE_TRUE( ::RegisterClass( &classStruct ), NS_ERROR_FAILURE );
|
||||
// Create the window.
|
||||
NS_ENSURE_TRUE( msgWindow = ::CreateWindow( NOTIFICATIONCLASSNAME,
|
||||
0, // title
|
||||
WS_CAPTION, // style
|
||||
0,0,0,0, // x, y, cx, cy
|
||||
0, // parent
|
||||
0, // menu
|
||||
0, // instance
|
||||
0 ), // create struct
|
||||
NS_ERROR_FAILURE );
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsMessengerWinIntegration::nsMessengerWinIntegration()
|
||||
@@ -362,8 +304,7 @@ NOTIFYICONDATAW nsMessengerWinIntegration::mWideBiffIconData = { sizeof(NOTIFYIC
|
||||
void nsMessengerWinIntegration::InitializeBiffStatusIcon()
|
||||
{
|
||||
// initialize our biff status bar icon
|
||||
nsresult rv = NS_OK;
|
||||
MessageWindow msgWindow;
|
||||
Create();
|
||||
|
||||
if (mUseWideCharBiffIcon)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user