messaging fixes to RootLayer and ViewDriver
minor tweaks to ServerWindow git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10977 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
d4a57f2736
commit
c36b4a4409
@ -941,6 +941,12 @@ void RootLayer::MouseEventHandler(int32 code, BPortLink& msg)
|
||||
WinBorder *activeFocus=NULL;
|
||||
BRegion invalidRegion;
|
||||
|
||||
// TODO: Figure out the be:view_where field in B_MOUSE_DOWN for RootLayer
|
||||
// A little sniffing around R5's B_MOUSE_DOWN messages has revealed an
|
||||
// undocumented field: a BPoint entry called "be:view_where" which probably
|
||||
// helps the window determine the target view. Testing so far has revealed
|
||||
// that it has the same value as the "where" field
|
||||
|
||||
BMessage downmsg(B_MOUSE_DOWN);
|
||||
downmsg.AddInt64("when",evt.when);
|
||||
downmsg.AddPoint("where",evt.where);
|
||||
@ -996,7 +1002,6 @@ void RootLayer::MouseEventHandler(int32 code, BPortLink& msg)
|
||||
{
|
||||
target->Window()->Lock();
|
||||
target->MouseDown(evt, true);
|
||||
target->Window()->SendMessageToClient(&downmsg);
|
||||
target->Window()->Unlock();
|
||||
}
|
||||
else
|
||||
@ -1166,8 +1171,8 @@ void RootLayer::KeyboardEventHandler(int32 code, BPortLink& msg)
|
||||
msg.Read<bigtime_t>(&time);
|
||||
msg.Read<int32>(&scancode);
|
||||
msg.Read<int32>(&raw_char);
|
||||
msg.Read<int32>(&modifiers);
|
||||
msg.Read<int32>(&repeatcount);
|
||||
msg.Read<int32>(&modifiers);
|
||||
msg.Read(utf, sizeof(utf));
|
||||
msg.ReadString(&string);
|
||||
msg.Read(keystates,sizeof(int8)*16);
|
||||
@ -1322,9 +1327,10 @@ void RootLayer::KeyboardEventHandler(int32 code, BPortLink& msg)
|
||||
{
|
||||
BMessage keymsg(B_KEY_DOWN);
|
||||
keymsg.AddInt64("when",time);
|
||||
// keymsg.AddInt32("modifiers",modifiers);
|
||||
keymsg.AddInt32("key",scancode);
|
||||
keymsg.AddInt32("be:key_repeat",scancode);
|
||||
keymsg.AddInt32("modifiers",modifiers);
|
||||
if(repeatcount>1)
|
||||
keymsg.AddInt32("be:key_repeat",repeatcount);
|
||||
keymsg.AddData("states",B_INT8_TYPE,keystates,sizeof(int8)*16);
|
||||
for(uint8 i=0;i<4; i++)
|
||||
{
|
||||
@ -1332,8 +1338,11 @@ void RootLayer::KeyboardEventHandler(int32 code, BPortLink& msg)
|
||||
keymsg.AddInt8("byte",utf[i]);
|
||||
}
|
||||
keymsg.AddString("bytes",string);
|
||||
keymsg.AddInt32("raw_char",raw_char);
|
||||
// keymsg.AddInt32("raw_char",raw_char);
|
||||
|
||||
printf("RootLayer keyboard message:\n");
|
||||
keymsg.PrintToStream();
|
||||
printf("\n");
|
||||
win->SendMessageToClient(&keymsg);
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <malloc.h>
|
||||
#include <View.h> // for B_XXXXX_MOUSE_BUTTON defines
|
||||
#include <View.h>
|
||||
#include <Message.h>
|
||||
#include <GraphicsDefs.h>
|
||||
#include <PortLink.h>
|
||||
@ -192,7 +192,7 @@ ServerWindow::~ServerWindow(void)
|
||||
STRACE(("*ServerWindow (%s):~ServerWindow()\n",fTitle.String()));
|
||||
|
||||
desktop->RemoveWinBorder(fWinBorder);
|
||||
STRACE(("SW(%s) Successfully removed from the desktop\n", fTitle.String()));
|
||||
STRACE(("ServerWindow(%s) Successfully removed from the desktop\n", fTitle.String()));
|
||||
|
||||
if(fMsgSender)
|
||||
{
|
||||
@ -808,13 +808,11 @@ void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
|
||||
patt = ld->patt.GetInt64();
|
||||
|
||||
// TODO: Implement when ServerFont::SetfamilyAndStyle(int32) exists
|
||||
// TODO: Implement *what*? SetFamilyAndStyle exists. :)
|
||||
fMsgSender->StartMessage(SERVER_TRUE);
|
||||
|
||||
// Attach font state
|
||||
|
||||
// TODO: need a ServerFont::GetFamAndStyle
|
||||
// fMsgSender->Attach<uint32>(0UL uint32 ld->font.GetFamAndStyle());
|
||||
fMsgSender->Attach<uint32>(0UL);
|
||||
fMsgSender->Attach<uint32>(ld->font.GetFamilyAndStyle());
|
||||
fMsgSender->Attach<float>(ld->font.Size());
|
||||
fMsgSender->Attach<float>(ld->font.Shear());
|
||||
fMsgSender->Attach<float>(ld->font.Rotation());
|
||||
@ -2115,18 +2113,21 @@ void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
|
||||
}
|
||||
case AS_LAYER_DRAG_IMAGE:
|
||||
{
|
||||
// TODO: Implement AS_LAYER_DRAG_IMAGE
|
||||
STRACE(("ServerWindow %s: Message AS_DRAG_IMAGE unimplemented\n",fTitle.String()));
|
||||
DTRACE(("ServerWindow %s: Message AS_DRAG_IMAGE unimplemented\n",fTitle.String()));
|
||||
break;
|
||||
}
|
||||
case AS_LAYER_DRAG_RECT:
|
||||
{
|
||||
// TODO: Implement AS_LAYER_DRAG_RECT
|
||||
STRACE(("ServerWindow %s: Message AS_DRAG_RECT unimplemented\n",fTitle.String()));
|
||||
DTRACE(("ServerWindow %s: Message AS_DRAG_RECT unimplemented\n",fTitle.String()));
|
||||
break;
|
||||
}
|
||||
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()));
|
||||
// Attached Data:
|
||||
|
@ -147,6 +147,7 @@ void VDView::Draw(BRect rect)
|
||||
|
||||
void VDView::MouseDown(BPoint pt)
|
||||
{
|
||||
#ifdef ENABLE_INPUT_SERVER_EMULATION
|
||||
// Attach data:
|
||||
// 1) int64 - time of mouse click
|
||||
// 2) float - x coordinate of mouse click
|
||||
@ -154,16 +155,15 @@ void VDView::MouseDown(BPoint pt)
|
||||
// 4) int32 - modifier keys down
|
||||
// 5) int32 - buttons down
|
||||
// 6) int32 - clicks
|
||||
#ifdef ENABLE_INPUT_SERVER_EMULATION
|
||||
BPoint p;
|
||||
|
||||
uint32 buttons,
|
||||
mod=modifiers(),
|
||||
clicks=1; // can't get the # of clicks without a *lot* of extra work :(
|
||||
|
||||
uint32 buttons, mod, clicks=1;
|
||||
int64 time=(int64)real_time_clock();
|
||||
|
||||
GetMouse(&p,&buttons);
|
||||
BMessage *msg=Window()->CurrentMessage();
|
||||
msg->FindPoint("where",&pt);
|
||||
msg->FindInt32("modifiers",(int32*)&mod);
|
||||
msg->FindInt32("buttons",(int32*)&buttons);
|
||||
msg->FindInt32("clicks",(int32*)&clicks);
|
||||
|
||||
serverlink->StartMessage(B_MOUSE_DOWN);
|
||||
serverlink->Attach(&time, sizeof(int64));
|
||||
@ -286,16 +286,20 @@ void VDWindow::MessageReceived(BMessage *msg)
|
||||
|
||||
systime=(int64)real_time_clock();
|
||||
msg->FindInt32("key",&scancode);
|
||||
msg->FindInt32("be:key_repeat",&repeatcount);
|
||||
if(msg->FindInt32("be:key_repeat",&repeatcount)!=B_OK)
|
||||
{
|
||||
// TODO: see if repeatcount should be 0 or 1 when not repeating in ViewDriver
|
||||
repeatcount=1;
|
||||
}
|
||||
msg->FindInt32("modifiers",&modifiers);
|
||||
msg->FindInt32("raw_char",&asciicode);
|
||||
|
||||
msg->FindInt8("byte",0,utf8data);
|
||||
if(msg->FindInt8("byte",1,utf8data+1)!=B_OK)
|
||||
utf8data[1]=0;
|
||||
if(msg->FindInt8("byte",1,utf8data+2)!=B_OK)
|
||||
if(msg->FindInt8("byte",2,utf8data+2)!=B_OK)
|
||||
utf8data[2]=0;
|
||||
if(msg->FindInt8("byte",1,utf8data+3)!=B_OK)
|
||||
if(msg->FindInt8("byte",3,utf8data+3)!=B_OK)
|
||||
utf8data[3]=0;
|
||||
msg->FindString("bytes",&string);
|
||||
for(int8 i=0;i<15;i++)
|
||||
@ -307,8 +311,7 @@ void VDWindow::MessageReceived(BMessage *msg)
|
||||
view->serverlink->Attach(repeatcount);
|
||||
view->serverlink->Attach(modifiers);
|
||||
view->serverlink->Attach(utf8data,sizeof(int8)*3);
|
||||
view->serverlink->Attach(string.Length()+1);
|
||||
view->serverlink->Attach(string.String());
|
||||
view->serverlink->AttachString(string.String());
|
||||
view->serverlink->Attach(keyarray,sizeof(int8)*16);
|
||||
view->serverlink->Flush();
|
||||
break;
|
||||
@ -351,8 +354,7 @@ void VDWindow::MessageReceived(BMessage *msg)
|
||||
view->serverlink->Attach(asciicode);
|
||||
view->serverlink->Attach(modifiers);
|
||||
view->serverlink->Attach(utf8data,sizeof(int8)*3);
|
||||
view->serverlink->Attach(string.Length()+1);
|
||||
view->serverlink->Attach(string.String());
|
||||
view->serverlink->AttachString(string.String());
|
||||
view->serverlink->Attach(keyarray,sizeof(int8)*16);
|
||||
view->serverlink->Flush();
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user