diff --git a/src/kits/tracker/Attributes.h b/src/kits/tracker/Attributes.h index 6125f5434d..a65a1defa5 100644 --- a/src/kits/tracker/Attributes.h +++ b/src/kits/tracker/Attributes.h @@ -54,6 +54,7 @@ namespace BPrivate { // private attributes #define kAttrWindowFrame "_trk/windframe" #define kAttrWindowWorkspace "_trk/windwkspc" +#define kAttrWindowDecor "_trk/winddecor" #define kAttrQueryString "_trk/qrystr" #define kAttrQueryVolume "_trk/qryvol1" diff --git a/src/kits/tracker/ContainerWindow.cpp b/src/kits/tracker/ContainerWindow.cpp index 594eee30a8..6d4e0faf60 100644 --- a/src/kits/tracker/ContainerWindow.cpp +++ b/src/kits/tracker/ContainerWindow.cpp @@ -3313,19 +3313,33 @@ BContainerWindow::RestoreWindowState(AttributeStreamNode *node) } BRect frame(Frame()); - if (node->Read(rectAttributeName, 0, B_RECT_TYPE, sizeof(BRect), &frame) == sizeof(BRect)) { + if (node->Read(rectAttributeName, 0, B_RECT_TYPE, sizeof(BRect), &frame) == sizeof(BRect)) { MoveTo(frame.LeftTop()); ResizeTo(frame.Width(), frame.Height()); } else sNewWindRect.OffsetBy(kWindowStaggerBy, kWindowStaggerBy); uint32 workspace; - if (node->Read(workspaceAttributeName, 0, B_INT32_TYPE, sizeof(uint32), &workspace) == sizeof(uint32) - && (fContainerWindowFlags & kRestoreWorkspace)) + if ((fContainerWindowFlags & kRestoreWorkspace) + && node->Read(workspaceAttributeName, 0, B_INT32_TYPE, sizeof(uint32), &workspace) == sizeof(uint32)) SetWorkspaces(workspace); if (fContainerWindowFlags & kIsHidden) Minimize(true); + +#if __HAIKU__ + // restore window decor settings + int32 size = node->Contains(kAttrWindowDecor, B_RAW_TYPE); + if (size > 0) { + char buffer[size]; + if ((fContainerWindowFlags & kRestoreDecor) + && node->Read(kAttrWindowDecor, 0, B_RAW_TYPE, size, buffer) == size) { + BMessage decorSettings; + if (decorSettings.Unflatten(buffer) == B_OK) + SetDecoratorSettings(decorSettings); + } + } +#endif // __HAIKU__ } @@ -3354,12 +3368,21 @@ BContainerWindow::RestoreWindowState(const BMessage &message) sNewWindRect.OffsetBy(kWindowStaggerBy, kWindowStaggerBy); uint32 workspace; - - if (message.FindInt32(workspaceAttributeName, (int32 *)&workspace) == B_OK - && (fContainerWindowFlags & kRestoreWorkspace)) + if ((fContainerWindowFlags & kRestoreWorkspace) + && message.FindInt32(workspaceAttributeName, (int32 *)&workspace) == B_OK) SetWorkspaces(workspace); + if (fContainerWindowFlags & kIsHidden) Minimize(true); + +#if __HAIKU__ + // restore window decor settings + BMessage decorSettings; + if ((fContainerWindowFlags & kRestoreDecor) + && message.FindMessage(kAttrWindowDecor, &decorSettings) == B_OK) { + SetDecoratorSettings(decorSettings); + } +#endif // __HAIKU__ } @@ -3380,9 +3403,21 @@ BContainerWindow::SaveWindowState(AttributeStreamNode *node) // node is null if it already got deleted BRect frame(Frame()); node->Write(rectAttributeName, 0, B_RECT_TYPE, sizeof(BRect), &frame); + uint32 workspaces = Workspaces(); node->Write(workspaceAttributeName, 0, B_INT32_TYPE, sizeof(uint32), &workspaces); + +#if __HAIKU__ + BMessage decorSettings; + if (GetDecoratorSettings(&decorSettings) == B_OK) { + int32 size = decorSettings.FlattenedSize(); + char buffer[size]; + if (decorSettings.Flatten(buffer, size) == B_OK) { + node->Write(kAttrWindowDecor, 0, B_RAW_TYPE, size, buffer); + } + } +#endif // __HAIKU__ } @@ -3404,6 +3439,13 @@ BContainerWindow::SaveWindowState(BMessage &message) const BRect frame(Frame()); message.AddRect(rectAttributeName, frame); message.AddInt32(workspaceAttributeName, (int32)Workspaces()); + +#if __HAIKU__ + BMessage decorSettings; + if (GetDecoratorSettings(&decorSettings) == B_OK) { + message.AddMessage(kAttrWindowDecor, &decorSettings); + } +#endif // __HAIKU__ } diff --git a/src/kits/tracker/ContainerWindow.h b/src/kits/tracker/ContainerWindow.h index fbd5674c3f..62994f10f4 100644 --- a/src/kits/tracker/ContainerWindow.h +++ b/src/kits/tracker/ContainerWindow.h @@ -66,9 +66,10 @@ const window_look kPrivateDesktopWindowLook = window_look(4); enum { // flags that describe opening of the window - kRestoreWorkspace = 0x1, - kIsHidden = 0x2 + kRestoreWorkspace = 0x1, + kIsHidden = 0x2, // set when opening a window during initial Tracker start + kRestoreDecor = 0x4 }; class BContainerWindow : public BWindow { diff --git a/src/kits/tracker/Tracker.cpp b/src/kits/tracker/Tracker.cpp index 4e7fb0a402..bb6a915847 100644 --- a/src/kits/tracker/Tracker.cpp +++ b/src/kits/tracker/Tracker.cpp @@ -689,7 +689,7 @@ TTracker::OpenRef(const entry_ref *ref, const node_ref *nodeToClose, if (openAsContainer || selector == kRunOpenWithWindow) { // special case opening plain folders, queries or using open with - OpenContainerWindow(model, 0, selector); // window adopts model + OpenContainerWindow(model, 0, selector, kRestoreDecor); // window adopts model if (nodeToClose) CloseParentWaitingForChildSoon(ref, nodeToClose); } else if (model->IsQueryTemplate()) { @@ -1264,11 +1264,11 @@ TTracker::ReadyToRun() if (restoreStateFromMessage) OpenContainerWindow(model, 0, kOpen, - kRestoreWorkspace | (flags & kOpenWindowMinimized ? kIsHidden : 0U), + kRestoreWorkspace | (flags & kOpenWindowMinimized ? kIsHidden : 0U) | kRestoreDecor, false, &state); else OpenContainerWindow(model, 0, kOpen, - kRestoreWorkspace | (flags & kOpenWindowMinimized ? kIsHidden : 0U)); + kRestoreWorkspace | (flags & kOpenWindowMinimized ? kIsHidden : 0U) | kRestoreDecor); } else delete model; }