* added a way to retrieve the view under the mouse

via token

(coded by axeld)



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16518 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2006-02-26 17:58:03 +00:00
parent c684b4ca64
commit 4aaa5aa100
2 changed files with 20 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2005, Haiku, Inc. All Rights Reserved. * Copyright 2005-2006, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@ -216,6 +216,7 @@ EventDispatcher::EventDispatcher()
fThread(-1), fThread(-1),
fCursorThread(-1), fCursorThread(-1),
fPreviousMouseTarget(NULL), fPreviousMouseTarget(NULL),
fPreviousViewToken(B_NULL_TOKEN),
fFocus(NULL), fFocus(NULL),
fSuspendFocus(false), fSuspendFocus(false),
fMouseFilter(NULL), fMouseFilter(NULL),
@ -503,12 +504,24 @@ EventDispatcher::SetHWInterface(HWInterface* interface)
} }
int32
EventDispatcher::ViewUnderMouse(EventTarget& target)
{
BAutolock _(this);
if (&target == fPreviousMouseTarget)
return fPreviousViewToken;
return B_NULL_TOKEN;
}
void void
EventDispatcher::SetDragMessage(BMessage& message) EventDispatcher::SetDragMessage(BMessage& message)
{ {
printf("EventDispatcher::SetDragMessage()\n"); printf("EventDispatcher::SetDragMessage()\n");
BAutolock _(*this); BAutolock _(this);
fDragMessage = message; fDragMessage = message;
@ -744,6 +757,7 @@ EventDispatcher::_EventLoop()
} }
current = fPreviousMouseTarget = mouseTarget; current = fPreviousMouseTarget = mouseTarget;
fPreviousViewToken = viewToken;
if (current != NULL) { if (current != NULL) {
int32 focusView = viewToken; int32 focusView = viewToken;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2005, Haiku, Inc. All Rights Reserved. * Copyright 2005-2006, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@ -84,6 +84,8 @@ class EventDispatcher : public BLocker {
bool HasCursorThread(); bool HasCursorThread();
void SetHWInterface(HWInterface* interface); void SetHWInterface(HWInterface* interface);
int32 ViewUnderMouse(EventTarget& target);
void SetDragMessage(BMessage& message); void SetDragMessage(BMessage& message);
// the message should be delivered on the next // the message should be delivered on the next
// "mouse up". // "mouse up".
@ -123,6 +125,7 @@ class EventDispatcher : public BLocker {
thread_id fCursorThread; thread_id fCursorThread;
EventTarget* fPreviousMouseTarget; EventTarget* fPreviousMouseTarget;
int32 fPreviousViewToken;
EventTarget* fFocus; EventTarget* fFocus;
bool fSuspendFocus; bool fSuspendFocus;