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:
@@ -195,10 +195,7 @@ AppServer::AppServer(void) :
|
|||||||
resume_thread(fPicassoThreadID);
|
resume_thread(fPicassoThreadID);
|
||||||
|
|
||||||
fDecoratorName="Default";
|
fDecoratorName="Default";
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
LaunchInputServer();
|
|
||||||
|
|
||||||
LaunchCursorThread();
|
LaunchCursorThread();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -284,7 +281,7 @@ AppServer::LaunchInputServer()
|
|||||||
|
|
||||||
fISThreadID = B_ERROR;
|
fISThreadID = B_ERROR;
|
||||||
|
|
||||||
while (find_thread("_roster_thread_") != B_OK && !fQuittingServer) {
|
while (find_thread("_roster_thread_") == B_NAME_NOT_FOUND && !fQuittingServer) {
|
||||||
snooze(250000);
|
snooze(250000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -301,8 +298,11 @@ AppServer::LaunchInputServer()
|
|||||||
|
|
||||||
int32 arg_c = 1;
|
int32 arg_c = 1;
|
||||||
char **arg_v = (char **)malloc(sizeof(char *) * (arg_c + 1));
|
char **arg_v = (char **)malloc(sizeof(char *) * (arg_c + 1));
|
||||||
//arg_v[0] = strdup("/system/servers/input_server");
|
#if TEST_MODE
|
||||||
arg_v[0] = strdup("input_server");
|
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;
|
arg_v[1] = NULL;
|
||||||
fISThreadID = load_image(arg_c, (const char**)arg_v, (const char **)environ);
|
fISThreadID = load_image(arg_c, (const char**)arg_v, (const char **)environ);
|
||||||
free(arg_v[0]);
|
free(arg_v[0]);
|
||||||
@@ -348,6 +348,8 @@ AppServer::CursorThread(void* data)
|
|||||||
AppServer *app = (AppServer *)data;
|
AppServer *app = (AppServer *)data;
|
||||||
|
|
||||||
BPoint p;
|
BPoint p;
|
||||||
|
|
||||||
|
app->LaunchInputServer();
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
||||||
@@ -356,7 +358,7 @@ AppServer::CursorThread(void* data)
|
|||||||
p.x = *app->fCursorAddr & 0x7fff;
|
p.x = *app->fCursorAddr & 0x7fff;
|
||||||
p.y = *app->fCursorAddr >> 15 & 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;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#define INPUTSERVER_TEST_MODE 1
|
||||||
|
|
||||||
class CardView : public BView {
|
class CardView : public BView {
|
||||||
public:
|
public:
|
||||||
CardView(BRect bounds);
|
CardView(BRect bounds);
|
||||||
@@ -110,7 +112,10 @@ class CardView : public BView {
|
|||||||
inline BPortLink* ServerLink() const
|
inline BPortLink* ServerLink() const
|
||||||
{ return fServerLink; }
|
{ return fServerLink; }
|
||||||
|
|
||||||
|
void ForwardMessage();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
port_id fInputPort;
|
||||||
BPortLink* fServerLink;
|
BPortLink* fServerLink;
|
||||||
const BBitmap* fBitmap;
|
const BBitmap* fBitmap;
|
||||||
};
|
};
|
||||||
@@ -144,10 +149,15 @@ CardView::CardView(BRect bounds)
|
|||||||
{
|
{
|
||||||
SetViewColor(B_TRANSPARENT_32_BIT);
|
SetViewColor(B_TRANSPARENT_32_BIT);
|
||||||
|
|
||||||
|
#ifndef INPUTSERVER_TEST_MODE
|
||||||
// This link for sending mouse messages to the Haiku app_server.
|
// This link for sending mouse messages to the Haiku app_server.
|
||||||
// This is only to take the place of the input_server.
|
// This is only to take the place of the input_server.
|
||||||
port_id input_port = find_port(SERVER_INPUT_PORT);
|
port_id input_port = find_port(SERVER_INPUT_PORT);
|
||||||
fServerLink = new BPortLink(input_port);
|
fServerLink = new BPortLink(input_port);
|
||||||
|
#else
|
||||||
|
fInputPort = create_port(100, "ViewInputDevice");
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CardView::~CardView()
|
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 the server's port. Being we're using a regular window, it would make little sense
|
||||||
// to do anything else.
|
// 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
|
// MouseDown
|
||||||
void
|
void
|
||||||
CardView::MouseDown(BPoint pt)
|
CardView::MouseDown(BPoint pt)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_INPUT_SERVER_EMULATION
|
#ifdef ENABLE_INPUT_SERVER_EMULATION
|
||||||
|
#ifndef INPUTSERVER_TEST_MODE
|
||||||
send_mouse_down(fServerLink, pt, Window()->CurrentMessage());
|
send_mouse_down(fServerLink, pt, Window()->CurrentMessage());
|
||||||
|
#else
|
||||||
|
ForwardMessage();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,7 +223,11 @@ CardView::MouseMoved(BPoint pt, uint32 transit, const BMessage* dragMessage)
|
|||||||
SetViewCursor(&cursor, true);
|
SetViewCursor(&cursor, true);
|
||||||
|
|
||||||
#ifdef ENABLE_INPUT_SERVER_EMULATION
|
#ifdef ENABLE_INPUT_SERVER_EMULATION
|
||||||
|
#ifndef INPUTSERVER_TEST_MODE
|
||||||
send_mouse_moved(fServerLink, pt, Window()->CurrentMessage());
|
send_mouse_moved(fServerLink, pt, Window()->CurrentMessage());
|
||||||
|
#else
|
||||||
|
ForwardMessage();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,7 +236,11 @@ void
|
|||||||
CardView::MouseUp(BPoint pt)
|
CardView::MouseUp(BPoint pt)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_INPUT_SERVER_EMULATION
|
#ifdef ENABLE_INPUT_SERVER_EMULATION
|
||||||
|
#ifndef INPUTSERVER_TEST_MODE
|
||||||
send_mouse_up(fServerLink, pt, Window()->CurrentMessage());
|
send_mouse_up(fServerLink, pt, Window()->CurrentMessage());
|
||||||
|
#else
|
||||||
|
ForwardMessage();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,7 +310,11 @@ STRACE("MSG_UPDATE\n");
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
#ifdef ENABLE_INPUT_SERVER_EMULATION
|
#ifdef ENABLE_INPUT_SERVER_EMULATION
|
||||||
|
#ifndef INPUTSERVER_TEST_MODE
|
||||||
if (!handle_message(fView->ServerLink(), msg))
|
if (!handle_message(fView->ServerLink(), msg))
|
||||||
|
#else
|
||||||
|
fView->ForwardMessage();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
BWindow::MessageReceived(msg);
|
BWindow::MessageReceived(msg);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ class BitmapBuffer;
|
|||||||
class CardWindow;
|
class CardWindow;
|
||||||
class UpdateQueue;
|
class UpdateQueue;
|
||||||
|
|
||||||
|
|
||||||
class ViewHWInterface : public HWInterface {
|
class ViewHWInterface : public HWInterface {
|
||||||
public:
|
public:
|
||||||
ViewHWInterface();
|
ViewHWInterface();
|
||||||
|
|||||||
Reference in New Issue
Block a user