added some support for R5 app_server communication
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9147 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -48,9 +48,6 @@
|
|||||||
#include <PortLink.h>
|
#include <PortLink.h>
|
||||||
#include <ServerProtocol.h>
|
#include <ServerProtocol.h>
|
||||||
|
|
||||||
#define X_VALUE "x"
|
|
||||||
#define Y_VALUE "y"
|
|
||||||
|
|
||||||
|
|
||||||
extern "C" void RegisterDevices(input_device_ref** devices)
|
extern "C" void RegisterDevices(input_device_ref** devices)
|
||||||
{
|
{
|
||||||
@@ -123,16 +120,32 @@ InputServer::InputServer(void) : BApplication(INPUTSERVER_SIGNATURE),
|
|||||||
|
|
||||||
if (has_data(find_thread(NULL))) {
|
if (has_data(find_thread(NULL))) {
|
||||||
PRINT(("HasData == YES\n"));
|
PRINT(("HasData == YES\n"));
|
||||||
uint32 buffer[2];
|
int32 buffer[2];
|
||||||
|
thread_id appThreadId;
|
||||||
memset(buffer, 0, sizeof(buffer));
|
memset(buffer, 0, sizeof(buffer));
|
||||||
int32 code = receive_data(&fAppThreadId, buffer, sizeof(buffer));
|
int32 code = receive_data(&appThreadId, buffer, sizeof(buffer));
|
||||||
PRINT(("tid : %ld, code :%ld\n", fAppThreadId, code));
|
PRINT(("tid : %ld, code :%ld\n", appThreadId, code));
|
||||||
for (int32 i=0; i<2; i++) {
|
for (int32 i=0; i<2; i++) {
|
||||||
PRINT(("data : %lx\n", buffer[i]));
|
PRINT(("data : %lx\n", buffer[i]));
|
||||||
}
|
}
|
||||||
fCursorSem = buffer[0];
|
fCursorSem = buffer[0];
|
||||||
fAppArea = buffer[1];
|
area_id appArea = buffer[1];
|
||||||
|
|
||||||
|
fAppArea = clone_area("isClone", (void**)&fAppBuffer, B_ANY_ADDRESS, B_READ_AREA|B_WRITE_AREA, appArea);
|
||||||
|
if (fAppArea < B_OK) {
|
||||||
|
PRINT(("clone_area error : %s\n", strerror(fAppArea)));
|
||||||
|
}
|
||||||
|
|
||||||
|
fAsPort = create_port(100, "is_as");
|
||||||
|
|
||||||
|
fAsReadSem = create_sem(0, "is_as");
|
||||||
|
fAsWriteSem = create_sem(100, "is_as");
|
||||||
|
buffer[0] = fAsReadSem;
|
||||||
|
buffer[1] = fAsWriteSem;
|
||||||
|
|
||||||
|
status_t err;
|
||||||
|
if ((err = send_data(appThreadId, 0, buffer, sizeof(buffer)))!=B_OK)
|
||||||
|
PRINT(("error when send_data %s\n", strerror(err)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -652,38 +665,50 @@ InputServer::HandleGetSetMouseSpeed(BMessage* message,
|
|||||||
status_t
|
status_t
|
||||||
InputServer::HandleSetMousePosition(BMessage *message, BMessage *outbound)
|
InputServer::HandleSetMousePosition(BMessage *message, BMessage *outbound)
|
||||||
{
|
{
|
||||||
|
CALLED();
|
||||||
|
|
||||||
// this assumes that both supplied pointers are identical
|
// this assumes that both supplied pointers are identical
|
||||||
|
|
||||||
ASSERT(outbound == message);
|
ASSERT(outbound == message);
|
||||||
|
|
||||||
int32 xValue, yValue;
|
int32 xValue, yValue;
|
||||||
|
|
||||||
message->FindInt32("x",xValue);
|
|
||||||
PRINT(("[HandleSetMousePosition] x = %lu:\n",xValue));
|
|
||||||
|
|
||||||
switch(message->what){
|
switch(message->what){
|
||||||
case B_MOUSE_MOVED:
|
case B_MOUSE_MOVED:
|
||||||
case B_MOUSE_DOWN:
|
case B_MOUSE_DOWN:
|
||||||
case B_MOUSE_UP:
|
case B_MOUSE_UP:
|
||||||
// get point and button from msg
|
// get point and button from msg
|
||||||
if((outbound->FindInt32(X_VALUE, &xValue) == B_OK)
|
if((outbound->FindInt32("x", &xValue) == B_OK)
|
||||||
&& (outbound->FindInt32(Y_VALUE, &yValue) == B_OK)) {
|
&& (outbound->FindInt32("y", &yValue) == B_OK)) {
|
||||||
fMousePos.x += xValue;
|
fMousePos.x += xValue;
|
||||||
fMousePos.y += yValue;
|
fMousePos.y += yValue;
|
||||||
outbound->RemoveName(X_VALUE);
|
outbound->RemoveName("x");
|
||||||
outbound->RemoveName(Y_VALUE);
|
outbound->RemoveName("y");
|
||||||
outbound->AddPoint("where", fMousePos);
|
outbound->AddPoint("where", fMousePos);
|
||||||
outbound->AddInt32("modifiers", fKey_info.modifiers);
|
outbound->AddInt32("modifiers", fKey_info.modifiers);
|
||||||
|
|
||||||
|
PRINT(("new position : %f, %f, %ld, %ld\n", fMousePos.x, fMousePos.y, xValue, yValue));
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
if (fAppBuffer) {
|
||||||
|
fAppBuffer[0] =
|
||||||
|
(0x3 << 30)
|
||||||
|
| ((uint32)fMousePos.x & 0x7fff) << 15
|
||||||
|
| ((uint32)fMousePos.y & 0x7fff);
|
||||||
|
|
||||||
|
PRINT(("released cursorSem with value : %08lx\n", fAppBuffer[0]));
|
||||||
|
release_sem(fCursorSem);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
// some Key Down and up codes ..
|
// some Key Down and up codes ..
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1125,11 +1150,7 @@ int
|
|||||||
InputServer::DispatchEvent(BMessage *message)
|
InputServer::DispatchEvent(BMessage *message)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
|
int32 xValue, yValue;
|
||||||
// variables
|
|
||||||
int32 xValue,
|
|
||||||
yValue;
|
|
||||||
|
|
||||||
port_id pid = find_port(SERVER_INPUT_PORT);
|
port_id pid = find_port(SERVER_INPUT_PORT);
|
||||||
|
|
||||||
// BPortLink is incompatible with R5 one
|
// BPortLink is incompatible with R5 one
|
||||||
|
|||||||
@@ -209,10 +209,12 @@ private:
|
|||||||
//fMouseState;
|
//fMouseState;
|
||||||
|
|
||||||
sem_id fCursorSem;
|
sem_id fCursorSem;
|
||||||
|
sem_id fAsReadSem, fAsWriteSem;
|
||||||
|
port_id fAsPort;
|
||||||
area_id fAppArea;
|
area_id fAppArea;
|
||||||
area_id fCloneArea;
|
area_id fCloneArea;
|
||||||
void *fAppBuffer;
|
uint32 *fAppBuffer;
|
||||||
thread_id fAppThreadId;
|
|
||||||
#if DEBUG == 2
|
#if DEBUG == 2
|
||||||
public:
|
public:
|
||||||
static FILE *sLogFile;
|
static FILE *sLogFile;
|
||||||
|
|||||||
@@ -34,6 +34,10 @@ MouseSettings::MouseSettings()
|
|||||||
{
|
{
|
||||||
RetrieveSettings();
|
RetrieveSettings();
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
Dump();
|
||||||
|
#endif
|
||||||
|
|
||||||
fOriginalSettings = fSettings;
|
fOriginalSettings = fSettings;
|
||||||
fOriginalMode = fMode;
|
fOriginalMode = fMode;
|
||||||
}
|
}
|
||||||
@@ -63,7 +67,8 @@ MouseSettings::RetrieveSettings()
|
|||||||
// retrieve current values
|
// retrieve current values
|
||||||
|
|
||||||
fMode = mouse_mode();
|
fMode = mouse_mode();
|
||||||
|
Defaults();
|
||||||
|
|
||||||
// also try to load the window position from disk
|
// also try to load the window position from disk
|
||||||
|
|
||||||
BPath path;
|
BPath path;
|
||||||
@@ -88,10 +93,11 @@ MouseSettings::RetrieveSettings()
|
|||||||
Defaults();
|
Defaults();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
if ((fSettings.click_speed == 0)
|
||||||
Dump();
|
|| (fSettings.type == 0)) {
|
||||||
#endif
|
Defaults();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user