Bug 534183 - Autorepeatbuttons in menus shouldn't have any initial delay. r=Enn

--HG--
extra : rebase_source : a28ce171cfb0bca7070b8f0bfdf0c7da446908d5
This commit is contained in:
Markus Stange 2009-12-11 23:03:31 +01:00
Родитель 265856c4e0
Коммит bceaf49056
3 изменённых файлов: 14 добавлений и 12 удалений

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

@ -45,14 +45,6 @@
#include "nsRepeatService.h"
#include "nsIServiceManager.h"
#ifdef XP_MACOSX
#define INITAL_REPEAT_DELAY 250
#define REPEAT_DELAY 25
#else
#define INITAL_REPEAT_DELAY 250
#define REPEAT_DELAY 50
#endif
nsRepeatService* nsRepeatService::gInstance = nsnull;
nsRepeatService::nsRepeatService()
@ -81,7 +73,8 @@ nsRepeatService::Shutdown()
NS_IF_RELEASE(gInstance);
}
void nsRepeatService::Start(Callback aCallback, void* aCallbackData)
void nsRepeatService::Start(Callback aCallback, void* aCallbackData,
PRUint32 aInitialDelay)
{
NS_PRECONDITION(aCallback != nsnull, "null ptr");
@ -91,7 +84,7 @@ void nsRepeatService::Start(Callback aCallback, void* aCallbackData)
mRepeatTimer = do_CreateInstance("@mozilla.org/timer;1", &rv);
if (NS_SUCCEEDED(rv)) {
mRepeatTimer->InitWithCallback(this, INITAL_REPEAT_DELAY, nsITimer::TYPE_ONE_SHOT);
mRepeatTimer->InitWithCallback(this, aInitialDelay, nsITimer::TYPE_ONE_SHOT);
}
}

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

@ -44,6 +44,14 @@
#include "nsCOMPtr.h"
#include "nsITimer.h"
#define INITAL_REPEAT_DELAY 250
#ifdef XP_MACOSX
#define REPEAT_DELAY 25
#else
#define REPEAT_DELAY 50
#endif
class nsITimer;
class nsRepeatService : public nsITimerCallback
@ -57,7 +65,8 @@ public:
// Start dispatching timer events to the callback. There is no memory
// management of aData here; it is the caller's responsibility to call
// Stop() before aData's memory is released.
void Start(Callback aCallback, void* aData);
void Start(Callback aCallback, void* aData,
PRUint32 aInitialDelay = INITAL_REPEAT_DELAY);
// Stop dispatching timer events to the callback. If the repeat service
// is not currently configured with the given callback and data, this
// is just ignored.

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

@ -77,7 +77,7 @@ protected:
nsButtonBoxFrame(aPresShell, aContext) {}
void StartRepeat() {
nsRepeatService::GetInstance()->Start(Notify, this);
nsRepeatService::GetInstance()->Start(Notify, this, 0);
}
void StopRepeat() {
nsRepeatService::GetInstance()->Stop(Notify, this);