I'm in the middle of corect window drawing while using the mouse.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8083 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
24b7442c3f
commit
a68bab127c
@ -395,15 +395,53 @@ void Desktop::MouseEventHandler(PortMessage *msg)
|
||||
target = ws->SearchWinBorder(pt);
|
||||
if (target)
|
||||
{
|
||||
WinBorder *previousFocus;
|
||||
WinBorder *activeFocus;
|
||||
BRegion invalidRegion;
|
||||
|
||||
fGeneralLock.Lock();
|
||||
rl->fMainLock.Lock();
|
||||
target->Window()->Lock();
|
||||
|
||||
ws->BringToFrontANormalWindow(target);
|
||||
ws->SearchAndSetNewFront(target);
|
||||
ws->SetFocusLayer(target);
|
||||
previousFocus = ws->FocusLayer();
|
||||
activeFocus = ws->SetFocusLayer(target);
|
||||
printf("target: %s\n", target? target->GetName(): "NULL");
|
||||
printf("previousFocus: %s\n", previousFocus? previousFocus->GetName(): "NULL");
|
||||
printf("activeFocus: %s\n", activeFocus? activeFocus->GetName(): "NULL");
|
||||
activeFocus->Window()->Lock();
|
||||
|
||||
// TODO: more work needs to be done. Think! Think! Think again!
|
||||
// remember - front != focus. Also put modal windows into equation!
|
||||
|
||||
// a HINT: inside Decorator 'highlight' flag is not set before a redraw with
|
||||
// activeFocus->fParent->FullInvalidate(invalidRegion);
|
||||
if (activeFocus != previousFocus){
|
||||
// redraw decorator in its active mode.
|
||||
if (activeFocus){
|
||||
if (activeFocus->fDecorator){
|
||||
invalidRegion.Include(&(activeFocus->fVisible));
|
||||
activeFocus->fParent->FullInvalidate(invalidRegion);
|
||||
}
|
||||
// let WinBorder know we have the mouse down.
|
||||
if (activeFocus->Window()->Flags() & B_WILL_ACCEPT_FIRST_CLICK)
|
||||
activeFocus->MouseDown(msg, false);
|
||||
else
|
||||
activeFocus->MouseDown(msg, true);
|
||||
}
|
||||
|
||||
// redraw previous window's decorator. It has lost focus state.
|
||||
if (previousFocus)
|
||||
if (previousFocus->fDecorator)
|
||||
previousFocus->fParent->Invalidate(previousFocus->fVisible);
|
||||
}
|
||||
else{
|
||||
// let WinBorder know we have the mouse down. This is the same window as before.
|
||||
if (activeFocus)
|
||||
activeFocus->MouseDown(msg, true);
|
||||
}
|
||||
|
||||
fMouseTarget = target;
|
||||
target->MouseDown(msg);
|
||||
fMouseTarget = activeFocus;
|
||||
|
||||
target->Window()->Unlock();
|
||||
rl->fMainLock.Unlock();
|
||||
|
@ -136,7 +136,6 @@ ServerWindow::ServerWindow(BRect rect, const char *string, uint32 wlook,
|
||||
fWorkspaces = index;
|
||||
|
||||
fWinBorder = NULL;
|
||||
fTopLayer = NULL;
|
||||
|
||||
// fClientWinPort is the port to which the app awaits messages from the server
|
||||
fClientWinPort = winport;
|
||||
@ -163,12 +162,6 @@ ServerWindow::ServerWindow(BRect rect, const char *string, uint32 wlook,
|
||||
if(vCode != AS_LAYER_CREATE)
|
||||
debugger("SERVER ERROR: ServerWindow(xxx): NO top_view data received! - 2\n");
|
||||
|
||||
// Start receiving top_view data -- pass NULL as the parent view.
|
||||
// This should be the *only* place where this happens.
|
||||
fTopLayer = CreateLayerTree(NULL);
|
||||
fTopLayer->SetAsTopLayer(true);
|
||||
cl = fTopLayer;
|
||||
|
||||
STRACE(("ServerWindow %s:\n",fTitle.String()));
|
||||
STRACE(("\tFrame (%.1f,%.1f,%.1f,%.1f)\n",rect.left,rect.top,rect.right,rect.bottom));
|
||||
STRACE(("\tPort: %ld\n",fMessagePort));
|
||||
@ -181,8 +174,14 @@ void ServerWindow::Init(void)
|
||||
this, desktop->GetDisplayDriver());
|
||||
fWinBorder->RebuildFullRegion();
|
||||
|
||||
// Start receiving top_view data -- pass NULL as the parent view.
|
||||
// This should be the *only* place where this happens.
|
||||
fWinBorder->fTopLayer = CreateLayerTree(NULL);
|
||||
fWinBorder->fTopLayer->SetAsTopLayer(true);
|
||||
cl = fWinBorder->fTopLayer;
|
||||
|
||||
// connect decorator and top layer.
|
||||
fWinBorder->AddChild(fTopLayer, NULL);
|
||||
fWinBorder->AddChild(fWinBorder->fTopLayer, NULL);
|
||||
|
||||
// NOTE: this MUST be before the monitor thread is spawned!
|
||||
desktop->AddWinBorder(fWinBorder);
|
||||
@ -216,9 +215,6 @@ ServerWindow::~ServerWindow(void)
|
||||
|
||||
cl = NULL;
|
||||
|
||||
if (fTopLayer)
|
||||
delete fTopLayer;
|
||||
|
||||
STRACE(("#ServerWindow(%s) will exit NOW!!!\n", fTitle.String()));
|
||||
}
|
||||
//5700 - fara servo , fara cas
|
||||
@ -292,13 +288,13 @@ void ServerWindow::Show(void)
|
||||
WinBorder *previousFocus;
|
||||
BRegion invalidRegion;
|
||||
Workspace *ws;
|
||||
|
||||
// TODO: can you unify this method with Desktop::MouseEventHandler::B_MOUSE_DOWN
|
||||
ws = rl->WorkspaceAt(i+1);
|
||||
ws->BringToFrontANormalWindow(fWinBorder);
|
||||
ws->SearchAndSetNewFront(fWinBorder);
|
||||
previousFocus = ws->FocusLayer();
|
||||
ws->SetFocusLayer(fWinBorder);
|
||||
|
||||
// TODO: only do this in for the active workspace!
|
||||
// first redraw previous window's decorator. It has lost focus state.
|
||||
if (previousFocus)
|
||||
if (previousFocus->fDecorator)
|
||||
@ -306,9 +302,9 @@ void ServerWindow::Show(void)
|
||||
|
||||
// we must build the rebuild region. we have nowhere to take it from.
|
||||
// include decorator's(if any) and fTopLayer's full regions.
|
||||
fTopLayer->RebuildFullRegion();
|
||||
fWinBorder->fTopLayer->RebuildFullRegion();
|
||||
fWinBorder->RebuildFullRegion();
|
||||
invalidRegion.Include(&(fTopLayer->fFull));
|
||||
invalidRegion.Include(&(fWinBorder->fTopLayer->fFull));
|
||||
if (fWinBorder->fDecorator)
|
||||
invalidRegion.Include(&(fWinBorder->fFull));
|
||||
|
||||
@ -828,7 +824,7 @@ void ServerWindow::DispatchMessage(int32 code)
|
||||
|
||||
fSession->ReadInt32(&token);
|
||||
|
||||
Layer *current = FindLayer(fTopLayer, token);
|
||||
Layer *current = FindLayer(fWinBorder->fTopLayer, token);
|
||||
|
||||
if (current)
|
||||
cl=current;
|
||||
|
@ -160,7 +160,6 @@ protected:
|
||||
int32 fHandlerToken;
|
||||
|
||||
BSession *fSession;
|
||||
Layer *fTopLayer;
|
||||
|
||||
// cl is short for currentLayer. We'll use it a lot, that's why it's short :-)
|
||||
Layer *cl;
|
||||
|
@ -91,6 +91,7 @@ WinBorder::WinBorder(const BRect &r, const char *name, const int32 look, const i
|
||||
fKeyModifiers = 0;
|
||||
fMainWinBorder = NULL;
|
||||
fDecorator = NULL;
|
||||
fTopLayer = NULL;
|
||||
fAdFlags = fAdFlags | B_LAYER_CHILDREN_DEPENDANT;
|
||||
fFlags = B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE;
|
||||
|
||||
@ -114,6 +115,11 @@ WinBorder::WinBorder(const BRect &r, const char *name, const int32 look, const i
|
||||
WinBorder::~WinBorder(void)
|
||||
{
|
||||
STRACE(("WinBorder(%s)::~WinBorder()\n",GetName()));
|
||||
if (fTopLayer){
|
||||
delete fTopLayer;
|
||||
fTopLayer = NULL;
|
||||
}
|
||||
|
||||
if (fDecorator)
|
||||
{
|
||||
delete fDecorator;
|
||||
@ -132,7 +138,7 @@ void WinBorder::RebuildFullRegion(void)
|
||||
fDecorator->GetFootprint(&fFull);
|
||||
}
|
||||
|
||||
void WinBorder::MouseDown(PortMessage *msg)
|
||||
void WinBorder::MouseDown(PortMessage *msg, bool sendMessage)
|
||||
{
|
||||
if (!(Window()->IsLocked()))
|
||||
debugger("you must lock the attached ServerWindow object\n\t before calling WinBorder::MouseDown()\n");
|
||||
@ -225,8 +231,7 @@ void WinBorder::MouseDown(PortMessage *msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else if (sendMessage){
|
||||
BMessage msg;
|
||||
msg.what= B_MOUSE_DOWN;
|
||||
msg.AddInt64("when", time);
|
||||
|
@ -36,6 +36,7 @@ class ServerWindow;
|
||||
class Decorator;
|
||||
class DisplayDriver;
|
||||
class PortMessage;
|
||||
class Desktop;
|
||||
|
||||
class WinBorder : public Layer
|
||||
{
|
||||
@ -51,7 +52,7 @@ public:
|
||||
|
||||
virtual void RebuildFullRegion(void);
|
||||
|
||||
void MouseDown(PortMessage *msg);
|
||||
void MouseDown(PortMessage *msg, bool sendMessage);
|
||||
void MouseMoved(PortMessage *msg);
|
||||
void MouseUp(PortMessage *msg);
|
||||
|
||||
@ -79,8 +80,11 @@ public:
|
||||
protected:
|
||||
friend class Layer;
|
||||
friend class ServerWindow;
|
||||
friend class Desktop;
|
||||
|
||||
Decorator *fDecorator;
|
||||
Layer *fTopLayer;
|
||||
|
||||
int32 fMouseButtons;
|
||||
int32 fKeyModifiers;
|
||||
BPoint fLastMousePosition;
|
||||
|
Loading…
Reference in New Issue
Block a user