* new windows now get a fake B_MOUSE_MOVED message in case they are opened

directly under the mouse cursor.
* Added Desktop::ShowWindow() and HideWindow().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15238 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-11-30 10:45:01 +00:00
parent 927995cedd
commit 15918e4fa5
6 changed files with 64 additions and 8 deletions
+38
View File
@@ -601,6 +601,44 @@ Desktop::SendBehindWindow(WindowLayer* windowLayer, WindowLayer* front)
}
void
Desktop::ShowWindow(WindowLayer* window)
{
if (!window->IsHidden())
return;
fRootLayer->ShowWindowLayer(window);
// If the mouse cursor is directly over the newly visible window,
// we'll send a fake mouse moved message to the window, so that
// it knows the mouse is over it.
BPoint where;
int32 buttons;
EventDispatcher().GetMouse(where, buttons);
int32 viewToken = B_NULL_TOKEN;
fRootLayer->Lock();
if (fRootLayer->WindowAt(where) == window) {
Layer* layer = window->LayerAt(where);
if (layer != NULL && layer != window)
viewToken = layer->ViewToken();
}
fRootLayer->Unlock();
if (viewToken != B_NULL_TOKEN)
EventDispatcher().SendFakeMouseMoved(window->Window()->EventTarget(), viewToken);
}
void
Desktop::HideWindow(WindowLayer* window)
{
fRootLayer->HideWindowLayer(window);
}
void
Desktop::SetWindowWorkspaces(WindowLayer* windowLayer, uint32 workspaces)
{
+3
View File
@@ -89,6 +89,9 @@ class Desktop : public MessageLooper, public ScreenOwner {
void ActivateWindow(WindowLayer* window);
void SendBehindWindow(WindowLayer* window, WindowLayer* front);
void ShowWindow(WindowLayer* window);
void HideWindow(WindowLayer* window);
void SetWindowWorkspaces(WindowLayer* window, uint32 workspaces);
void AddWindowLayer(WindowLayer *windowLayer);
+15 -1
View File
@@ -453,13 +453,27 @@ EventDispatcher::SetKeyboardFilter(EventFilter* filter)
void
EventDispatcher::GetMouse(BPoint& where, int32& buttons)
{
//BAutolock _(this);
BAutolock _(this);
where = fLastCursorPosition;
buttons = fLastButtons;
}
void
EventDispatcher::SendFakeMouseMoved(EventTarget& target, int32 viewToken)
{
BAutolock _(this);
BMessage moved(B_MOUSE_MOVED);
moved.AddPoint("screen_where", fLastCursorPosition);
moved.AddInt32("buttons", fLastButtons);
moved.AddInt32("_view_token", viewToken);
_SendMessage(target.Messenger(), &moved, kMouseTransitImportance);
}
bool
EventDispatcher::HasCursorThread()
{
+1
View File
@@ -78,6 +78,7 @@ class EventDispatcher : public BLocker {
void SetKeyboardFilter(EventFilter* filter);
void GetMouse(BPoint& where, int32& buttons);
void SendFakeMouseMoved(EventTarget& target, int32 viewToken);
bool HasCursorThread();
void SetHWInterface(HWInterface* interface);
+1 -1
View File
@@ -41,7 +41,7 @@
static const float kGoldenProportion = (sqrtf(5.0) - 1.0) / 2.0;
#endif
#define DEBUG_ROOT_LAYER
//#define DEBUG_ROOT_LAYER
#define APPSERVER_ROOTLAYER_SHOW_WORKSPACE_NUMBER
#ifdef DEBUG_ROOT_LAYER
+6 -6
View File
@@ -295,9 +295,9 @@ ServerWindow::Show()
if (fQuitting || !fWindowLayer->IsHidden())
return;
RootLayer* rootLayer = fWindowLayer->GetRootLayer();
if (rootLayer)
rootLayer->ShowWindowLayer(fWindowLayer);
// TODO: that check is just there for offscreen-windows - this should be made better
if (fWindowLayer->GetRootLayer() != NULL)
fDesktop->ShowWindow(fWindowLayer);
if (fDirectWindowData != NULL)
HandleDirectConnection(B_DIRECT_START | B_BUFFER_RESET);
@@ -317,9 +317,9 @@ ServerWindow::Hide()
if (fDirectWindowData != NULL)
HandleDirectConnection(B_DIRECT_STOP);
RootLayer* rootLayer = fWindowLayer->GetRootLayer();
if (rootLayer)
rootLayer->HideWindowLayer(fWindowLayer);
// TODO: that check is just there for offscreen-windows - this should be made better
if (fWindowLayer->GetRootLayer() != NULL)
fDesktop->HideWindow(fWindowLayer);
}