mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-12 00:50:40 +00:00
Bug 341957: Improved mail alert does not respect task bar position, patch by Jens Bannmann <jens.b@web.de>, r+sr=mscott
This commit is contained in:
parent
ec04d05f85
commit
e8ea696f16
@ -36,6 +36,10 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const HORIZONTAL = 1;
|
||||
const LEFT = 2;
|
||||
const TOP = 4;
|
||||
|
||||
var gSlideTime = 50;
|
||||
var gNumNewMsgsToShowInAlert = 4; // the more messages we show in the alert, the larger it will be
|
||||
var gOpenTime = 3000; // total time the alert should stay up once we are done animating.
|
||||
@ -43,6 +47,7 @@ var gAlertListener = null;
|
||||
var gPendingPreviewFetchRequests = 0;
|
||||
var gUserInitiated = false;
|
||||
var gFadeIncrement = .05;
|
||||
var gOrigin = 0;
|
||||
|
||||
function prefillAlertInfo()
|
||||
{
|
||||
@ -51,9 +56,11 @@ function prefillAlertInfo()
|
||||
// arguments[1] --> the observer to call back with notifications about the alert
|
||||
// arguments[2] --> user initiated boolean. true if the user initiated opening the alert
|
||||
// (which means skip the fade effect and don't auto close the alert)
|
||||
// arguments[3] --> the alert origin returned by the look and feel
|
||||
var foldersWithNewMail = window.arguments[0];
|
||||
gAlertListener = window.arguments[1];
|
||||
gUserInitiated = window.arguments[2];
|
||||
gOrigin = window.arguments[3];
|
||||
|
||||
// for now just grab the first folder which should be a root folder
|
||||
// for the account that has new mail.
|
||||
@ -168,7 +175,13 @@ function resizeAlert(aMoveOffScreen)
|
||||
// leftover hack to get the window properly hidden when we first open it
|
||||
if (aMoveOffScreen)
|
||||
window.outerHeight = 1;
|
||||
window.moveTo(screen.availLeft + screen.availWidth - window.outerWidth, screen.availTop + screen.availHeight - window.outerHeight);
|
||||
|
||||
// Determine position and move window
|
||||
var x = gOrigin & LEFT ? screen.availLeft :
|
||||
(screen.availLeft + screen.availWidth - window.outerWidth);
|
||||
var y = gOrigin & TOP ? screen.availTop :
|
||||
(screen.availTop + screen.availHeight - window.outerHeight);
|
||||
window.moveTo(x, y);
|
||||
}
|
||||
|
||||
function fadeOpen()
|
||||
|
@ -23,6 +23,7 @@
|
||||
* Seth Spitzer <sspitzer@netscape.com>
|
||||
* Bhuvan Racham <racham@netscape.com>
|
||||
* Howard Chu <hyc@symas.com>
|
||||
* Jens Bannmann <jens.b@web.de>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
@ -62,6 +63,8 @@
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIBaseWindow.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsILookAndFeel.h"
|
||||
|
||||
#include "nsIMessengerWindowService.h"
|
||||
#include "prprf.h"
|
||||
@ -543,7 +546,8 @@ nsresult nsMessengerWinIntegration::ShowNewAlertNotification(PRBool aUserInitiat
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
ifptr->SetData(mFoldersWithNewMail);
|
||||
ifptr->SetDataIID(&NS_GET_IID(nsISupportsArray));
|
||||
argsArray->AppendElement(ifptr);
|
||||
rv = argsArray->AppendElement(ifptr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// pass in the observer
|
||||
ifptr = do_CreateInstance(NS_SUPPORTS_INTERFACE_POINTER_CONTRACTID, &rv);
|
||||
@ -551,13 +555,31 @@ nsresult nsMessengerWinIntegration::ShowNewAlertNotification(PRBool aUserInitiat
|
||||
nsCOMPtr <nsISupports> supports = do_QueryInterface(NS_STATIC_CAST(nsIMessengerOSIntegration*, this));
|
||||
ifptr->SetData(supports);
|
||||
ifptr->SetDataIID(&NS_GET_IID(nsIObserver));
|
||||
argsArray->AppendElement(ifptr);
|
||||
rv = argsArray->AppendElement(ifptr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// pass in the animation flag
|
||||
nsCOMPtr<nsISupportsPRBool> scriptableUserInitiated (do_CreateInstance(NS_SUPPORTS_PRBOOL_CONTRACTID, &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
scriptableUserInitiated->SetData(aUserInitiated);
|
||||
argsArray->AppendElement(scriptableUserInitiated);
|
||||
rv = argsArray->AppendElement(scriptableUserInitiated);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// pass in the alert origin
|
||||
nsCOMPtr<nsISupportsPRUint8> scriptableOrigin (do_CreateInstance(NS_SUPPORTS_PRUINT8_CONTRACTID));
|
||||
NS_ENSURE_TRUE(scriptableOrigin, NS_ERROR_FAILURE);
|
||||
scriptableOrigin->SetData(0);
|
||||
nsCOMPtr<nsILookAndFeel> lookAndFeel = do_GetService("@mozilla.org/widget/lookandfeel;1");
|
||||
if (lookAndFeel)
|
||||
{
|
||||
PRInt32 origin;
|
||||
lookAndFeel->GetMetric(nsILookAndFeel::eMetric_AlertNotificationOrigin,
|
||||
origin);
|
||||
if (origin && origin >= 0 && origin <= 7)
|
||||
scriptableOrigin->SetData(origin);
|
||||
}
|
||||
rv = argsArray->AppendElement(scriptableOrigin);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
|
||||
nsCOMPtr<nsIDOMWindow> newWindow;
|
||||
|
Loading…
Reference in New Issue
Block a user