change field name of mouse position

change device message handling a bit


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9065 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2004-09-26 22:41:00 +00:00
parent 59fda8c176
commit 3278758030
2 changed files with 22 additions and 18 deletions
+20 -17
View File
@@ -161,8 +161,8 @@ InputServer::InitKeyboardMouseStates(void)
// This is where we determine the screen resolution from the app_server and find the center of the screen // This is where we determine the screen resolution from the app_server and find the center of the screen
// sMousePos is then set to the center of the screen. // sMousePos is then set to the center of the screen.
sMousePos.x = 200; fMousePos.x = 200;
sMousePos.y = 200; fMousePos.y = 200;
if (LoadKeymap()!=B_OK) if (LoadKeymap()!=B_OK)
LoadSystemKeymap(); LoadSystemKeymap();
@@ -630,28 +630,31 @@ InputServer::HandleSetMousePosition(BMessage *message, BMessage *outbound)
ASSERT(outbound == message); ASSERT(outbound == message);
sMousePos.x = 200; fMousePos.x = 200;
sMousePos.y = 200; fMousePos.y = 200;
int32 xValue, int32 xValue, yValue;
yValue;
message->FindInt32("x",xValue); message->FindInt32("x",xValue);
PRINT(("[HandleSetMousePosition] x = %lu:\n",xValue)); PRINT(("[HandleSetMousePosition] x = %lu:\n",xValue));
switch(message->what){ switch(message->what){
case B_MOUSE_MOVED:{ case B_MOUSE_MOVED:
// get point and button from msg case B_MOUSE_DOWN:
if((outbound->FindInt32(X_VALUE,&xValue) == B_OK) && (outbound->FindInt32(Y_VALUE,&yValue) == B_OK)){ case B_MOUSE_UP:
sMousePos.x += xValue; // get point and button from msg
sMousePos.y += yValue; if((outbound->FindInt32(X_VALUE, &xValue) == B_OK)
outbound->ReplaceInt32(X_VALUE,sMousePos.x); && (outbound->FindInt32(Y_VALUE, &yValue) == B_OK)) {
outbound->ReplaceInt32(Y_VALUE,sMousePos.y); fMousePos.x += xValue;
} fMousePos.y += yValue;
outbound->RemoveName(X_VALUE);
outbound->RemoveName(Y_VALUE);
outbound->AddPoint("where", fMousePos);
outbound->AddInt32("modifiers", fKey_info.modifiers);
}
break; break;
}
// Should be some Mouse Down and Up code here .. // some Key Down and up codes ..
// Along with some Key Down and up codes ..
default: default:
break; break;
+2 -1
View File
@@ -187,12 +187,13 @@ private:
bool sEventLoopRunning; bool sEventLoopRunning;
bool sSafeMode; bool sSafeMode;
port_id sEventPort; port_id sEventPort;
BPoint sMousePos;
uint16 sKeyboardID; uint16 sKeyboardID;
KeyboardSettings fKeyboardSettings; KeyboardSettings fKeyboardSettings;
MouseSettings fMouseSettings; MouseSettings fMouseSettings;
BPoint fMousePos; // current mouse position
key_info fKey_info; // current key info key_info fKey_info; // current key info
key_map fKeys; // current key_map key_map fKeys; // current key_map
char *fChars; // current keymap chars char *fChars; // current keymap chars