added inputserver test mode for ViewHWInterface
we write view events to a port so that the ViewInputDevice gets them and have them processed by input_server, and then app_server git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12489 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
2aec91b51e
commit
e9da11d0b2
|
@ -195,10 +195,7 @@ AppServer::AppServer(void) :
|
|||
resume_thread(fPicassoThreadID);
|
||||
|
||||
fDecoratorName="Default";
|
||||
|
||||
#if 0
|
||||
LaunchInputServer();
|
||||
|
||||
LaunchCursorThread();
|
||||
#endif
|
||||
}
|
||||
|
@ -284,7 +281,7 @@ AppServer::LaunchInputServer()
|
|||
|
||||
fISThreadID = B_ERROR;
|
||||
|
||||
while (find_thread("_roster_thread_") != B_OK && !fQuittingServer) {
|
||||
while (find_thread("_roster_thread_") == B_NAME_NOT_FOUND && !fQuittingServer) {
|
||||
snooze(250000);
|
||||
}
|
||||
|
||||
|
@ -301,8 +298,11 @@ AppServer::LaunchInputServer()
|
|||
|
||||
int32 arg_c = 1;
|
||||
char **arg_v = (char **)malloc(sizeof(char *) * (arg_c + 1));
|
||||
//arg_v[0] = strdup("/system/servers/input_server");
|
||||
arg_v[0] = strdup("input_server");
|
||||
#if TEST_MODE
|
||||
arg_v[0] = strdup("/boot/home/svnhaiku/trunk/distro/x86.R1/beos/system/servers/input_server");
|
||||
#else
|
||||
arg_v[0] = strdup("/system/servers/input_server");
|
||||
#endif
|
||||
arg_v[1] = NULL;
|
||||
fISThreadID = load_image(arg_c, (const char**)arg_v, (const char **)environ);
|
||||
free(arg_v[0]);
|
||||
|
@ -348,6 +348,8 @@ AppServer::CursorThread(void* data)
|
|||
AppServer *app = (AppServer *)data;
|
||||
|
||||
BPoint p;
|
||||
|
||||
app->LaunchInputServer();
|
||||
|
||||
do {
|
||||
|
||||
|
@ -356,7 +358,7 @@ AppServer::CursorThread(void* data)
|
|||
p.x = *app->fCursorAddr & 0x7fff;
|
||||
p.y = *app->fCursorAddr >> 15 & 0x7fff;
|
||||
|
||||
app->fDriver->MoveCursorTo(p.x, p.y);
|
||||
desktop->GetDisplayDriver()->MoveCursorTo(p.x, p.y);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -91,6 +91,8 @@ string_for_color_space(color_space format)
|
|||
return name;
|
||||
}
|
||||
|
||||
//#define INPUTSERVER_TEST_MODE 1
|
||||
|
||||
class CardView : public BView {
|
||||
public:
|
||||
CardView(BRect bounds);
|
||||
|
@ -110,7 +112,10 @@ class CardView : public BView {
|
|||
inline BPortLink* ServerLink() const
|
||||
{ return fServerLink; }
|
||||
|
||||
void ForwardMessage();
|
||||
|
||||
private:
|
||||
port_id fInputPort;
|
||||
BPortLink* fServerLink;
|
||||
const BBitmap* fBitmap;
|
||||
};
|
||||
|
@ -144,10 +149,15 @@ CardView::CardView(BRect bounds)
|
|||
{
|
||||
SetViewColor(B_TRANSPARENT_32_BIT);
|
||||
|
||||
#ifndef INPUTSERVER_TEST_MODE
|
||||
// This link for sending mouse messages to the Haiku app_server.
|
||||
// This is only to take the place of the input_server.
|
||||
port_id input_port = find_port(SERVER_INPUT_PORT);
|
||||
fServerLink = new BPortLink(input_port);
|
||||
#else
|
||||
fInputPort = create_port(100, "ViewInputDevice");
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
CardView::~CardView()
|
||||
|
@ -174,12 +184,29 @@ CardView::Draw(BRect updateRect)
|
|||
// to the server's port. Being we're using a regular window, it would make little sense
|
||||
// to do anything else.
|
||||
|
||||
void
|
||||
CardView::ForwardMessage()
|
||||
{
|
||||
BMessage *message = Window()->CurrentMessage();
|
||||
size_t length = message->FlattenedSize();
|
||||
char stream[length];
|
||||
|
||||
if ( message->Flatten(stream, length) == B_OK) {
|
||||
write_port(fInputPort, 0, stream, length);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MouseDown
|
||||
void
|
||||
CardView::MouseDown(BPoint pt)
|
||||
{
|
||||
#ifdef ENABLE_INPUT_SERVER_EMULATION
|
||||
#ifndef INPUTSERVER_TEST_MODE
|
||||
send_mouse_down(fServerLink, pt, Window()->CurrentMessage());
|
||||
#else
|
||||
ForwardMessage();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -196,7 +223,11 @@ CardView::MouseMoved(BPoint pt, uint32 transit, const BMessage* dragMessage)
|
|||
SetViewCursor(&cursor, true);
|
||||
|
||||
#ifdef ENABLE_INPUT_SERVER_EMULATION
|
||||
#ifndef INPUTSERVER_TEST_MODE
|
||||
send_mouse_moved(fServerLink, pt, Window()->CurrentMessage());
|
||||
#else
|
||||
ForwardMessage();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -205,7 +236,11 @@ void
|
|||
CardView::MouseUp(BPoint pt)
|
||||
{
|
||||
#ifdef ENABLE_INPUT_SERVER_EMULATION
|
||||
#ifndef INPUTSERVER_TEST_MODE
|
||||
send_mouse_up(fServerLink, pt, Window()->CurrentMessage());
|
||||
#else
|
||||
ForwardMessage();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -275,7 +310,11 @@ STRACE("MSG_UPDATE\n");
|
|||
break;
|
||||
default:
|
||||
#ifdef ENABLE_INPUT_SERVER_EMULATION
|
||||
#ifndef INPUTSERVER_TEST_MODE
|
||||
if (!handle_message(fView->ServerLink(), msg))
|
||||
#else
|
||||
fView->ForwardMessage();
|
||||
#endif
|
||||
#endif
|
||||
BWindow::MessageReceived(msg);
|
||||
break;
|
||||
|
|
|
@ -19,7 +19,6 @@ class BitmapBuffer;
|
|||
class CardWindow;
|
||||
class UpdateQueue;
|
||||
|
||||
|
||||
class ViewHWInterface : public HWInterface {
|
||||
public:
|
||||
ViewHWInterface();
|
||||
|
|
Loading…
Reference in New Issue