This fleshes out the HandleSetMousePosition() and the input_server now tracks the current position of the mouse cursor.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@729 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
#include "FindDirectory.h"
|
||||
#include "Entry.h"
|
||||
#include "Locker.h"
|
||||
#include "Debug.h"
|
||||
|
||||
#include "InputServerDeviceListEntry.h"
|
||||
#include "InputServerFilterListEntry.h"
|
||||
@@ -736,9 +737,39 @@ void InputServer::HandleGetSetMouseSpeed(BMessage *,
|
||||
* Method: InputServer::HandleSetMousePosition()
|
||||
* Descr:
|
||||
*/
|
||||
void InputServer::HandleSetMousePosition(BMessage *,␍
|
||||
BMessage *)␍
|
||||
void InputServer::HandleSetMousePosition(BMessage *message, BMessage *outbound)
|
||||
{
|
||||
|
||||
// this assumes that both supplied pointers are identical
|
||||
|
||||
ASSERT(outbound == message);
|
||||
|
||||
sMousePos.x = 200;
|
||||
sMousePos.y = 200;
|
||||
|
||||
int32 xValue,
|
||||
yValue;
|
||||
|
||||
message->FindInt32("x",xValue);
|
||||
printf("[HandleSetMousePosition] x = %lu:\n",xValue);
|
||||
|
||||
switch(message->what){
|
||||
case B_MOUSE_MOVED:{
|
||||
// get point and button from msg
|
||||
if((outbound->FindInt32(X_VALUE,&xValue) == B_OK) && (outbound->FindInt32(Y_VALUE,&yValue) == B_OK)){
|
||||
sMousePos.x += xValue;
|
||||
sMousePos.y += yValue;
|
||||
outbound->ReplaceInt32(X_VALUE,sMousePos.x);
|
||||
outbound->ReplaceInt32(Y_VALUE,sMousePos.y);
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Should be some Mouse Down and Up code here ..
|
||||
// Along with some Key Down and up codes ..
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1204,7 +1235,7 @@ void InputServer::WatchPort()
|
||||
// Block until we find the size of the next message
|
||||
length = port_buffer_size(EventLooperPort);
|
||||
buffer = (char*)malloc(length);
|
||||
printf("[Event Looper] BMessage Size = %d\n", length);␍
|
||||
printf("[Event Looper] BMessage Size = %lu\n", length);
|
||||
//event = NULL;
|
||||
BMessage *event = new BMessage();
|
||||
err = read_port(EventLooperPort, &code, buffer, length);
|
||||
@@ -1222,6 +1253,8 @@ void InputServer::WatchPort()
|
||||
// This is where the message should be processed.
|
||||
event->PrintToStream();
|
||||
|
||||
HandleSetMousePosition(event, event);
|
||||
|
||||
DispatchEvent(event);
|
||||
|
||||
//printf("Event writen to port\n");
|
||||
|
||||
Reference in New Issue
Block a user