Windows properly displayed. I mean, both, its border and top_layer are

shown. Some redrawing problems remain while resizing... They will be
fixed soon.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8039 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adi Oanca 2004-06-18 11:50:17 +00:00
parent 895207da06
commit 560a22494e
5 changed files with 65 additions and 23 deletions

View File

@ -14,7 +14,7 @@
#include "LayerData.h"
#include <stdio.h>
#define DEBUG_LAYER
//#define DEBUG_LAYER
#ifdef DEBUG_LAYER
# define STRACE(x) printf x
#else
@ -439,7 +439,7 @@ void Layer::RequestDraw(const BRegion &reg, Layer *startFrom)
Draw(fUpdateReg.Frame());
fDriver->ConstrainClippingRegion(NULL);
// TODO: (WARNING!): For the Update code is MUST not be emptied!!!
// TODO: (WARNING!): For the Update code is MUST NOT be emptied!!!
fUpdateReg.MakeEmpty();
}
}
@ -677,31 +677,69 @@ void Layer::RebuildRegions( const BRegion& reg, uint32 action, BPoint pt, BPoint
{
fFullVisible.MakeEmpty();
fVisible = fFull;
if (fParent && fVisible.CountRects() >0){
#ifdef DEBUG_LAYER_REBUILD
printf("\n ======= Layer(%s):: RR ****** ======\n", GetName());
fFull.PrintToStream();
fVisible.PrintToStream();
printf("\n ======= Layer(%s):: RR ****** END ======\n", GetName());
if (!fParent)
printf("\t NO parent\n");
else
printf("\t VALID Parent: %s.\n", fParent->GetName());
if (!(fVisible.CountRects() > 0))
printf("\t NO visible area!\n");
else
printf("\t VALID visble area\n");
#endif
if (fParent && fVisible.CountRects() > 0){
// not the usual case, but support fot this is needed.
if (fParent->fAdFlags & B_LAYER_CHILDREN_DEPENDANT){
#ifdef DEBUG_LAYER_REBUILD
printf("\n ======= Layer(%s)::B_LAYER_CHILDREN_DEPENDANT Parent ======\n", GetName());
fFull.PrintToStream();
fVisible.PrintToStream();
#endif
// because we're skipping one level, we need to do out
// parent business as well.
// our visible area is relative to our parent's parent.
if (fParent->fParent)
fVisible.IntersectWith(&(fParent->fParent->fVisible));
#ifdef DEBUG_LAYER_REBUILD
fVisible.PrintToStream();
#endif
// exclude parent's visible area which could be composed by
// prior siblings' visible areas.
if (fVisible.CountRects() > 0)
fVisible.Exclude(&(fParent->fVisible));
#ifdef DEBUG_LAYER_REBUILD
fVisible.PrintToStream();
#endif
// we have a final visible area. Include it to our parent's one,
// exclude from parent's parent.
if (fVisible.CountRects() > 0){
fParent->fFullVisible.Include(&fVisible);
#ifdef DEBUG_LAYER_REBUILD
fParent->fFullVisible.PrintToStream();
#endif
if (fParent->fParent)
fParent->fParent->fVisible.Exclude(&fVisible);
#ifdef DEBUG_LAYER_REBUILD
fParent->fParent->fVisible.PrintToStream();
#endif
}
#ifdef DEBUG_LAYER_REBUILD
printf("\n ======= Layer(%s)::B_LAYER_CHILDREN_DEPENDANT Parent END ======\n", GetName());
#endif
}
// for 95+% of cases
else{
#ifdef DEBUG_LAYER_REBUILD
printf("\n ======= Layer(%s):: (!)B_LAYER_CHILDREN_DEPENDANT Parent ======\n", GetName());
#endif
// the visible area is the one common with parent's one.
fVisible.IntersectWith(&(fParent->fVisible));
// exclude from parent's visible area. we're the owners now.

View File

@ -17,8 +17,11 @@ enum
B_LAYER_SIMPLE_MOVE = 0x00004000UL,
B_LAYER_RESIZE = 0x00008000UL,
B_LAYER_MASK_RESIZE = 0x00010000UL,
};
B_LAYER_CHILDREN_DEPENDANT = 0x10000000UL,
enum
{
B_LAYER_CHILDREN_DEPENDANT = 0x1000U,
};
class ServerWindow;

View File

@ -49,7 +49,7 @@
#include "CursorManager.h"
#include "Workspace.h"
#define DEBUG_SERVERWINDOW
//#define DEBUG_SERVERWINDOW
//#define DEBUG_SERVERWINDOW_MOUSE
//#define DEBUG_SERVERWINDOW_KEYBOARD
@ -309,6 +309,15 @@ void ServerWindow::Show(void)
ws->BringToFrontANormalWindow(fWinBorder);
ws->SearchAndSetNewFront(fWinBorder);
ws->SetFocusLayer(fWinBorder);
// TODO: this is UGLY.
// Normaly you have to easy pass a "FullInvalidate". But in this case, WinBorder
// is children dependant, so we CANOT rely on ANY region (full, fullVisible, visible)
// You have to figure out a way to do this 'internaly', I mean add support in
// Layer::FullInvalidate or Layer::[Start]RebuildRegions()
// What we are doinf here is BAD. We pass a rectangle instead of a region. Some areas may
// ger redrawed while there is no need for that!!!
fWinBorder->fParent->FullInvalidate(fWinBorder->fFull.Frame());
}
}
}
@ -722,7 +731,8 @@ Layer * ServerWindow::CreateLayerTree(Layer *localRoot)
delete name;
// there is no way of setting this, other than manually :-)
newLayer->fHidden = hidden;
printf("Layer (%s) hidden : %d?\n", fTitle.String(), hidden);
newLayer->fHidden = (hidden == 0)? false: true;
int32 dummyMsg;

View File

@ -46,7 +46,7 @@
// TODO: Document this file completely
// Toggle general function call output
#define DEBUG_WINBORDER
//#define DEBUG_WINBORDER
// toggle
//#define DEBUG_WINBORDER_MOUSE
@ -112,7 +112,7 @@ WinBorder::WinBorder(const BRect &r, const char *name, const int32 look, const i
WinBorder::~WinBorder(void)
{
STRACE(("WinBorder(%s):~WinBorder()\n",GetName()));
STRACE(("WinBorder(%s)::~WinBorder()\n",GetName()));
if (fDecorator)
{
delete fDecorator;
@ -122,7 +122,7 @@ WinBorder::~WinBorder(void)
void WinBorder::RebuildFullRegion(void)
{
STRACE(("WinBorder(%s):~RebuildFullRegion()\n",GetName()));
STRACE(("WinBorder(%s)::RebuildFullRegion()\n",GetName()));
fFull.MakeEmpty();

View File

@ -20,7 +20,7 @@
// DEALINGS IN THE SOFTWARE.
//
// File Name: Workspace.cpp
// Author: Adi Oanca <adioanca@myrealbox.com>
// Author: Adi Oanca <adioanca@mymail.ro>
// Description: Tracks workspaces
//
//------------------------------------------------------------------------------
@ -251,17 +251,8 @@ STRACE(("\n@Workspace(%ld)::SetFOCUSLayer( %s )\n", ID(), layer? layer->GetName(
if (FocusLayer()){
FocusLayer()->HighlightDecorator(true);
}
// TODO: there had to be a Invalidate() vresion witch takes a BRegion parameter
STRACESTREAM();
Invalidate();
}
else{
// Do nothing!
}
STRACE(("\n#Workspace(%ld)::SetFOCUSLayer( %s ) ENDED\n", ID(), layer? layer->GetName(): "NULL"));
return FocusLayer();
}
//---------------------------------------------------------------------------
@ -277,7 +268,7 @@ STRACE(("\n@Workspace(%ld)::SetFrontLayer( %s )\n", ID(), layer? layer->GetName(
SearchAndSetNewFront(layer);
STRACESTREAM();
// TODO: there had to be a Invalidate() vresion witch takes a BRegion parameter
// TODO: remove???
Invalidate();
return fFrontItem? fFrontItem->layerPtr: NULL;;
@ -337,7 +328,7 @@ WinBorder* Workspace::SearchWinBorder(BPoint pt){
// For the moment, take windows from front to back and see in witch one 'pt' falls
WinBorder *target = NULL;
opLock.Lock();
STRACE(("Searching (%f,%f) in...\n", pt.x, pt.y));
for( WinBorder *wb = GoToBottomItem(); wb; wb = GoToUpperItem()){
// wb->PrintToStream();
if (!wb->IsHidden() && wb->HasPoint(pt)){