- Make RebuildAndRedrawAfterWindowChange public. This is useful when changing the window footprint from the outside. In this case RebuildAndRedrawAfterWindowChange recalculate the clipping and everything. Need this when I switch a decorator into a SAT stacking mode which is not a standard desktop operation. In this case the tab size is adjusted and also the window clipping need to be recalculated.

- First unregister listener reload decorators and then register new listener.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38070 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Clemens Zeidler 2010-08-12 22:09:28 +00:00
parent f182b4e2f9
commit 5483fa4e78
2 changed files with 20 additions and 16 deletions

View File

@ -1358,7 +1358,7 @@ Desktop::SetWindowTabLocation(Window* window, float location)
BRegion dirty;
bool changed = window->SetTabLocation(location, dirty);
if (changed)
_RebuildAndRedrawAfterWindowChange(window, dirty);
RebuildAndRedrawAfterWindowChange(window, dirty);
InvokeSetWindowTabLocation(window, location);
@ -1375,7 +1375,7 @@ Desktop::SetWindowDecoratorSettings(Window* window, const BMessage& settings)
bool changed = window->SetDecoratorSettings(settings, dirty);
bool listenerChanged = InvokeSetDecoratorSettings(window, settings);
if (changed || listenerChanged)
_RebuildAndRedrawAfterWindowChange(window, dirty);
RebuildAndRedrawAfterWindowChange(window, dirty);
return changed;
}
@ -1480,7 +1480,7 @@ Desktop::FontsChanged(Window* window)
BRegion dirty;
window->FontsChanged(&dirty);
_RebuildAndRedrawAfterWindowChange(window, dirty);
RebuildAndRedrawAfterWindowChange(window, dirty);
}
@ -1497,7 +1497,7 @@ Desktop::SetWindowLook(Window* window, window_look newLook)
// TODO: test what happens when the window
// finds out it needs to resize itself...
_RebuildAndRedrawAfterWindowChange(window, dirty);
RebuildAndRedrawAfterWindowChange(window, dirty);
}
@ -1615,7 +1615,7 @@ Desktop::SetWindowFlags(Window *window, uint32 newFlags)
// TODO: test what happens when the window
// finds out it needs to resize itself...
_RebuildAndRedrawAfterWindowChange(window, dirty);
RebuildAndRedrawAfterWindowChange(window, dirty);
}
@ -1627,7 +1627,7 @@ Desktop::SetWindowTitle(Window *window, const char* title)
BRegion dirty;
window->SetTitle(title, dirty);
_RebuildAndRedrawAfterWindowChange(window, dirty);
RebuildAndRedrawAfterWindowChange(window, dirty);
}
@ -1925,6 +1925,13 @@ Desktop::ReloadDecor()
{
AutoWriteLocker _(fWindowLock);
// TODO it is assumed all listeners are registered by one decor
// unregister old listeners
const DesktopListenerDLList& currentListeners = GetDesktopListenerList();
for (DesktopListener* listener = currentListeners.First();
listener != NULL; listener = currentListeners.GetNext(listener))
UnregisterListener(listener);
for (Window* window = fAllWindows.FirstWindow(); window != NULL;
window = window->NextWindow(kAllWindowList)) {
BRegion oldBorder;
@ -1936,15 +1943,9 @@ Desktop::ReloadDecor()
window->GetBorderRegion(&border);
border.Include(&oldBorder);
_RebuildAndRedrawAfterWindowChange(window, border);
RebuildAndRedrawAfterWindowChange(window, border);
}
// TODO it is assumed all listeners are registered by one decor
// unregister old listeners
const DesktopListenerDLList& currentListeners = GetDesktopListenerList();
for (DesktopListener* listener = currentListeners.First();
listener != NULL; listener = currentListeners.GetNext(listener))
UnregisterListener(listener);
// register new listeners
const DesktopListenerList& newListeners
= gDecorManager.GetDesktopListeners();
@ -3010,7 +3011,7 @@ Desktop::_SetBackground(BRegion& background)
//! The all window lock must be held when calling this function.
void
Desktop::_RebuildAndRedrawAfterWindowChange(Window* changedWindow,
Desktop::RebuildAndRedrawAfterWindowChange(Window* changedWindow,
BRegion& dirty)
{
if (!changedWindow->IsVisible() || dirty.CountRects() == 0)

View File

@ -145,6 +145,11 @@ public:
::HWInterface* HWInterface() const
{ return fVirtualScreen.HWInterface(); }
void RebuildAndRedrawAfterWindowChange(
Window* window, BRegion& dirty);
// the window lock must be held when calling
// this function
// ScreenOwner implementation
virtual void ScreenRemoved(Screen* screen) {}
virtual void ScreenAdded(Screen* screen) {}
@ -295,8 +300,6 @@ private:
void _TriggerWindowRedrawing(
BRegion& newDirtyRegion);
void _SetBackground(BRegion& background);
void _RebuildAndRedrawAfterWindowChange(
Window* window, BRegion& dirty);
status_t _ActivateApp(team_id team);