Sync BWindow fShowLevel with the app_server.
Implementing the window_info.show_hide_level in terms of this solves the problem of minimized windows also being considered hidden, when really they are just hidden in the app_server. window_info.show_hide_level is still defined backwards with a comment making that clear. Also removed sending fShowLevel in the minimize request since it is now maintained in the app_server. Fixes #4127.
This commit is contained in:
parent
15ed6a1e56
commit
96cabf581a
@ -596,7 +596,6 @@ BWindow::Minimize(bool minimize)
|
||||
|
||||
fLink->StartMessage(AS_MINIMIZE_WINDOW);
|
||||
fLink->Attach<bool>(minimize);
|
||||
fLink->Attach<int32>(fShowLevel);
|
||||
fLink->Flush();
|
||||
|
||||
Unlock();
|
||||
@ -2612,6 +2611,7 @@ BWindow::Show()
|
||||
|
||||
if (fShowLevel == 1) {
|
||||
fLink->StartMessage(AS_SHOW_WINDOW);
|
||||
fLink->Attach<int32>(fShowLevel);
|
||||
fLink->Flush();
|
||||
}
|
||||
|
||||
@ -2645,6 +2645,7 @@ BWindow::Hide()
|
||||
|
||||
if (fShowLevel == 0) {
|
||||
fLink->StartMessage(AS_HIDE_WINDOW);
|
||||
fLink->Attach<int32>(fShowLevel);
|
||||
fLink->Flush();
|
||||
}
|
||||
|
||||
|
@ -481,7 +481,9 @@ ServerWindow::GetInfo(window_info& info)
|
||||
info.window_right = (int)floor(fWindow->Frame().right);
|
||||
info.window_bottom = (int)floor(fWindow->Frame().bottom);
|
||||
|
||||
info.show_hide_level = fWindow->IsHidden() ? 1 : 0; // ???
|
||||
// This is essentially opposite of the ShowLevel, meaning a window is
|
||||
// hidden if it is 1 or more, and shown if it is 0 or less.
|
||||
info.show_hide_level = fWindow->ShowLevel() <= 0 ? 1 : 0;
|
||||
info.is_mini = fWindow->IsMinimized();
|
||||
}
|
||||
|
||||
@ -595,32 +597,40 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
||||
{
|
||||
switch (code) {
|
||||
case AS_SHOW_WINDOW:
|
||||
{
|
||||
DTRACE(("ServerWindow %s: Message AS_SHOW_WINDOW\n", Title()));
|
||||
_Show();
|
||||
|
||||
int32 showLevel;
|
||||
if (link.Read<int32>(&showLevel) == B_OK) {
|
||||
fWindow->SetShowLevel(showLevel);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
case AS_HIDE_WINDOW:
|
||||
{
|
||||
DTRACE(("ServerWindow %s: Message AS_HIDE_WINDOW\n", Title()));
|
||||
_Hide();
|
||||
break;
|
||||
|
||||
int32 showLevel;
|
||||
if (link.Read<int32>(&showLevel) == B_OK) {
|
||||
fWindow->SetShowLevel(showLevel);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AS_MINIMIZE_WINDOW:
|
||||
{
|
||||
int32 showLevel;
|
||||
bool minimize;
|
||||
|
||||
link.Read<bool>(&minimize);
|
||||
if (link.Read<int32>(&showLevel) == B_OK) {
|
||||
if (link.Read<bool>(&minimize) == B_OK) {
|
||||
DTRACE(("ServerWindow %s: Message AS_MINIMIZE_WINDOW, "
|
||||
"showLevel: %ld, minimize: %d\n", Title(), showLevel,
|
||||
minimize));
|
||||
"minimize: %d\n", Title(), minimize));
|
||||
|
||||
if (showLevel <= 0) {
|
||||
// window is currently hidden - ignore the minimize request
|
||||
if (fWindow->ShowLevel() <= 0) {
|
||||
// Window is currently hidden - ignore the minimize
|
||||
// request, but keep the state in sync.
|
||||
fWindow->SetMinimized(minimize);
|
||||
// TODO: commenting this out makes BWindow::fMinimized
|
||||
// and Window::fMinimized go out of sync. However, not
|
||||
// doing it currently causes #4127.
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -104,6 +104,7 @@ Window::Window(const BRect& frame, const char *name,
|
||||
|
||||
// windows start hidden
|
||||
fHidden(true),
|
||||
fShowLevel(0),
|
||||
fMinimized(false),
|
||||
fIsFocus(false),
|
||||
|
||||
@ -1079,6 +1080,16 @@ Window::SetHidden(bool hidden)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Window::SetShowLevel(int32 showLevel)
|
||||
{
|
||||
if (showLevel == fShowLevel)
|
||||
return;
|
||||
|
||||
fShowLevel = showLevel;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Window::SetMinimized(bool minimized)
|
||||
{
|
||||
|
@ -210,6 +210,9 @@ public:
|
||||
void SetHidden(bool hidden);
|
||||
inline bool IsHidden() const { return fHidden; }
|
||||
|
||||
void SetShowLevel(int32 showLevel);
|
||||
inline int32 ShowLevel() const { return fShowLevel; }
|
||||
|
||||
void SetMinimized(bool minimized);
|
||||
inline bool IsMinimized() const { return fMinimized; }
|
||||
|
||||
@ -410,6 +413,7 @@ protected:
|
||||
bool fUpdatesEnabled : 1;
|
||||
|
||||
bool fHidden : 1;
|
||||
int32 fShowLevel;
|
||||
bool fMinimized : 1;
|
||||
bool fIsFocus : 1;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user