Implemented AS_IDLE_TIME, this closes bug #1593.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22758 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
3fc0398b6f
commit
6ae06ef86a
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2006, Haiku, Inc. All Rights Reserved.
|
||||
* Copyright 2005-2007, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -237,6 +237,8 @@ EventDispatcher::EventDispatcher()
|
||||
fKeyboardFilter(NULL),
|
||||
fTargets(10),
|
||||
fNextLatestMouseMoved(NULL),
|
||||
fLastButtons(0),
|
||||
fLastUpdate(system_time()),
|
||||
fCursorLock("cursor loop lock"),
|
||||
fHWInterface(NULL),
|
||||
fDesktop(NULL)
|
||||
@ -521,6 +523,14 @@ EventDispatcher::SendFakeMouseMoved(EventTarget& target, int32 viewToken)
|
||||
}
|
||||
|
||||
|
||||
bigtime_t
|
||||
EventDispatcher::IdleTime()
|
||||
{
|
||||
BAutolock _(this);
|
||||
return system_time() - fLastUpdate;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
EventDispatcher::HasCursorThread()
|
||||
{
|
||||
@ -714,6 +724,7 @@ EventDispatcher::_EventLoop()
|
||||
}
|
||||
|
||||
BAutolock _(this);
|
||||
fLastUpdate = system_time();
|
||||
|
||||
EventTarget* current = NULL;
|
||||
EventTarget* previous = NULL;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2006, Haiku, Inc. All Rights Reserved.
|
||||
* Copyright 2005-2007, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -84,12 +84,13 @@ class EventDispatcher : public BLocker {
|
||||
|
||||
void GetMouse(BPoint& where, int32& buttons);
|
||||
void SendFakeMouseMoved(EventTarget& target, int32 viewToken);
|
||||
bigtime_t IdleTime();
|
||||
|
||||
bool HasCursorThread();
|
||||
void SetHWInterface(HWInterface* interface);
|
||||
|
||||
void SetDragMessage(BMessage& message, ServerBitmap* bitmap,
|
||||
const BPoint& offsetFromCursor);
|
||||
const BPoint& offsetFromCursor);
|
||||
// the message should be delivered on the next
|
||||
// "mouse up".
|
||||
// if the mouse is not pressed, it should
|
||||
@ -101,7 +102,8 @@ class EventDispatcher : public BLocker {
|
||||
status_t _Run();
|
||||
void _Unset();
|
||||
|
||||
bool _SendMessage(BMessenger& messenger, BMessage* message, float importance);
|
||||
bool _SendMessage(BMessenger& messenger, BMessage* message,
|
||||
float importance);
|
||||
|
||||
bool _AddTokens(BMessage* message, EventTarget* target, uint32 eventMask,
|
||||
BMessage* nextMouseMoved = NULL, int32* _viewToken = NULL);
|
||||
@ -141,6 +143,7 @@ class EventDispatcher : public BLocker {
|
||||
BMessage* fNextLatestMouseMoved;
|
||||
BPoint fLastCursorPosition;
|
||||
int32 fLastButtons;
|
||||
bigtime_t fLastUpdate;
|
||||
|
||||
BMessage fDragMessage;
|
||||
bool fDraggingMessage;
|
||||
|
@ -808,6 +808,14 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
||||
break;
|
||||
}
|
||||
|
||||
case AS_IDLE_TIME:
|
||||
STRACE(("ServerApp %s: idle time\n", Signature()));
|
||||
|
||||
fLink.StartMessage(B_OK);
|
||||
fLink.Attach<bigtime_t>(fDesktop->EventDispatcher().IdleTime());
|
||||
fLink.Flush();
|
||||
break;
|
||||
|
||||
case AS_SHOW_CURSOR:
|
||||
{
|
||||
STRACE(("ServerApp %s: Show Cursor\n", Signature()));
|
||||
|
Loading…
Reference in New Issue
Block a user