Fixed focusing problem
some optimizations to "drawing code"(not the real one) because of more efficient locking. ... other improvements. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6074 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -231,7 +231,8 @@ void Desktop::SetFrontWinBorder(WinBorder* winBorder){
|
|||||||
// TODO: implement
|
// TODO: implement
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void Desktop::SetFoocusWinBorder(WinBorder* winBorder){
|
// TODO: remove shortly?
|
||||||
|
void Desktop::SetFoooocusWinBorder(WinBorder* winBorder){
|
||||||
if (FocusWinBorder() == winBorder && (winBorder && !winBorder->IsHidden()))
|
if (FocusWinBorder() == winBorder && (winBorder && !winBorder->IsHidden()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -312,9 +313,7 @@ void Desktop::MouseEventHandler(PortMessage *msg){
|
|||||||
rl->fMainLock.Lock();
|
rl->fMainLock.Lock();
|
||||||
|
|
||||||
ws->SearchAndSetNewFront(target);
|
ws->SearchAndSetNewFront(target);
|
||||||
// NOTE: !!! Be VERY careful about this method !!!!
|
ws->SetFocusLayer(target);
|
||||||
SetFoocusWinBorder(target);
|
|
||||||
//ws->SetFocusLayer(target);
|
|
||||||
|
|
||||||
rl->fMainLock.Unlock();
|
rl->fMainLock.Unlock();
|
||||||
fGeneralLock.Unlock();
|
fGeneralLock.Unlock();
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public:
|
|||||||
void RemoveWinBorder(WinBorder* winBorder);
|
void RemoveWinBorder(WinBorder* winBorder);
|
||||||
bool HasWinBorder(WinBorder* winBorder);
|
bool HasWinBorder(WinBorder* winBorder);
|
||||||
void SetFrontWinBorder(WinBorder* winBorder);
|
void SetFrontWinBorder(WinBorder* winBorder);
|
||||||
void SetFoocusWinBorder(WinBorder* winBorder);
|
void SetFoooocusWinBorder(WinBorder* winBorder);
|
||||||
WinBorder* FrontWinBorder(void) const;
|
WinBorder* FrontWinBorder(void) const;
|
||||||
WinBorder* FocusWinBorder(void) const;
|
WinBorder* FocusWinBorder(void) const;
|
||||||
|
|
||||||
|
|||||||
@@ -153,6 +153,9 @@ Layer* RootLayer::VirtualBottomChild() const{
|
|||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void RootLayer::AddWinBorderToWorkspaces(WinBorder* winBorder, uint32 wks){
|
void RootLayer::AddWinBorderToWorkspaces(WinBorder* winBorder, uint32 wks){
|
||||||
|
if (!(fMainLock.IsLocked()))
|
||||||
|
debugger("RootLayer::AddWinBorderToWorkspaces - fMainLock has to be locked!\n");
|
||||||
|
|
||||||
if (wks == B_CURRENT_WORKSPACE){
|
if (wks == B_CURRENT_WORKSPACE){
|
||||||
ActiveWorkspace()->AddLayerPtr(winBorder);
|
ActiveWorkspace()->AddLayerPtr(winBorder);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -289,10 +289,14 @@ ServerApp *ServerWindow::GetApp(void)
|
|||||||
//! Shows the window's WinBorder
|
//! Shows the window's WinBorder
|
||||||
void ServerWindow::Show(void)
|
void ServerWindow::Show(void)
|
||||||
{
|
{
|
||||||
|
if(!_winborder->IsHidden())
|
||||||
|
return;
|
||||||
|
|
||||||
STRACE(("ServerWindow %s: Show\n",_title->String()));
|
STRACE(("ServerWindow %s: Show\n",_title->String()));
|
||||||
if(_winborder)
|
if(_winborder)
|
||||||
{
|
{
|
||||||
RootLayer *rl = _winborder->GetRootLayer();
|
RootLayer *rl = _winborder->GetRootLayer();
|
||||||
|
int32 wksCount;
|
||||||
|
|
||||||
desktop->fGeneralLock.Lock();
|
desktop->fGeneralLock.Lock();
|
||||||
printf("ServerWindow(%s)::Show() - General lock acquired\n", _winborder->GetName());
|
printf("ServerWindow(%s)::Show() - General lock acquired\n", _winborder->GetName());
|
||||||
@@ -300,8 +304,16 @@ printf("ServerWindow(%s)::Show() - General lock acquired\n", _winborder->GetName
|
|||||||
printf("ServerWindow(%s)::Show() - Main lock acquired\n", _winborder->GetName());
|
printf("ServerWindow(%s)::Show() - Main lock acquired\n", _winborder->GetName());
|
||||||
|
|
||||||
_winborder->Show();
|
_winborder->Show();
|
||||||
|
|
||||||
|
if ((_feel == B_FLOATING_SUBSET_WINDOW_FEEL || _feel == B_MODAL_SUBSET_WINDOW_FEEL)
|
||||||
|
&& _winborder->MainWinBorder() == NULL)
|
||||||
|
{
|
||||||
|
// This window hasn't been added to a normal window subset,
|
||||||
|
// so don't call placement or redrawing methods!
|
||||||
|
goto goOut;
|
||||||
|
}
|
||||||
|
|
||||||
int32 wksCount= rl->WorkspaceCount();
|
wksCount = rl->WorkspaceCount();
|
||||||
for(int32 i = 0; i < wksCount; i++){
|
for(int32 i = 0; i < wksCount; i++){
|
||||||
if (fWorkspaces & (0x00000001UL << i)){
|
if (fWorkspaces & (0x00000001UL << i)){
|
||||||
Workspace *ws = rl->WorkspaceAt(i+1);
|
Workspace *ws = rl->WorkspaceAt(i+1);
|
||||||
@@ -309,6 +321,9 @@ printf("ServerWindow(%s)::Show() - Main lock acquired\n", _winborder->GetName())
|
|||||||
ws->SetFocusLayer(_winborder);
|
ws->SetFocusLayer(_winborder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
goOut:
|
||||||
|
|
||||||
rl->fMainLock.Unlock();
|
rl->fMainLock.Unlock();
|
||||||
printf("ServerWindow(%s)::Show() - Main lock released\n", _winborder->GetName());
|
printf("ServerWindow(%s)::Show() - Main lock released\n", _winborder->GetName());
|
||||||
desktop->fGeneralLock.Unlock();
|
desktop->fGeneralLock.Unlock();
|
||||||
@@ -319,6 +334,9 @@ printf("ServerWindow(%s)::Show() - General lock released\n", _winborder->GetName
|
|||||||
//! Hides the window's WinBorder
|
//! Hides the window's WinBorder
|
||||||
void ServerWindow::Hide(void)
|
void ServerWindow::Hide(void)
|
||||||
{
|
{
|
||||||
|
if(_winborder->IsHidden())
|
||||||
|
return;
|
||||||
|
|
||||||
STRACE(("ServerWindow %s: Hide\n",_title->String()));
|
STRACE(("ServerWindow %s: Hide\n",_title->String()));
|
||||||
if(_winborder){
|
if(_winborder){
|
||||||
RootLayer *rl = _winborder->GetRootLayer();
|
RootLayer *rl = _winborder->GetRootLayer();
|
||||||
|
|||||||
@@ -737,23 +737,16 @@ void WinBorder::AddToSubsetOf(WinBorder* main){
|
|||||||
printf("WinBorder(%s)::AddToSubsetOf() - General lock acquired\n", GetName());
|
printf("WinBorder(%s)::AddToSubsetOf() - General lock acquired\n", GetName());
|
||||||
rl->fMainLock.Lock();
|
rl->fMainLock.Lock();
|
||||||
printf("WinBorder(%s)::AddToSubsetOf() - Main lock acquired\n", GetName());
|
printf("WinBorder(%s)::AddToSubsetOf() - Main lock acquired\n", GetName());
|
||||||
|
|
||||||
for(int32 i = 0; i < rl->WorkspaceCount(); i++){
|
for(int32 i = 0; i < rl->WorkspaceCount(); i++){
|
||||||
Workspace *ws = rl->WorkspaceAt(i+1);
|
Workspace *ws = rl->WorkspaceAt(i+1);
|
||||||
if(ws->FrontLayer() == main){
|
if(ws->FrontLayer() == main)
|
||||||
printf("\n@\n@\n");
|
|
||||||
ws->PrintToStream();
|
|
||||||
ws->AddLayerPtr(this);
|
ws->AddLayerPtr(this);
|
||||||
if(rl->ActiveWorkspace() == ws && !IsHidden()){
|
|
||||||
ws->Invalidate();
|
|
||||||
printf("\n#\n#\n");
|
|
||||||
ws->PrintToStream();
|
|
||||||
printf("\n#\n#\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
rl->fMainLock.Unlock();
|
|
||||||
|
rl->fMainLock.Unlock();
|
||||||
printf("WinBorder(%s)::AddToSubsetOf() - Main lock released\n", GetName());
|
printf("WinBorder(%s)::AddToSubsetOf() - Main lock released\n", GetName());
|
||||||
desktop->fGeneralLock.Unlock();
|
desktop->fGeneralLock.Unlock();
|
||||||
printf("WinBorder(%s)::AddToSubsetOf() - General lock released\n", GetName());
|
printf("WinBorder(%s)::AddToSubsetOf() - General lock released\n", GetName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,12 +83,14 @@ bool Workspace::AddLayerPtr(WinBorder* layer){
|
|||||||
opLock.Unlock();
|
opLock.Unlock();
|
||||||
|
|
||||||
STRACE(("\n*AddLayerPtr(%s) -", layer->GetName()));
|
STRACE(("\n*AddLayerPtr(%s) -", layer->GetName()));
|
||||||
// do a *smart* search and set the new 'front'
|
|
||||||
SearchAndSetNewFront(layer);
|
// this may happen in case of subset windows.
|
||||||
// do a *smart* search and set the new 'focus'
|
if(!(layer->IsHidden())){
|
||||||
//SearchAndSetNewFocus(layer); // - it WILL be called!
|
// do a *smart* search and set the new 'front'
|
||||||
// this also does a redraw
|
SearchAndSetNewFront(layer);
|
||||||
SetFocusLayer(layer);
|
// do a *smart* search and set the new 'focus' + a redraw
|
||||||
|
SetFocusLayer(layer);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -162,13 +164,33 @@ printf("Layer %s NOT found in Workspace No %ld\n", layer->GetName(), ID());
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
WinBorder* Workspace::SetFocusLayer(WinBorder* layer){
|
WinBorder* Workspace::SetFocusLayer(WinBorder* layer){
|
||||||
STRACE(("\n@Workspace(%ld)::SetFOCUSLayer( %s )\n", ID(), layer? layer->GetName(): "NULL"));
|
STRACE(("\n@Workspace(%ld)::SetFOCUSLayer( %s )\n", ID(), layer? layer->GetName(): "NULL"));
|
||||||
|
|
||||||
SearchAndSetNewFocus(layer);
|
|
||||||
STRACESTREAM();
|
|
||||||
// TODO: there had to be a Invalidate() vresion witch takes a BRegion parameter
|
|
||||||
Invalidate();
|
|
||||||
|
|
||||||
return fFocusItem? fFocusItem->layerPtr : NULL;
|
if(!(desktop->fGeneralLock.IsLocked()))
|
||||||
|
debugger("Workspace::SetFocusLayer - desktop->fGeneralLock must be LOCKED!\n");
|
||||||
|
|
||||||
|
WinBorder *previousFocus = FocusLayer();
|
||||||
|
|
||||||
|
SearchAndSetNewFocus(layer);
|
||||||
|
|
||||||
|
if (previousFocus != FocusLayer()){
|
||||||
|
if (previousFocus)
|
||||||
|
previousFocus->SetFocus(false);
|
||||||
|
|
||||||
|
if (FocusLayer()){
|
||||||
|
FocusLayer()->SetFocus(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: there had to be a Invalidate() vresion witch takes a BRegion parameter
|
||||||
|
Invalidate();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
// Do nothing!
|
||||||
|
}
|
||||||
|
|
||||||
|
STRACESTREAM();
|
||||||
|
STRACE(("\n#Workspace(%ld)::SetFOCUSLayer( %s ) ENDED\n", ID(), layer? layer->GetName(): "NULL"));
|
||||||
|
|
||||||
|
return FocusLayer();
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
WinBorder* Workspace::FocusLayer() const{
|
WinBorder* Workspace::FocusLayer() const{
|
||||||
@@ -177,6 +199,10 @@ WinBorder* Workspace::FocusLayer() const{
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
WinBorder* Workspace::SetFrontLayer(WinBorder* layer){
|
WinBorder* Workspace::SetFrontLayer(WinBorder* layer){
|
||||||
STRACE(("\n@Workspace(%ld)::SetFrontLayer( %s )\n", ID(), layer? layer->GetName(): "NULL"));
|
STRACE(("\n@Workspace(%ld)::SetFrontLayer( %s )\n", ID(), layer? layer->GetName(): "NULL"));
|
||||||
|
|
||||||
|
if(!(desktop->fGeneralLock.IsLocked()))
|
||||||
|
debugger("Workspace::SetFRONTLayer - desktop->fGeneralLock must be LOCKED!\n");
|
||||||
|
|
||||||
SearchAndSetNewFront(layer);
|
SearchAndSetNewFront(layer);
|
||||||
STRACESTREAM();
|
STRACESTREAM();
|
||||||
// TODO: there had to be a Invalidate() vresion witch takes a BRegion parameter
|
// TODO: there had to be a Invalidate() vresion witch takes a BRegion parameter
|
||||||
|
|||||||
@@ -61,12 +61,13 @@ public:
|
|||||||
void SearchAndSetNewFront(WinBorder* preferred);
|
void SearchAndSetNewFront(WinBorder* preferred);
|
||||||
void SearchAndSetNewFocus(WinBorder* preferred);
|
void SearchAndSetNewFocus(WinBorder* preferred);
|
||||||
|
|
||||||
|
ListData* HasItem(ListData* item);
|
||||||
|
ListData* HasItem(WinBorder* layer);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void InsertItem(ListData* item, ListData* before);
|
void InsertItem(ListData* item, ListData* before);
|
||||||
void RemoveItem(ListData* item);
|
void RemoveItem(ListData* item);
|
||||||
ListData* HasItem(ListData* item);
|
|
||||||
ListData* HasItem(WinBorder* layer);
|
|
||||||
|
|
||||||
ListData* FindPlace(ListData* pref);
|
ListData* FindPlace(ListData* pref);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user