The server now differentiates between hidden and minimized - that concept somehow

got lost, before.
It might not work 100% correctly yet, but it works good enough to hide the Tracker
status window from the Deskbar, and thus, fixing bug #133.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16314 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2006-02-09 18:28:29 +00:00
parent 0748857300
commit 995ab7b3c6
5 changed files with 44 additions and 35 deletions
+1 -1
View File
@@ -72,6 +72,7 @@ enum {
// Window definitions
AS_SHOW_WINDOW,
AS_HIDE_WINDOW,
AS_MINIMIZE_WINDOW,
AS_QUIT_WINDOW,
AS_SEND_BEHIND,
AS_SET_LOOK,
@@ -93,7 +94,6 @@ enum {
AS_WINDOW_MOVE,
AS_SET_SIZE_LIMITS,
AS_ACTIVATE_WINDOW,
AS_WINDOW_MINIMIZE,
AS_UPDATE_IF_NEEDED,
// BPicture definitions
+4 -8
View File
@@ -463,21 +463,17 @@ BWindow::ChildAt(int32 index) const
void
BWindow::Minimize(bool minimize)
{
if (IsModal())
if (IsModal() || IsFloating() || fMinimized == minimize)
return;
if (IsFloating())
return;
if (fMinimized == minimize)
return;
Lock();
fMinimized = minimize;
Lock();
fLink->StartMessage(AS_WINDOW_MINIMIZE);
fLink->StartMessage(AS_MINIMIZE_WINDOW);
fLink->Attach<bool>(minimize);
fLink->Flush();
Unlock();
}
+23 -25
View File
@@ -407,33 +407,16 @@ ServerWindow::NotifyQuitRequested()
void
ServerWindow::NotifyMinimize(bool minimize)
{
// NOTE: if you do something else, other than sending a port message, PLEASE lock
// This function doesn't need much -- check to make sure that we should and
// send the message to the client. According to the BeBook, the BWindow hook function
// does all the heavy lifting for us. :)
bool sendMessages = false;
// The client is responsible for the actual minimization
if (minimize) {
if (!fWindowLayer->IsHidden()) {
Hide();
sendMessages = true;
}
} else {
if (fWindowLayer->IsHidden()) {
Show();
sendMessages = true;
}
}
BMessage msg(B_MINIMIZE);
msg.AddInt64("when", real_time_clock_usecs());
msg.AddBool("minimize", minimize);
if (sendMessages) {
BMessage msg(B_MINIMIZE);
msg.AddInt64("when", real_time_clock_usecs());
msg.AddBool("minimize", minimize);
SendMessageToClient(&msg);
}
SendMessageToClient(&msg);
}
//! Sends a message to the client to perform a Zoom
void
ServerWindow::NotifyZoom()
@@ -463,8 +446,8 @@ ServerWindow::GetInfo(window_info& info)
info.window_right = (int)floor(fWindowLayer->Frame().right);
info.window_bottom = (int)floor(fWindowLayer->Frame().bottom);
info.show_hide_level = fWindowLayer->IsHidden() ? 1 : -1; // ???
info.is_mini = fWindowLayer->IsHidden();
info.show_hide_level = fWindowLayer->IsHidden() ? 1 : 0; // ???
info.is_mini = fWindowLayer->IsMinimized();
}
@@ -586,6 +569,21 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
Hide();
break;
case AS_MINIMIZE_WINDOW:
{
DTRACE(("ServerWindow %s: Message AS_MINIMIZE_WINDOW\n", Title()));
bool minimize;
if (link.Read<bool>(&minimize) == B_OK) {
if (minimize && !fWindowLayer->IsHidden())
Hide();
else if (!minimize && fWindowLayer->IsHidden())
Show();
fWindowLayer->SetMinimized(minimize);
}
break;
}
case AS_ACTIVATE_WINDOW:
{
DTRACE(("ServerWindow %s: Message AS_ACTIVATE_WINDOW: ViewLayer: %s\n", Title(), fCurrentLayer->Name()));
+11
View File
@@ -108,6 +108,7 @@ WindowLayer::WindowLayer(const BRect& frame, const char *name,
// windows start hidden
fHidden(true),
fMinimized(false),
fIsFocus(false),
fLook(look),
@@ -1091,6 +1092,16 @@ WindowLayer::SetHidden(bool hidden)
}
void
WindowLayer::SetMinimized(bool minimized)
{
if (minimized == fMinimized)
return;
fMinimized = minimized;
}
bool
WindowLayer::IsVisible() const
{
+5 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2005, Haiku, Inc.
* Copyright (c) 2001-2006, Haiku, Inc.
* Distributed under the terms of the MIT license.
*
* Author: DarkWyrm <bpmagic@columbus.rr.com>
@@ -139,6 +139,9 @@ class WindowLayer {
void SetHidden(bool hidden);
inline bool IsHidden() const { return fHidden; }
void SetMinimized(bool minimized);
inline bool IsMinimized() const { return fMinimized; }
void SetCurrentWorkspace(int32 index)
{ fCurrentWorkspace = index; }
bool IsVisible() const;
@@ -302,6 +305,7 @@ class WindowLayer {
bool fInUpdate;
bool fHidden;
bool fMinimized;
bool fIsFocus;
window_look fLook;