synced with OT repository - I guess you knew what was comming,
Tracker saves and restores the window decorator settings on Haiku. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17602 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
56cedb9e81
commit
12104c2eab
@ -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"
|
||||
|
@ -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__
|
||||
}
|
||||
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user