Tracker: Save Desktop state again

Let me tell you a story about a bug.

In a615ec8f86 Axel imported the OpenTracker code
into Haiku with fSaveStateIsEnabled set to true (for Desktop and all windows).

In 9f2a3f6f47 I (John) changed it to:
fSaveStateIsEnabled(dynamic_cast<BDeskWindow*>(this) == NULL) which is suppose
to detect whether or not the ContainerWindow is the Desktop and only save the
state if it is NOT. However, this didn't actually work because since this is
called in the constructor the dynamic_cast to BDeskWindow* fails. Therefore we
were still saving the state of Desktop even though the code make it look like
we weren't.

In e7803cf1f6 Augustin updated the code so that
BDeskWindow passes in a isDeskbar flag as part of the constructor parameters
thus detecting that the window was Deskbar correctly. So basically Augustin
fixed the bug detecting whether or not the window was the Deskbar in the
constructor which then disabled saving the Desktop's state to attributes.
Augustin unknowingly turned saving the Desktop's state off.

We don't want to disable saving the Desktop's state because that's where we
store things like the icon size. What I was probably thinking when I tried
unsuccessfully to turn off saving the state of the Desktop was that I don't
want to save the WINDOW state of the Desktop since that would save the
window dimensions of the Desktop (whatever your screen resolution is) and if
you changed Tracker to non-spatial mode and opened the Desktop in a Tracker
window it would pick up those attributes and then make the window take up the
entire dimensions of your screen (a whole different bug).

This bug, however, is also handled in 9f2a3f6f47
because code was added to BContainerWindow::SaveWindowState() which detects
whether or not the window is the Desktop and if so, doesn't save (or restore)
the window state (which is only part of the state).

So with this change (reversal really) the other parts of the Desktop's state
like icon size are once again saved while the window state is not.

Fixes #11864
This commit is contained in:
John Scipione 2015-02-25 15:31:43 -05:00
parent 94dcb68b55
commit 95e8362c52

View File

@ -500,7 +500,7 @@ BContainerWindow::BContainerWindow(LockingList<BWindow>* list,
fDragMessage(NULL),
fCachedTypesList(NULL),
fStateNeedsSaving(false),
fSaveStateIsEnabled(!fIsDesktop),
fSaveStateIsEnabled(true),
fIsWatchingPath(false)
{
InitIconPreloader();