* If a window was hidden during resize/movement, it would still be in resizing
or moving mode when it was shown again. Added a test app HideAndShow which let you easily reproduce the faulty behaviour (with a previous version of the app_server, that is). * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28847 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
5ddb65f007
commit
ea5c7202cb
src
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2008, Haiku.
|
* Copyright 2001-2009, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@ -947,7 +947,8 @@ Desktop::_SetWorkspace(int32 index)
|
|||||||
bool movedMouseEventWindow = false;
|
bool movedMouseEventWindow = false;
|
||||||
display_mode previousMode, newMode;
|
display_mode previousMode, newMode;
|
||||||
fVirtualScreen.ScreenAt(0)->GetMode(&previousMode);
|
fVirtualScreen.ScreenAt(0)->GetMode(&previousMode);
|
||||||
fVirtualScreen.RestoreConfiguration(*this, fSettings->WorkspacesMessage(index));
|
fVirtualScreen.RestoreConfiguration(*this,
|
||||||
|
fSettings->WorkspacesMessage(index));
|
||||||
fVirtualScreen.ScreenAt(0)->GetMode(&newMode);
|
fVirtualScreen.ScreenAt(0)->GetMode(&newMode);
|
||||||
// We only need to invalidate the entire desktop if we changed display modes
|
// We only need to invalidate the entire desktop if we changed display modes
|
||||||
if (memcmp(&previousMode, &newMode, sizeof(display_mode)))
|
if (memcmp(&previousMode, &newMode, sizeof(display_mode)))
|
||||||
@ -964,7 +965,8 @@ Desktop::_SetWorkspace(int32 index)
|
|||||||
_Windows(index).AddWindow(fMouseEventWindow);
|
_Windows(index).AddWindow(fMouseEventWindow);
|
||||||
_Windows(previousIndex).RemoveWindow(fMouseEventWindow);
|
_Windows(previousIndex).RemoveWindow(fMouseEventWindow);
|
||||||
|
|
||||||
_UpdateSubsetWorkspaces(fMouseEventWindow, previousIndex, index);
|
_UpdateSubsetWorkspaces(fMouseEventWindow, previousIndex,
|
||||||
|
index);
|
||||||
movedMouseEventWindow = true;
|
movedMouseEventWindow = true;
|
||||||
|
|
||||||
// send B_WORKSPACES_CHANGED message
|
// send B_WORKSPACES_CHANGED message
|
||||||
@ -974,11 +976,13 @@ Desktop::_SetWorkspace(int32 index)
|
|||||||
// make sure it's frontmost
|
// make sure it's frontmost
|
||||||
_Windows(index).RemoveWindow(fMouseEventWindow);
|
_Windows(index).RemoveWindow(fMouseEventWindow);
|
||||||
_Windows(index).AddWindow(fMouseEventWindow,
|
_Windows(index).AddWindow(fMouseEventWindow,
|
||||||
fMouseEventWindow->Frontmost(_Windows(index).FirstWindow(), index));
|
fMouseEventWindow->Frontmost(_Windows(index).FirstWindow(),
|
||||||
|
index));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fMouseEventWindow->Anchor(index).position = fMouseEventWindow->Frame().LeftTop();
|
fMouseEventWindow->Anchor(index).position
|
||||||
|
= fMouseEventWindow->Frame().LeftTop();
|
||||||
}
|
}
|
||||||
|
|
||||||
// build region of windows that are no longer visible in the new workspace
|
// build region of windows that are no longer visible in the new workspace
|
||||||
@ -1832,8 +1836,14 @@ Desktop::HideWindow(Window* window)
|
|||||||
window->SetHidden(true);
|
window->SetHidden(true);
|
||||||
fFocusList.RemoveWindow(window);
|
fFocusList.RemoveWindow(window);
|
||||||
|
|
||||||
if (fMouseEventWindow == window)
|
if (fMouseEventWindow == window) {
|
||||||
|
// Make its decorator lose the current mouse action
|
||||||
|
BMessage message;
|
||||||
|
int32 viewToken;
|
||||||
|
window->MouseUp(&message, fLastMousePosition, &viewToken);
|
||||||
|
|
||||||
fMouseEventWindow = NULL;
|
fMouseEventWindow = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (window->InWorkspace(fCurrentWorkspace)) {
|
if (window->InWorkspace(fCurrentWorkspace)) {
|
||||||
_UpdateSubsetWorkspaces(window);
|
_UpdateSubsetWorkspaces(window);
|
||||||
@ -2235,7 +2245,8 @@ Desktop::AddWindowToSubset(Window* subset, Window* window)
|
|||||||
if (!subset->AddToSubset(window))
|
if (!subset->AddToSubset(window))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
_ChangeWindowWorkspaces(subset, subset->Workspaces(), subset->SubsetWorkspaces());
|
_ChangeWindowWorkspaces(subset, subset->Workspaces(),
|
||||||
|
subset->SubsetWorkspaces());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2244,7 +2255,8 @@ void
|
|||||||
Desktop::RemoveWindowFromSubset(Window* subset, Window* window)
|
Desktop::RemoveWindowFromSubset(Window* subset, Window* window)
|
||||||
{
|
{
|
||||||
subset->RemoveFromSubset(window);
|
subset->RemoveFromSubset(window);
|
||||||
_ChangeWindowWorkspaces(subset, subset->Workspaces(), subset->SubsetWorkspaces());
|
_ChangeWindowWorkspaces(subset, subset->Workspaces(),
|
||||||
|
subset->SubsetWorkspaces());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2001-2008, Haiku, Inc.
|
* Copyright (c) 2001-2009, Haiku, Inc.
|
||||||
* Distributed under the terms of the MIT license.
|
* Distributed under the terms of the MIT license.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@ -62,7 +62,8 @@ public:
|
|||||||
::Desktop* Desktop() const { return fDesktop; }
|
::Desktop* Desktop() const { return fDesktop; }
|
||||||
::Decorator* Decorator() const { return fDecorator; }
|
::Decorator* Decorator() const { return fDecorator; }
|
||||||
::ServerWindow* ServerWindow() const { return fWindow; }
|
::ServerWindow* ServerWindow() const { return fWindow; }
|
||||||
::EventTarget& EventTarget() const { return fWindow->EventTarget(); }
|
::EventTarget& EventTarget() const
|
||||||
|
{ return fWindow->EventTarget(); }
|
||||||
|
|
||||||
// setting and getting the "hard" clipping, you need to have
|
// setting and getting the "hard" clipping, you need to have
|
||||||
// WriteLock()ed the clipping!
|
// WriteLock()ed the clipping!
|
||||||
@ -78,7 +79,8 @@ public:
|
|||||||
void GetContentRegion(BRegion* region);
|
void GetContentRegion(BRegion* region);
|
||||||
|
|
||||||
void MoveBy(int32 x, int32 y);
|
void MoveBy(int32 x, int32 y);
|
||||||
void ResizeBy(int32 x, int32 y, BRegion* dirtyRegion);
|
void ResizeBy(int32 x, int32 y,
|
||||||
|
BRegion* dirtyRegion);
|
||||||
|
|
||||||
void ScrollViewBy(View* view, int32 dx, int32 dy);
|
void ScrollViewBy(View* view, int32 dx, int32 dy);
|
||||||
|
|
||||||
@ -88,7 +90,8 @@ public:
|
|||||||
|
|
||||||
virtual bool IsOffscreenWindow() const { return false; }
|
virtual bool IsOffscreenWindow() const { return false; }
|
||||||
|
|
||||||
void GetEffectiveDrawingRegion(View* view, BRegion& region);
|
void GetEffectiveDrawingRegion(View* view,
|
||||||
|
BRegion& region);
|
||||||
bool DrawingRegionChanged(View* view) const;
|
bool DrawingRegionChanged(View* view) const;
|
||||||
|
|
||||||
// generic version, used by the Desktop
|
// generic version, used by the Desktop
|
||||||
@ -131,15 +134,18 @@ public:
|
|||||||
void CopyContents(BRegion* region,
|
void CopyContents(BRegion* region,
|
||||||
int32 xOffset, int32 yOffset);
|
int32 xOffset, int32 yOffset);
|
||||||
|
|
||||||
void MouseDown(BMessage* message, BPoint where, int32* _viewToken);
|
void MouseDown(BMessage* message, BPoint where,
|
||||||
void MouseUp(BMessage* message, BPoint where, int32* _viewToken);
|
int32* _viewToken);
|
||||||
void MouseMoved(BMessage* message, BPoint where, int32* _viewToken,
|
void MouseUp(BMessage* message, BPoint where,
|
||||||
bool isLatestMouseMoved);
|
int32* _viewToken);
|
||||||
|
void MouseMoved(BMessage* message, BPoint where,
|
||||||
|
int32* _viewToken, bool isLatestMouseMoved);
|
||||||
|
|
||||||
// some hooks to inform the client window
|
// some hooks to inform the client window
|
||||||
// TODO: move this to ServerWindow maybe?
|
// TODO: move this to ServerWindow maybe?
|
||||||
void WorkspaceActivated(int32 index, bool active);
|
void WorkspaceActivated(int32 index, bool active);
|
||||||
void WorkspacesChanged(uint32 oldWorkspaces, uint32 newWorkspaces);
|
void WorkspacesChanged(uint32 oldWorkspaces,
|
||||||
|
uint32 newWorkspaces);
|
||||||
void Activated(bool active);
|
void Activated(bool active);
|
||||||
|
|
||||||
// changing some properties
|
// changing some properties
|
||||||
@ -179,7 +185,8 @@ public:
|
|||||||
|
|
||||||
void FontsChanged(BRegion* updateRegion);
|
void FontsChanged(BRegion* updateRegion);
|
||||||
|
|
||||||
void SetLook(window_look look, BRegion* updateRegion);
|
void SetLook(window_look look,
|
||||||
|
BRegion* updateRegion);
|
||||||
void SetFeel(window_feel feel);
|
void SetFeel(window_feel feel);
|
||||||
void SetFlags(uint32 flags, BRegion* updateRegion);
|
void SetFlags(uint32 flags, BRegion* updateRegion);
|
||||||
|
|
||||||
@ -243,12 +250,13 @@ protected:
|
|||||||
void _DrawBorder();
|
void _DrawBorder();
|
||||||
|
|
||||||
// handling update sessions
|
// handling update sessions
|
||||||
void _TransferToUpdateSession(BRegion* contentDirtyRegion);
|
void _TransferToUpdateSession(
|
||||||
|
BRegion* contentDirtyRegion);
|
||||||
void _SendUpdateMessage();
|
void _SendUpdateMessage();
|
||||||
|
|
||||||
void _UpdateContentRegion();
|
void _UpdateContentRegion();
|
||||||
|
|
||||||
click_type _ActionFor(const BMessage* msg) const;
|
click_type _ActionFor(const BMessage* message) const;
|
||||||
|
|
||||||
void _ObeySizeLimits();
|
void _ObeySizeLimits();
|
||||||
void _PropagatePosition();
|
void _PropagatePosition();
|
||||||
|
@ -175,6 +175,7 @@ SubInclude HAIKU_TOP src tests servers app drawing_modes ;
|
|||||||
SubInclude HAIKU_TOP src tests servers app event_mask ;
|
SubInclude HAIKU_TOP src tests servers app event_mask ;
|
||||||
SubInclude HAIKU_TOP src tests servers app find_view ;
|
SubInclude HAIKU_TOP src tests servers app find_view ;
|
||||||
SubInclude HAIKU_TOP src tests servers app following ;
|
SubInclude HAIKU_TOP src tests servers app following ;
|
||||||
|
SubInclude HAIKU_TOP src tests servers app hide_and_show ;
|
||||||
SubInclude HAIKU_TOP src tests servers app idle_test ;
|
SubInclude HAIKU_TOP src tests servers app idle_test ;
|
||||||
SubInclude HAIKU_TOP src tests servers app lagging_get_mouse ;
|
SubInclude HAIKU_TOP src tests servers app lagging_get_mouse ;
|
||||||
SubInclude HAIKU_TOP src tests servers app lock_focus ;
|
SubInclude HAIKU_TOP src tests servers app lock_focus ;
|
||||||
|
138
src/tests/servers/app/hide_and_show/HideAndShow.cpp
Normal file
138
src/tests/servers/app/hide_and_show/HideAndShow.cpp
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2005-2009, Haiku Inc.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Axel Dörfler, axeld@pinc-software.de
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <Application.h>
|
||||||
|
#include <MessageRunner.h>
|
||||||
|
#include <TextView.h>
|
||||||
|
#include <Window.h>
|
||||||
|
|
||||||
|
|
||||||
|
static const uint32 kMsgToggleShow = 'tgsh';
|
||||||
|
|
||||||
|
class Window : public BWindow {
|
||||||
|
public:
|
||||||
|
Window();
|
||||||
|
virtual ~Window();
|
||||||
|
|
||||||
|
virtual void MessageReceived(BMessage* message);
|
||||||
|
virtual void FrameResized(float width, float height);
|
||||||
|
virtual bool QuitRequested();
|
||||||
|
|
||||||
|
private:
|
||||||
|
BMessageRunner* fRunner;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Window::Window()
|
||||||
|
: BWindow(BRect(100, 100, 400, 400), "HideAndShow-Test",
|
||||||
|
B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS)
|
||||||
|
{
|
||||||
|
BRect rect(Bounds());
|
||||||
|
rect.left += 20;
|
||||||
|
rect.right -= 20;
|
||||||
|
rect.top = 100;
|
||||||
|
rect.bottom = 200;
|
||||||
|
BTextView* view = new BTextView(Bounds(), "", rect, B_FOLLOW_ALL,
|
||||||
|
B_FRAME_EVENTS | B_WILL_DRAW);
|
||||||
|
view->MakeEditable(false);
|
||||||
|
view->SetAlignment(B_ALIGN_CENTER);
|
||||||
|
view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
view->SetText("The window will be hidden and shown every 2 seconds.");
|
||||||
|
AddChild(view);
|
||||||
|
|
||||||
|
BMessage showAndHide(kMsgToggleShow);
|
||||||
|
fRunner = new BMessageRunner(this, &showAndHide, 2000000);
|
||||||
|
}
|
||||||
|
|
||||||
|
Window::~Window()
|
||||||
|
{
|
||||||
|
delete fRunner;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Window::MessageReceived(BMessage* message)
|
||||||
|
{
|
||||||
|
switch (message->what) {
|
||||||
|
case kMsgToggleShow:
|
||||||
|
if (IsHidden())
|
||||||
|
Show();
|
||||||
|
else
|
||||||
|
Hide();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
BWindow::MessageReceived(message);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Window::FrameResized(float width, float height)
|
||||||
|
{
|
||||||
|
BTextView* view = dynamic_cast<BTextView*>(ChildAt(0));
|
||||||
|
if (view == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
BRect rect = Bounds();
|
||||||
|
rect.left += 20;
|
||||||
|
rect.right -= 20;
|
||||||
|
rect.top = 100;
|
||||||
|
rect.bottom = 200;
|
||||||
|
view->SetTextRect(rect);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
Window::QuitRequested()
|
||||||
|
{
|
||||||
|
be_app->PostMessage(B_QUIT_REQUESTED);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
class Application : public BApplication {
|
||||||
|
public:
|
||||||
|
Application();
|
||||||
|
|
||||||
|
virtual void ReadyToRun();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Application::Application()
|
||||||
|
: BApplication("application/x-vnd.haiku-hide_and_show")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Application::ReadyToRun(void)
|
||||||
|
{
|
||||||
|
Window* window = new Window();
|
||||||
|
window->Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char** argv)
|
||||||
|
{
|
||||||
|
Application app;
|
||||||
|
|
||||||
|
app.Run();
|
||||||
|
return 0;
|
||||||
|
}
|
18
src/tests/servers/app/hide_and_show/Jamfile
Normal file
18
src/tests/servers/app/hide_and_show/Jamfile
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
SubDir HAIKU_TOP src tests servers app hide_and_show ;
|
||||||
|
|
||||||
|
SetSubDirSupportedPlatformsBeOSCompatible ;
|
||||||
|
AddSubDirSupportedPlatforms libbe_test ;
|
||||||
|
|
||||||
|
UseHeaders [ FDirName os app ] ;
|
||||||
|
UseHeaders [ FDirName os interface ] ;
|
||||||
|
|
||||||
|
Application HideAndShow :
|
||||||
|
HideAndShow.cpp
|
||||||
|
: be
|
||||||
|
;
|
||||||
|
|
||||||
|
if $(TARGET_PLATFORM) = libbe_test {
|
||||||
|
HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : ViewState
|
||||||
|
: tests!apps ;
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user