The menu for the turbo systray icon doesn't work on win9x/me (90524). r=ftang sr=ben

This commit is contained in:
blakeross%telocity.com 2001-07-25 06:22:53 +00:00
Родитель 89611d4d34
Коммит 65d3c48d40
1 изменённых файлов: 23 добавлений и 1 удалений

Просмотреть файл

@ -76,6 +76,19 @@ GetMostRecentWindow(const PRUnichar* aType, nsIDOMWindowInternal** aWindow) {
return NS_ERROR_FAILURE;
}
static char* GetACPString(const nsString& aStr)
{
int acplen = aStr.Length() * 2 + 1;
char * acp = new char[ acplen ];
if( acp ) {
int outlen = ::WideCharToMultiByte( CP_ACP, 0, aStr.get(), aStr.Length(),
acp, acplen, NULL, NULL );
if ( outlen >= 0)
acp[ outlen ] = '\0'; // null terminate
}
return acp;
}
static
void
activateWindow( nsIDOMWindowInternal *win ) {
@ -1710,7 +1723,16 @@ nsNativeAppSupportWin::SetupSysTrayIcon() {
// Create menu and add item.
mTrayIconMenu = ::CreatePopupMenu();
::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_QUIT, exitText.get() );
if ( ::GetLastError() == ERROR_CALL_NOT_IMPLEMENTED ) {
char* exitACPText = GetACPString( exitText );
if ( exitACPText ) {
::AppendMenu( mTrayIconMenu, MF_STRING, TURBO_QUIT, exitACPText );
delete [] exitACPText ;
}
}
else {
::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_QUIT, exitText.get() );
}
}
// Add the tray icon.