RootLayer now tracks which mouse buttons are down
Implemented ServerWindow code for GetMouse git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11265 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -879,6 +879,15 @@ void RootLayer::SetBGColor(const RGBColor &col)
|
||||
fLayerData->viewcolor = col;
|
||||
}
|
||||
|
||||
int32 RootLayer::Buttons(void)
|
||||
{
|
||||
Lock();
|
||||
int32 value=fButtons;
|
||||
Unlock();
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
RGBColor RootLayer::BGColor(void) const
|
||||
{
|
||||
return fLayerData->viewcolor;
|
||||
@@ -920,6 +929,10 @@ void RootLayer::MouseEventHandler(int32 code, BPortLink& msg)
|
||||
msg.Read<int32>(&evt.buttons);
|
||||
msg.Read<int32>(&evt.clicks);
|
||||
|
||||
// We'll need this so that GetMouse can query for which buttons
|
||||
// are down.
|
||||
fButtons=evt.buttons;
|
||||
|
||||
// printf("MOUSE DOWN: at (%f, %f)\n", evt.where.x, evt.where.y);
|
||||
|
||||
WinBorder *target=NULL;
|
||||
|
||||
@@ -96,6 +96,7 @@ public:
|
||||
void SetBGColor(const RGBColor &col);
|
||||
RGBColor BGColor(void) const;
|
||||
|
||||
int32 Buttons(void);
|
||||
virtual bool HasClient(void) { return false; }
|
||||
|
||||
void AddWinBorderToWorkspaces(WinBorder *winBorder, uint32 wks);
|
||||
@@ -157,6 +158,7 @@ private:
|
||||
int32 fScreenXResolution;
|
||||
int32 fScreenYResolution;
|
||||
uint32 fColorSpace;
|
||||
int32 fButtons;
|
||||
|
||||
BList fWorkspaceList;
|
||||
Workspace *fActiveWorkspace;
|
||||
|
||||
@@ -2128,9 +2128,8 @@ void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
|
||||
}
|
||||
case AS_LAYER_GET_MOUSE_COORDS:
|
||||
{
|
||||
// TODO: Implement AS_LAYER_MOUSE_COORDS
|
||||
STRACE(("ServerWindow %s: Message AS_GET_MOUSE_COORDS unimplemented\n",fTitle.String()));
|
||||
DTRACE(("ServerWindow %s: Message AS_GET_MOUSE_COORDS unimplemented\n",fTitle.String()));
|
||||
DTRACE(("ServerWindow %s: Message AS_GET_MOUSE_COORDS\n",fTitle.String()));
|
||||
|
||||
// Attached Data:
|
||||
// 1) port_id reply port
|
||||
|
||||
@@ -2144,8 +2143,12 @@ void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
|
||||
port_id replyport;
|
||||
link.Read<port_id>(&replyport);
|
||||
|
||||
int32 buttons=desktop->ActiveRootLayer()->Buttons();
|
||||
|
||||
BPortLink replylink(replyport);
|
||||
replylink.StartMessage(SERVER_FALSE);
|
||||
replylink.StartMessage(SERVER_TRUE);
|
||||
replylink.Attach<BPoint>(desktop->GetDisplayDriver()->GetCursorPosition());
|
||||
replylink.Attach<int32>(buttons);
|
||||
replylink.Flush();
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user