- 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
+15 -14
View File
@@ -1358,7 +1358,7 @@ Desktop::SetWindowTabLocation(Window* window, float location)
BRegion dirty; BRegion dirty;
bool changed = window->SetTabLocation(location, dirty); bool changed = window->SetTabLocation(location, dirty);
if (changed) if (changed)
_RebuildAndRedrawAfterWindowChange(window, dirty); RebuildAndRedrawAfterWindowChange(window, dirty);
InvokeSetWindowTabLocation(window, location); InvokeSetWindowTabLocation(window, location);
@@ -1375,7 +1375,7 @@ Desktop::SetWindowDecoratorSettings(Window* window, const BMessage& settings)
bool changed = window->SetDecoratorSettings(settings, dirty); bool changed = window->SetDecoratorSettings(settings, dirty);
bool listenerChanged = InvokeSetDecoratorSettings(window, settings); bool listenerChanged = InvokeSetDecoratorSettings(window, settings);
if (changed || listenerChanged) if (changed || listenerChanged)
_RebuildAndRedrawAfterWindowChange(window, dirty); RebuildAndRedrawAfterWindowChange(window, dirty);
return changed; return changed;
} }
@@ -1480,7 +1480,7 @@ Desktop::FontsChanged(Window* window)
BRegion dirty; BRegion dirty;
window->FontsChanged(&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 // TODO: test what happens when the window
// finds out it needs to resize itself... // 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 // TODO: test what happens when the window
// finds out it needs to resize itself... // 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; BRegion dirty;
window->SetTitle(title, dirty); window->SetTitle(title, dirty);
_RebuildAndRedrawAfterWindowChange(window, dirty); RebuildAndRedrawAfterWindowChange(window, dirty);
} }
@@ -1925,6 +1925,13 @@ Desktop::ReloadDecor()
{ {
AutoWriteLocker _(fWindowLock); 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; for (Window* window = fAllWindows.FirstWindow(); window != NULL;
window = window->NextWindow(kAllWindowList)) { window = window->NextWindow(kAllWindowList)) {
BRegion oldBorder; BRegion oldBorder;
@@ -1936,15 +1943,9 @@ Desktop::ReloadDecor()
window->GetBorderRegion(&border); window->GetBorderRegion(&border);
border.Include(&oldBorder); 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 // register new listeners
const DesktopListenerList& newListeners const DesktopListenerList& newListeners
= gDecorManager.GetDesktopListeners(); = gDecorManager.GetDesktopListeners();
@@ -3010,7 +3011,7 @@ Desktop::_SetBackground(BRegion& background)
//! The all window lock must be held when calling this function. //! The all window lock must be held when calling this function.
void void
Desktop::_RebuildAndRedrawAfterWindowChange(Window* changedWindow, Desktop::RebuildAndRedrawAfterWindowChange(Window* changedWindow,
BRegion& dirty) BRegion& dirty)
{ {
if (!changedWindow->IsVisible() || dirty.CountRects() == 0) if (!changedWindow->IsVisible() || dirty.CountRects() == 0)
+5 -2
View File
@@ -145,6 +145,11 @@ public:
::HWInterface* HWInterface() const ::HWInterface* HWInterface() const
{ return fVirtualScreen.HWInterface(); } { return fVirtualScreen.HWInterface(); }
void RebuildAndRedrawAfterWindowChange(
Window* window, BRegion& dirty);
// the window lock must be held when calling
// this function
// ScreenOwner implementation // ScreenOwner implementation
virtual void ScreenRemoved(Screen* screen) {} virtual void ScreenRemoved(Screen* screen) {}
virtual void ScreenAdded(Screen* screen) {} virtual void ScreenAdded(Screen* screen) {}
@@ -295,8 +300,6 @@ private:
void _TriggerWindowRedrawing( void _TriggerWindowRedrawing(
BRegion& newDirtyRegion); BRegion& newDirtyRegion);
void _SetBackground(BRegion& background); void _SetBackground(BRegion& background);
void _RebuildAndRedrawAfterWindowChange(
Window* window, BRegion& dirty);
status_t _ActivateApp(team_id team); status_t _ActivateApp(team_id team);