moving and resizing windows works very well now.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14202 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adi Oanca 2005-09-19 22:41:48 +00:00
parent 715e2973a9
commit 534bc2c360
4 changed files with 42 additions and 25 deletions

View File

@ -1077,8 +1077,6 @@ RootLayer::_ProcessMouseMovedEvent(PointerEvent &evt)
else
fViewAction = B_OUTSIDE_VIEW;
// NOTE: testing under R5 shows that it doesn't matter if a window is created
// with B_ASYNCHRONOUS_CONTROLS flag or not. B_MOUSE_DOWN is always transmited.
lay->MouseMoved(evt, fViewAction);
}
}
@ -1147,6 +1145,16 @@ RootLayer::MouseEventHandler(int32 code, BPrivate::PortLink& msg)
break;
#ifdef NEW_INPUT_HANDLING
int32 count = fMouseNotificationList.CountItems();
Layer *lay;
for (int32 i = 0; i <= count; i++) {
lay = static_cast<Layer*>(fMouseNotificationList.ItemAt(i));
if (lay)
// NOTE: testing under R5 shows that it doesn't matter if a window is created
// with B_ASYNCHRONOUS_CONTROLS flag or not. B_MOUSE_DOWN is always transmited.
lay->MouseDown(evt);
}
// get the pointer for one of the first RootLayer's descendants
Layer *primaryTarget = LayerAt(evt.where, false);
primaryTarget->MouseDown(evt);
@ -1256,12 +1264,23 @@ fprintf(stderr, "mouse position changed in B_MOUSE_UP (%.1f, %.1f) from last B_M
}
#ifdef NEW_INPUT_HANDLING
ClearNotifyLayer();
if (fLastLayerUnderMouse == NULL) {
CRITICAL("RootLayer::MouseEventHandler(B_MOUSE_UP) fLastLayerUnderMouse is null!\n");
break;
}
fLastLayerUnderMouse->MouseUp(evt);
bool foundCurrent = fMouseNotificationList.HasItem(fLastLayerUnderMouse);
int32 count = fMouseNotificationList.CountItems();
Layer *lay;
for (int32 i = 0; i <= count; i++) {
lay = static_cast<Layer*>(fMouseNotificationList.ItemAt(i));
if (lay)
lay->MouseUp(evt);
}
ClearNotifyLayer();
if (!foundCurrent)
fLastLayerUnderMouse->MouseUp(evt);
#else
if (fLastLayerUnderMouse == NULL) {
CRITICAL("RootLayer::MouseEventHandler(B_MOUSE_UP) fLastLayerUnderMouse is null!\n");
@ -1917,12 +1936,12 @@ RootLayer::ClearNotifyLayer()
{
if (fNotifyLayer) {
Lock();
// remove from notification list.
AddToInputNotificationLists(fNotifyLayer, 0UL, 0UL);
// set event masks
fNotifyLayer->QuietlySetEventMask(fSavedEventMask);
fNotifyLayer->QuietlySetEventOptions(fSavedEventOptions);
// add to notification list with event masks set my BView::SetEventMask()
AddToInputNotificationLists(fNotifyLayer, fSavedEventMask, fSavedEventOptions);
fNotifyLayer = NULL;

View File

@ -109,7 +109,6 @@ WinBorder::WinBorder(const BRect &frame,
fClassID = AS_WINBORDER_CLASS;
fAdFlags = fAdFlags | B_LAYER_CHILDREN_DEPENDANT;
fFlags = B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE;
fEventMask = B_POINTER_EVENTS;
#ifdef NEW_CLIPPING
fRebuildDecRegion = true;
#endif
@ -471,7 +470,6 @@ WinBorder::MouseDown(const PointerEvent& evt)
else
goto activateWindow;
}
// TODO: send mouse down to event registered BViews!!!
}
// clicking WinBorder visible area
else {
@ -526,30 +524,30 @@ WinBorder::MouseDown(const PointerEvent& evt)
if (action == DEC_MOVETOBACK) {
GetRootLayer()->ActiveWorkspace()->MoveToBack(this);
}
else if (action == DEC_DRAG) {
GetRootLayer()->SetNotifyLayer(this, B_POINTER_EVENTS, 0UL);
else {
if (action == DEC_DRAG || action == DEC_RESIZE || action == DEC_SLIDETAB)
GetRootLayer()->SetNotifyLayer(this, B_POINTER_EVENTS, 0UL);
activateWindow:
GetRootLayer()->ActiveWorkspace()->AttemptToActivate(this);
}
GetRootLayer()->ActiveWorkspace()->GetState(&newState);
//--------------------------
// BOOKMARK!
// send window activation messages
// NOTE !!! ATM we're sending B_WINDOW_ACTIVATED to front windows only!
// This means floating windows do not have their BWindow::WindowActivated()
// hook function called.
if (oldState.Front != newState.Front) {
if (oldState.Front && oldState.Front->Window()) {
// BOOKMARK!
// TODO: there can be more than one window active at a time! ex: a normal + floating_app, with
// floating window having focus.
// send window activation messages
if (oldState.Active != newState.Active) {
if (oldState.Active && oldState.Active->Window()) {
BMessage msg(B_WINDOW_ACTIVATED);
msg.AddBool("active", false);
oldState.Front->Window()->SendMessageToClient(&msg, B_NULL_TOKEN, false);
oldState.Active->Window()->SendMessageToClient(&msg, B_NULL_TOKEN, false);
}
if (newState.Front && newState.Front->Window()) {
if (newState.Active && newState.Active->Window()) {
BMessage msg(B_WINDOW_ACTIVATED);
msg.AddBool("active", true);
newState.Front->Window()->SendMessageToClient(&msg, B_NULL_TOKEN, false);
newState.Active->Window()->SendMessageToClient(&msg, B_NULL_TOKEN, false);
}
}
@ -567,14 +565,12 @@ WinBorder::MouseDown(const PointerEvent& evt)
#endif
}
// trigger region rebuilding and redraw
#ifndef NEW_CLIPPING
GetRootLayer()->invalidate_layer(this, fFull);
#else
GetRootLayer()->do_Invalidate(Bounds());
#endif
// TODO: FINISH ABOVE.
}
}
// in FFM mode

View File

@ -231,6 +231,7 @@ Workspace::GetState(Workspace::State *state) const
{
state->Front = Front();
state->Focus = Focus();
state->Active = Active();
ListData *cursor = fBottomItem;
while (cursor) {

View File

@ -54,6 +54,7 @@ class Workspace {
State() : Front(NULL), Focus(NULL), WindowList(40) { }
WinBorder* Front;
WinBorder* Focus;
WinBorder* Active;
BList WindowList;
};
Workspace( const int32 ID,