Started to properly implement support for BView's events mask

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14106 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adi Oanca 2005-09-03 17:55:16 +00:00
parent ae4f21862f
commit 144022be62
3 changed files with 53 additions and 1 deletions

View File

@ -1757,6 +1757,42 @@ RootLayer::SetEventMaskLayer(Layer *lay, uint32 mask, uint32 options)
Lock();
if (mask & B_POINTER_EVENTS) {
if (fMouseEventsLayerList.HasItem(lay))
fMouseEventsLayerList.AddItem(lay);
}
else {
if (options == 0)
fMouseEventsLayerList.RemoveItem(lay);
}
if (mask & B_KEYBOARD_EVENTS) {
if (fKeyboardEventsLayerList.HasItem(lay))
fKeyboardEventsLayerList.AddItem(lay);
}
else {
if (options == 0)
fKeyboardEventsLayerList.RemoveItem(lay);
}
// TODO: set options!!!
// B_NO_POINTER_HISTORY only! How? By telling to the input_server?
Unlock();
return returnValue;
}
bool
RootLayer::SetMouseEventMaskLayer(Layer *lay, uint32 mask, uint32 options)
{
if (!lay)
return false;
bool returnValue = true;
Lock();
if (fEventMaskLayer && fEventMaskLayer != lay) {
fprintf(stderr, "WARNING: fEventMaskLayer already set and different than the required one!\n");
returnValue = false;

View File

@ -115,6 +115,7 @@ public:
BMessage* DragMessage(void) const;
bool SetEventMaskLayer(Layer *lay, uint32 mask, uint32 options);
bool SetMouseEventMaskLayer(Layer *lay, uint32 mask, uint32 options);
void LayerRemoved(Layer* layer);
@ -176,6 +177,8 @@ friend class Desktop;
WinBorder* fMouseTargetWinBorder;
int32 fViewAction;
Layer* fEventMaskLayer;
BList fMouseEventsLayerList;
BList fKeyboardEventsLayerList;
BLocker fAllRegionsLock;

View File

@ -668,7 +668,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
fLink.Flush();
break;
}
case AS_LAYER_SET_MOUSE_EVENT_MASK:
case AS_LAYER_SET_EVENT_MASK:
{
STRACE(("ServerWindow %s: Message AS_LAYER_SET_MOUSE_EVENT_MASK: Layer name: %s\n", fTitle, fCurrentLayer->Name()));
@ -680,6 +680,19 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
if (myRootLayer)
myRootLayer->SetEventMaskLayer(fCurrentLayer, mask, options);
}
case AS_LAYER_SET_MOUSE_EVENT_MASK:
{
STRACE(("ServerWindow %s: Message AS_LAYER_SET_MOUSE_EVENT_MASK: Layer name: %s\n", fTitle, fCurrentLayer->Name()));
uint32 mask;
uint32 options;
link.Read<uint32>(&mask);
link.Read<uint32>(&options);
if (myRootLayer)
myRootLayer->SetMouseEventMaskLayer(fCurrentLayer, mask, options);
break;
}
case AS_LAYER_MOVE_TO: