Implemented hook function notifiers
Converted regular ServerWindow messaging to PortMessage usage git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3949 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -223,7 +223,8 @@ int32 AppServer::PollerThread(void *data)
|
|||||||
{
|
{
|
||||||
if(!msg->Buffer())
|
if(!msg->Buffer())
|
||||||
break;
|
break;
|
||||||
ServerWindow::HandleMouseEvent(msg->Code(),(int8*)msg->Buffer());
|
// ServerWindow::HandleMouseEvent(msg->Code(),(int8*)msg->Buffer());
|
||||||
|
ServerWindow::HandleMouseEvent(msg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,7 +252,8 @@ int32 AppServer::PollerThread(void *data)
|
|||||||
if(appserver->_driver)
|
if(appserver->_driver)
|
||||||
{
|
{
|
||||||
appserver->_driver->MoveCursorTo(tempx,tempy);
|
appserver->_driver->MoveCursorTo(tempx,tempy);
|
||||||
ServerWindow::HandleMouseEvent(msg->Code(),(int8*)msg->Buffer());
|
// ServerWindow::HandleMouseEvent(msg->Code(),(int8*)msg->Buffer());
|
||||||
|
ServerWindow::HandleMouseEvent(msg);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,9 +29,9 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <View.h> // for B_XXXXX_MOUSE_BUTTON defines
|
#include <View.h> // for B_XXXXX_MOUSE_BUTTON defines
|
||||||
|
#include <PortLink.h>
|
||||||
#include "AppServer.h"
|
#include "AppServer.h"
|
||||||
#include "Layer.h"
|
#include "Layer.h"
|
||||||
#include "PortLink.h"
|
|
||||||
#include "ServerWindow.h"
|
#include "ServerWindow.h"
|
||||||
#include "ServerApp.h"
|
#include "ServerApp.h"
|
||||||
#include "ServerProtocol.h"
|
#include "ServerProtocol.h"
|
||||||
@@ -129,20 +129,20 @@ ServerWindow::ServerWindow(BRect rect, const char *string, uint32 wlook,
|
|||||||
_token=win_token_handler.GetToken();
|
_token=win_token_handler.GetToken();
|
||||||
|
|
||||||
AddWindowToDesktop(this,index,ActiveScreen());
|
AddWindowToDesktop(this,index,ActiveScreen());
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s:\n",_title->String());
|
printf("ServerWindow %s:\n",_title->String());
|
||||||
printf("\tFrame (%.1f,%.1f,%.1f,%.1f)\n",rect.left,rect.top,rect.right,rect.bottom);
|
printf("\tFrame (%.1f,%.1f,%.1f,%.1f)\n",rect.left,rect.top,rect.right,rect.bottom);
|
||||||
printf("\tPort: %ld\n",_receiver);
|
printf("\tPort: %ld\n",_receiver);
|
||||||
printf("\tWorkspace: %ld\n",index);
|
printf("\tWorkspace: %ld\n",index);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//!Tears down all connections with the user application, kills the monitoring thread.
|
//!Tears down all connections with the user application, kills the monitoring thread.
|
||||||
ServerWindow::~ServerWindow(void)
|
ServerWindow::~ServerWindow(void)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s:~ServerWindow()\n",_title->String());
|
printf("ServerWindow %s:~ServerWindow()\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
RemoveWindowFromDesktop(this);
|
RemoveWindowFromDesktop(this);
|
||||||
if(_applink)
|
if(_applink)
|
||||||
{
|
{
|
||||||
@@ -163,9 +163,9 @@ printf("ServerWindow %s:~ServerWindow()\n",_title->String());
|
|||||||
*/
|
*/
|
||||||
void ServerWindow::RequestDraw(BRect rect)
|
void ServerWindow::RequestDraw(BRect rect)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Request Draw\n",_title->String());
|
printf("ServerWindow %s: Request Draw\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
_winlink->SetOpCode(AS_LAYER_DRAW);
|
_winlink->SetOpCode(AS_LAYER_DRAW);
|
||||||
_winlink->Attach(&rect,sizeof(BRect));
|
_winlink->Attach(&rect,sizeof(BRect));
|
||||||
_winlink->Flush();
|
_winlink->Flush();
|
||||||
@@ -180,18 +180,18 @@ void ServerWindow::RequestDraw(void)
|
|||||||
//! Forces the window border to update its decorator
|
//! Forces the window border to update its decorator
|
||||||
void ServerWindow::ReplaceDecorator(void)
|
void ServerWindow::ReplaceDecorator(void)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Replace Decorator\n",_title->String());
|
printf("ServerWindow %s: Replace Decorator\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
_winborder->UpdateDecorator();
|
_winborder->UpdateDecorator();
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Requests that the ServerWindow's BWindow quit
|
//! Requests that the ServerWindow's BWindow quit
|
||||||
void ServerWindow::Quit(void)
|
void ServerWindow::Quit(void)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Quit\n",_title->String());
|
printf("ServerWindow %s: Quit\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
_winlink->SetOpCode(B_QUIT_REQUESTED);
|
_winlink->SetOpCode(B_QUIT_REQUESTED);
|
||||||
_winlink->Flush();
|
_winlink->Flush();
|
||||||
}
|
}
|
||||||
@@ -217,9 +217,9 @@ ServerApp *ServerWindow::GetApp(void)
|
|||||||
//! Shows the window's WinBorder
|
//! Shows the window's WinBorder
|
||||||
void ServerWindow::Show(void)
|
void ServerWindow::Show(void)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Show\n",_title->String());
|
printf("ServerWindow %s: Show\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
if(_winborder)
|
if(_winborder)
|
||||||
{
|
{
|
||||||
_winborder->Show();
|
_winborder->Show();
|
||||||
@@ -230,9 +230,9 @@ printf("ServerWindow %s: Show\n",_title->String());
|
|||||||
//! Hides the window's WinBorder
|
//! Hides the window's WinBorder
|
||||||
void ServerWindow::Hide(void)
|
void ServerWindow::Hide(void)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Hide\n",_title->String());
|
printf("ServerWindow %s: Hide\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
if(_winborder)
|
if(_winborder)
|
||||||
_winborder->Hide();
|
_winborder->Hide();
|
||||||
}
|
}
|
||||||
@@ -255,9 +255,9 @@ bool ServerWindow::IsHidden(void)
|
|||||||
*/
|
*/
|
||||||
void ServerWindow::SetFocus(bool value)
|
void ServerWindow::SetFocus(bool value)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Set Focus to %s\n",_title->String(),value?"true":"false");
|
printf("ServerWindow %s: Set Focus to %s\n",_title->String(),value?"true":"false");
|
||||||
#endif
|
#endif
|
||||||
if(_active!=value)
|
if(_active!=value)
|
||||||
{
|
{
|
||||||
_active=value;
|
_active=value;
|
||||||
@@ -281,10 +281,13 @@ bool ServerWindow::HasFocus(void)
|
|||||||
*/
|
*/
|
||||||
void ServerWindow::WorkspaceActivated(int32 workspace, bool active)
|
void ServerWindow::WorkspaceActivated(int32 workspace, bool active)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: WorkspaceActivated unimplemented\n",_title->String());
|
printf("ServerWindow %s: WorkspaceActivated(%ld,%s)\n",_title->String(),workspace,(active)?"active":"inactive");
|
||||||
#endif
|
#endif
|
||||||
// TODO: implement
|
_winlink->SetOpCode(AS_WORKSPACE_ACTIVATED);
|
||||||
|
_winlink->Attach(workspace);
|
||||||
|
_winlink->Attach(active);
|
||||||
|
_winlink->Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -294,10 +297,13 @@ printf("ServerWindow %s: WorkspaceActivated unimplemented\n",_title->String());
|
|||||||
*/
|
*/
|
||||||
void ServerWindow::WorkspacesChanged(int32 oldone,int32 newone)
|
void ServerWindow::WorkspacesChanged(int32 oldone,int32 newone)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: WorkspaceChanged unimplemented\n",_title->String());
|
printf("ServerWindow %s: WorkspacesChanged(%ld,%ld)\n",_title->String(),oldone,newone);
|
||||||
#endif
|
#endif
|
||||||
// TODO: implement
|
_winlink->SetOpCode(AS_WORKSPACES_CHANGED);
|
||||||
|
_winlink->Attach(oldone);
|
||||||
|
_winlink->Attach(newone);
|
||||||
|
_winlink->Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -306,10 +312,12 @@ printf("ServerWindow %s: WorkspaceChanged unimplemented\n",_title->String());
|
|||||||
*/
|
*/
|
||||||
void ServerWindow::WindowActivated(bool active)
|
void ServerWindow::WindowActivated(bool active)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: WindowActivated unimplemented\n",_title->String());
|
printf("ServerWindow %s: WindowActivated(%s)\n",_title->String(),(active)?"active":"inactive");
|
||||||
#endif
|
#endif
|
||||||
// TODO: implement
|
_winlink->SetOpCode(AS_WINDOW_ACTIVATED);
|
||||||
|
_winlink->Attach(active);
|
||||||
|
_winlink->Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -319,10 +327,13 @@ printf("ServerWindow %s: WindowActivated unimplemented\n",_title->String());
|
|||||||
*/
|
*/
|
||||||
void ServerWindow::ScreenModeChanged(const BRect frame, const color_space cspace)
|
void ServerWindow::ScreenModeChanged(const BRect frame, const color_space cspace)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: ScreenModeChanged unimplemented\n",_title->String());
|
printf("ServerWindow %s: ScreenModeChanged\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
// TODO: implement
|
_winlink->SetOpCode(AS_SCREENMODE_CHANGED);
|
||||||
|
_winlink->Attach(frame);
|
||||||
|
_winlink->Attach(&cspace,sizeof(color_space));
|
||||||
|
_winlink->Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -331,10 +342,10 @@ printf("ServerWindow %s: ScreenModeChanged unimplemented\n",_title->String());
|
|||||||
*/
|
*/
|
||||||
void ServerWindow::SetFrame(const BRect &rect)
|
void ServerWindow::SetFrame(const BRect &rect)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Set Frame to (%.1f,%.1f,%.1f,%.1f)\n",_title->String(),
|
printf("ServerWindow %s: Set Frame to (%.1f,%.1f,%.1f,%.1f)\n",_title->String(),
|
||||||
rect.left,rect.top,rect.right,rect.bottom);
|
rect.left,rect.top,rect.right,rect.bottom);
|
||||||
#endif
|
#endif
|
||||||
_frame=rect;
|
_frame=rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -353,18 +364,18 @@ BRect ServerWindow::Frame(void)
|
|||||||
*/
|
*/
|
||||||
status_t ServerWindow::Lock(void)
|
status_t ServerWindow::Lock(void)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Lock\n",_title->String());
|
printf("ServerWindow %s: Lock\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
return (_locker.Lock())?B_OK:B_ERROR;
|
return (_locker.Lock())?B_OK:B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Unlocks the window
|
//! Unlocks the window
|
||||||
void ServerWindow::Unlock(void)
|
void ServerWindow::Unlock(void)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Unlock\n",_title->String());
|
printf("ServerWindow %s: Unlock\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
_locker.Unlock();
|
_locker.Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -377,9 +388,9 @@ bool ServerWindow::IsLocked(void)
|
|||||||
return _locker.IsLocked();
|
return _locker.IsLocked();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerWindow::DispatchMessage(int32 code, int8 *msgbuffer)
|
void ServerWindow::DispatchMessage(PortMessage *msg)
|
||||||
{
|
{
|
||||||
switch(code)
|
switch(msg->Code())
|
||||||
{
|
{
|
||||||
case AS_LAYER_CREATE:
|
case AS_LAYER_CREATE:
|
||||||
{
|
{
|
||||||
@@ -399,9 +410,9 @@ void ServerWindow::DispatchMessage(int32 code, int8 *msgbuffer)
|
|||||||
// so the BView can identify itself
|
// so the BView can identify itself
|
||||||
|
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Message Create_Layer unimplemented\n",_title->String());
|
printf("ServerWindow %s: Message Create_Layer unimplemented\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -416,9 +427,9 @@ printf("ServerWindow %s: Message Create_Layer unimplemented\n",_title->String())
|
|||||||
// 1) (int32) id of the removed view
|
// 1) (int32) id of the removed view
|
||||||
|
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Message Delete_Layer unimplemented\n",_title->String());
|
printf("ServerWindow %s: Message Delete_Layer unimplemented\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -427,9 +438,9 @@ printf("ServerWindow %s: Message Delete_Layer unimplemented\n",_title->String())
|
|||||||
// Received when a window creates its internal top view
|
// Received when a window creates its internal top view
|
||||||
|
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Message Create_Layer_Root unimplemented\n",_title->String());
|
printf("ServerWindow %s: Message Create_Layer_Root unimplemented\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -438,9 +449,9 @@ printf("ServerWindow %s: Message Create_Layer_Root unimplemented\n",_title->Stri
|
|||||||
// Received when a window deletes its internal top view
|
// Received when a window deletes its internal top view
|
||||||
|
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Message Delete_Layer_Root unimplemented\n",_title->String());
|
printf("ServerWindow %s: Message Delete_Layer_Root unimplemented\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -457,166 +468,166 @@ printf("ServerWindow %s: Message Delete_Layer_Root unimplemented\n",_title->Stri
|
|||||||
case AS_SEND_BEHIND:
|
case AS_SEND_BEHIND:
|
||||||
{
|
{
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Message Send_Behind unimplemented\n",_title->String());
|
printf("ServerWindow %s: Message Send_Behind unimplemented\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_ENABLE_UPDATES:
|
case AS_ENABLE_UPDATES:
|
||||||
{
|
{
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Message Enable_Updates unimplemented\n",_title->String());
|
printf("ServerWindow %s: Message Enable_Updates unimplemented\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_DISABLE_UPDATES:
|
case AS_DISABLE_UPDATES:
|
||||||
{
|
{
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Message Disable_Updates unimplemented\n",_title->String());
|
printf("ServerWindow %s: Message Disable_Updates unimplemented\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_NEEDS_UPDATE:
|
case AS_NEEDS_UPDATE:
|
||||||
{
|
{
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Message Needs_Update unimplemented\n",_title->String());
|
printf("ServerWindow %s: Message Needs_Update unimplemented\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_WINDOW_TITLE:
|
case AS_WINDOW_TITLE:
|
||||||
{
|
{
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Message Set_Title unimplemented\n",_title->String());
|
printf("ServerWindow %s: Message Set_Title unimplemented\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_ADD_TO_SUBSET:
|
case AS_ADD_TO_SUBSET:
|
||||||
{
|
{
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Message Add_To_Subset unimplemented\n",_title->String());
|
printf("ServerWindow %s: Message Add_To_Subset unimplemented\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_REM_FROM_SUBSET:
|
case AS_REM_FROM_SUBSET:
|
||||||
{
|
{
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Message Remove_From_Subset unimplemented\n",_title->String());
|
printf("ServerWindow %s: Message Remove_From_Subset unimplemented\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_SET_LOOK:
|
case AS_SET_LOOK:
|
||||||
{
|
{
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Message Set_Look unimplemented\n",_title->String());
|
printf("ServerWindow %s: Message Set_Look unimplemented\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_SET_FLAGS:
|
case AS_SET_FLAGS:
|
||||||
{
|
{
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Message Set_Flags unimplemented\n",_title->String());
|
printf("ServerWindow %s: Message Set_Flags unimplemented\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_SET_FEEL:
|
case AS_SET_FEEL:
|
||||||
{
|
{
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Message Set_Feel unimplemented\n",_title->String());
|
printf("ServerWindow %s: Message Set_Feel unimplemented\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_SET_ALIGNMENT:
|
case AS_SET_ALIGNMENT:
|
||||||
{
|
{
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Message Set_Alignment unimplemented\n",_title->String());
|
printf("ServerWindow %s: Message Set_Alignment unimplemented\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_GET_ALIGNMENT:
|
case AS_GET_ALIGNMENT:
|
||||||
{
|
{
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Message Get_Alignment unimplemented\n",_title->String());
|
printf("ServerWindow %s: Message Get_Alignment unimplemented\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_GET_WORKSPACES:
|
case AS_GET_WORKSPACES:
|
||||||
{
|
{
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Message Get_Workspaces unimplemented\n",_title->String());
|
printf("ServerWindow %s: Message Get_Workspaces unimplemented\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_SET_WORKSPACES:
|
case AS_SET_WORKSPACES:
|
||||||
{
|
{
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Message Set_Workspaces unimplemented\n",_title->String());
|
printf("ServerWindow %s: Message Set_Workspaces unimplemented\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_WINDOW_RESIZE:
|
case AS_WINDOW_RESIZE:
|
||||||
{
|
{
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Message Resize unimplemented\n",_title->String());
|
printf("ServerWindow %s: Message Resize unimplemented\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case B_MINIMIZE:
|
case B_MINIMIZE:
|
||||||
{
|
{
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Message Minimize unimplemented\n",_title->String());
|
printf("ServerWindow %s: Message Minimize unimplemented\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case B_WINDOW_ACTIVATED:
|
case B_WINDOW_ACTIVATED:
|
||||||
{
|
{
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Message Window_Activated unimplemented\n",_title->String());
|
printf("ServerWindow %s: Message Window_Activated unimplemented\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case B_ZOOM:
|
case B_ZOOM:
|
||||||
{
|
{
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Message Zoom unimplemented\n",_title->String());
|
printf("ServerWindow %s: Message Zoom unimplemented\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case B_WINDOW_MOVE_TO:
|
case B_WINDOW_MOVE_TO:
|
||||||
{
|
{
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Message Move_To unimplemented\n",_title->String());
|
printf("ServerWindow %s: Message Move_To unimplemented\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case B_WINDOW_MOVE_BY:
|
case B_WINDOW_MOVE_BY:
|
||||||
{
|
{
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Message Move_By unimplemented\n",_title->String());
|
printf("ServerWindow %s: Message Move_By unimplemented\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
printf("ServerWindow %s received unexpected code %s\n",_title->String(),MsgCodeToString(code));
|
printf("ServerWindow %s received unexpected code %s\n",_title->String(),MsgCodeToString(msg->Code()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1169,6 +1180,8 @@ void ServerWindow::DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer)
|
|||||||
int32 ServerWindow::MonitorWin(void *data)
|
int32 ServerWindow::MonitorWin(void *data)
|
||||||
{
|
{
|
||||||
ServerWindow *win=(ServerWindow *)data;
|
ServerWindow *win=(ServerWindow *)data;
|
||||||
|
PortMessage msg;
|
||||||
|
int32 msgstat;
|
||||||
|
|
||||||
int32 msgcode;
|
int32 msgcode;
|
||||||
int8 *msgbuffer=NULL;
|
int8 *msgbuffer=NULL;
|
||||||
@@ -1176,25 +1189,17 @@ int32 ServerWindow::MonitorWin(void *data)
|
|||||||
|
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
buffersize=port_buffer_size(win->_receiver);
|
msgstat=msg.ReadFromPort(win->_receiver);
|
||||||
|
|
||||||
if(buffersize>0)
|
if(msgstat==B_OK)
|
||||||
{
|
{
|
||||||
msgbuffer=new int8[buffersize];
|
switch(msg.Code())
|
||||||
bytesread=read_port(win->_receiver,&msgcode,msgbuffer,buffersize);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
bytesread=read_port(win->_receiver,&msgcode,NULL,0);
|
|
||||||
|
|
||||||
if (bytesread != B_BAD_PORT_ID && bytesread != B_TIMED_OUT && bytesread != B_WOULD_BLOCK)
|
|
||||||
{
|
|
||||||
switch(msgcode)
|
|
||||||
{
|
{
|
||||||
case B_QUIT_REQUESTED:
|
case B_QUIT_REQUESTED:
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s received Quit request\n",win->Title());
|
printf("ServerWindow %s received Quit request\n",win->Title());
|
||||||
#endif
|
#endif
|
||||||
// Our BWindow sent us this message when it quit.
|
// Our BWindow sent us this message when it quit.
|
||||||
// We need to ask its ServerApp to delete our monitor
|
// We need to ask its ServerApp to delete our monitor
|
||||||
win->_applink->SetOpCode(AS_DELETE_WINDOW);
|
win->_applink->SetOpCode(AS_DELETE_WINDOW);
|
||||||
@@ -1208,16 +1213,14 @@ printf("ServerWindow %s received Quit request\n",win->Title());
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
win->DispatchMessage(msgcode,msgbuffer);
|
// win->DispatchMessage(msgcode,msgbuffer);
|
||||||
|
win->DispatchMessage(&msg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(buffersize>0)
|
if(msg.Code()==B_QUIT_REQUESTED)
|
||||||
delete[] msgbuffer;
|
|
||||||
|
|
||||||
if(msgcode==B_QUIT_REQUESTED)
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1230,13 +1233,11 @@ printf("ServerWindow %s received Quit request\n",win->Title());
|
|||||||
\param code Message code of the mouse message
|
\param code Message code of the mouse message
|
||||||
\param buffer Attachment buffer for the mouse message
|
\param buffer Attachment buffer for the mouse message
|
||||||
*/
|
*/
|
||||||
void ServerWindow::HandleMouseEvent(int32 code, int8 *buffer)
|
//void ServerWindow::HandleMouseEvent(int32 code, int8 *buffer)
|
||||||
|
void ServerWindow::HandleMouseEvent(PortMessage *msg)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_SERVERWINDOW_MOUSE
|
|
||||||
printf("ServerWindow::HandleMouseEvent unimplemented\n");
|
|
||||||
#endif
|
|
||||||
ServerWindow *mousewin=NULL;
|
ServerWindow *mousewin=NULL;
|
||||||
int8 *index=buffer;
|
// int8 *index=buffer;
|
||||||
|
|
||||||
// Find the window which will receive our mouse event.
|
// Find the window which will receive our mouse event.
|
||||||
Layer *root=GetRootLayer(CurrentWorkspace(),ActiveScreen());
|
Layer *root=GetRootLayer(CurrentWorkspace(),ActiveScreen());
|
||||||
@@ -1251,7 +1252,8 @@ printf("ServerWindow::HandleMouseEvent unimplemented\n");
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Dispatch the mouse event to the proper window
|
// Dispatch the mouse event to the proper window
|
||||||
switch(code)
|
// switch(code)
|
||||||
|
switch(msg->Code())
|
||||||
{
|
{
|
||||||
case B_MOUSE_DOWN:
|
case B_MOUSE_DOWN:
|
||||||
{
|
{
|
||||||
@@ -1263,13 +1265,16 @@ printf("ServerWindow::HandleMouseEvent unimplemented\n");
|
|||||||
// 5) int32 - buttons down
|
// 5) int32 - buttons down
|
||||||
// 6) int32 - clicks
|
// 6) int32 - clicks
|
||||||
|
|
||||||
// int64 time=*((int64*)index);
|
// index+=sizeof(int64);
|
||||||
index+=sizeof(int64);
|
// float x=*((float*)index); index+=sizeof(float);
|
||||||
float x=*((float*)index); index+=sizeof(float);
|
// float y=*((float*)index); index+=sizeof(float);
|
||||||
float y=*((float*)index); index+=sizeof(float);
|
// BPoint pt(x,y);
|
||||||
// int32 modifiers=*((int32*)index); index+=sizeof(uint32);
|
float x;
|
||||||
// uint32 buttons=*((uint32*)index); index+=sizeof(uint32);
|
float y;
|
||||||
// int32 clicks=*((int32*)index);
|
int64 dummy;
|
||||||
|
msg->Read(&dummy);
|
||||||
|
msg->Read(&x);
|
||||||
|
msg->Read(&y);
|
||||||
BPoint pt(x,y);
|
BPoint pt(x,y);
|
||||||
|
|
||||||
// If we have clicked on a window,
|
// If we have clicked on a window,
|
||||||
@@ -1277,7 +1282,8 @@ printf("ServerWindow::HandleMouseEvent unimplemented\n");
|
|||||||
if(_winborder)
|
if(_winborder)
|
||||||
{
|
{
|
||||||
mousewin=_winborder->Window();
|
mousewin=_winborder->Window();
|
||||||
_winborder->MouseDown(buffer);
|
// _winborder->MouseDown(buffer);
|
||||||
|
_winborder->MouseDown((int8*)msg->Buffer());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1289,11 +1295,16 @@ printf("ServerWindow::HandleMouseEvent unimplemented\n");
|
|||||||
// 3) float - y coordinate of mouse click
|
// 3) float - y coordinate of mouse click
|
||||||
// 4) int32 - modifier keys down
|
// 4) int32 - modifier keys down
|
||||||
|
|
||||||
// int64 time=*((int64*)index);
|
// index+=sizeof(int64);
|
||||||
index+=sizeof(int64);
|
// float x=*((float*)index); index+=sizeof(float);
|
||||||
float x=*((float*)index); index+=sizeof(float);
|
// float y=*((float*)index); index+=sizeof(float);
|
||||||
float y=*((float*)index); index+=sizeof(float);
|
// BPoint pt(x,y);
|
||||||
// int32 modifiers=*((int32*)index);
|
float x;
|
||||||
|
float y;
|
||||||
|
int64 dummy;
|
||||||
|
msg->Read(&dummy);
|
||||||
|
msg->Read(&x);
|
||||||
|
msg->Read(&y);
|
||||||
BPoint pt(x,y);
|
BPoint pt(x,y);
|
||||||
|
|
||||||
set_is_sliding_tab(false);
|
set_is_sliding_tab(false);
|
||||||
@@ -1307,7 +1318,8 @@ printf("ServerWindow::HandleMouseEvent unimplemented\n");
|
|||||||
|
|
||||||
// Eventually, we will build in MouseUp messages with buttons specified
|
// Eventually, we will build in MouseUp messages with buttons specified
|
||||||
// For now, we just "assume" no mouse specification with a 0.
|
// For now, we just "assume" no mouse specification with a 0.
|
||||||
_winborder->MouseUp(buffer);
|
// _winborder->MouseUp(buffer);
|
||||||
|
_winborder->MouseUp((int8*)msg->Buffer());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1318,15 +1330,22 @@ printf("ServerWindow::HandleMouseEvent unimplemented\n");
|
|||||||
// 2) float - x coordinate of mouse click
|
// 2) float - x coordinate of mouse click
|
||||||
// 3) float - y coordinate of mouse click
|
// 3) float - y coordinate of mouse click
|
||||||
// 4) int32 - buttons down
|
// 4) int32 - buttons down
|
||||||
// int64 time=*((int64*)index);
|
// index+=sizeof(int64);
|
||||||
index+=sizeof(int64);
|
// float x=*((float*)index); index+=sizeof(float);
|
||||||
float x=*((float*)index); index+=sizeof(float);
|
// float y=*((float*)index); index+=sizeof(float);
|
||||||
float y=*((float*)index); index+=sizeof(float);
|
// BPoint pt(x,y);
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
int64 dummy;
|
||||||
|
msg->Read(&dummy);
|
||||||
|
msg->Read(&x);
|
||||||
|
msg->Read(&y);
|
||||||
BPoint pt(x,y);
|
BPoint pt(x,y);
|
||||||
|
|
||||||
if(is_moving_window() || is_resizing_window() || is_sliding_tab())
|
if(is_moving_window() || is_resizing_window() || is_sliding_tab())
|
||||||
{
|
{
|
||||||
active_winborder->MouseMoved(buffer);
|
// active_winborder->MouseMoved(buffer);
|
||||||
|
active_winborder->MouseMoved((int8*)msg->Buffer());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1334,7 +1353,8 @@ printf("ServerWindow::HandleMouseEvent unimplemented\n");
|
|||||||
if(_winborder)
|
if(_winborder)
|
||||||
{
|
{
|
||||||
mousewin=_winborder->Window();
|
mousewin=_winborder->Window();
|
||||||
_winborder->MouseMoved(buffer);
|
// _winborder->MouseMoved(buffer);
|
||||||
|
_winborder->MouseMoved((int8*)msg->Buffer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1353,13 +1373,20 @@ printf("ServerWindow::HandleMouseEvent unimplemented\n");
|
|||||||
*/
|
*/
|
||||||
void ServerWindow::HandleKeyEvent(int32 code, int8 *buffer)
|
void ServerWindow::HandleKeyEvent(int32 code, int8 *buffer)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_SERVERWINDOW_KEYBOARD
|
#ifdef DEBUG_SERVERWINDOW_KEYBOARD
|
||||||
printf("ServerWindow::HandleKeyEvent unimplemented\n");
|
printf("ServerWindow::HandleKeyEvent unimplemented\n");
|
||||||
#endif
|
#endif
|
||||||
/* ServerWindow *keywin=NULL;
|
/* ServerWindow *keywin=NULL;
|
||||||
int8 *index=buffer;
|
|
||||||
|
|
||||||
// Dispatch the key event to the active window
|
// Dispatch the key event to the active window
|
||||||
|
keywin=GetActiveWindow();
|
||||||
|
if(keywin)
|
||||||
|
{
|
||||||
|
keywin->Lock();
|
||||||
|
keywin->_winlink->SetOpCode(code);
|
||||||
|
keywin->_winlink
|
||||||
|
keywin->Unlock();
|
||||||
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1382,9 +1409,9 @@ Workspace *ServerWindow::GetWorkspace(void)
|
|||||||
*/
|
*/
|
||||||
void ServerWindow::SetWorkspace(Workspace *wkspc)
|
void ServerWindow::SetWorkspace(Workspace *wkspc)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s: Set Workspace\n",_title->String());
|
printf("ServerWindow %s: Set Workspace\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
_workspace=wkspc;
|
_workspace=wkspc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1393,9 +1420,9 @@ printf("ServerWindow %s: Set Workspace\n",_title->String());
|
|||||||
*/
|
*/
|
||||||
void ActivateWindow(ServerWindow *oldwin,ServerWindow *newwin)
|
void ActivateWindow(ServerWindow *oldwin,ServerWindow *newwin)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ActivateWindow: old=%s, new=%s\n",oldwin?oldwin->Title():"NULL",newwin?newwin->Title():"NULL");
|
printf("ActivateWindow: old=%s, new=%s\n",oldwin?oldwin->Title():"NULL",newwin?newwin->Title():"NULL");
|
||||||
#endif
|
#endif
|
||||||
if(oldwin==newwin)
|
if(oldwin==newwin)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#include <Rect.h>
|
#include <Rect.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
#include <PortMessage.h>
|
||||||
|
|
||||||
class BString;
|
class BString;
|
||||||
class BMessenger;
|
class BMessenger;
|
||||||
@@ -84,10 +85,10 @@ public:
|
|||||||
void Unlock(void);
|
void Unlock(void);
|
||||||
bool IsLocked(void);
|
bool IsLocked(void);
|
||||||
|
|
||||||
void DispatchMessage(int32 code, int8 *msgbuffer);
|
void DispatchMessage(PortMessage *msg);
|
||||||
void DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer);
|
void DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer);
|
||||||
static int32 MonitorWin(void *data);
|
static int32 MonitorWin(void *data);
|
||||||
static void HandleMouseEvent(int32 code, int8 *buffer);
|
static void HandleMouseEvent(PortMessage *msg);
|
||||||
static void HandleKeyEvent(int32 code, int8 *buffer);
|
static void HandleKeyEvent(int32 code, int8 *buffer);
|
||||||
|
|
||||||
//! Returns the index of the workspaces to which it belongs
|
//! Returns the index of the workspaces to which it belongs
|
||||||
|
|||||||
Reference in New Issue
Block a user