From 597c548ca3e783841a2d9cd7ba48781255992690 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sun, 17 Apr 2005 12:26:16 +0000 Subject: [PATCH] Moved the port creation for app_server - input_server communication out of the DisplayDrivers and into the AppServer constructor. This may later needs to be moved into RootLayer if we want multiple user support. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12426 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/AppServer.cpp | 27 +++++++++++++++++-- src/servers/app/AppServer.h | 1 + src/servers/app/drawing/AccelerantDriver.cpp | 6 ----- .../app/drawing/AccelerantHWInterface.cpp | 7 ----- src/servers/app/drawing/DirectDriver.cpp | 9 ------- src/servers/app/drawing/ViewDriver.cpp | 11 +++----- src/servers/app/drawing/ViewHWInterface.cpp | 8 ++---- 7 files changed, 31 insertions(+), 38 deletions(-) diff --git a/src/servers/app/AppServer.cpp b/src/servers/app/AppServer.cpp index 3dd123c735..4de0843db4 100644 --- a/src/servers/app/AppServer.cpp +++ b/src/servers/app/AppServer.cpp @@ -91,8 +91,17 @@ AppServer::AppServer(void) : BApplication (SERVER_SIGNATURE) AppServer::AppServer(void) #endif { - fMessagePort= create_port(200,SERVER_PORT_NAME); - + fMessagePort= create_port(200, SERVER_PORT_NAME); + if (fMessagePort == B_NO_MORE_PORTS) + debugger("app_server could not create message port"); + + // Create the input port. The input_server will send it's messages here. + // TODO: If we want multiple user support we would need an individual + // port for each user and do the following for each RootLayer. + fServerInputPort = create_port(200, SERVER_INPUT_PORT); + if (fServerInputPort == B_NO_MORE_PORTS) + debugger("app_server could not create input port"); + fAppList= new BList(0); fQuittingServer= false; make_decorator= NULL; @@ -184,6 +193,20 @@ AppServer::AppServer(void) resume_thread(fPicassoThreadID); fDecoratorName="Default"; + +#if 0 + // TODO: We are supposed to start the input_server, but it's a BApplication + // that depends on the registrar running, which is started after app_server + int32 arg_c = 1; + char **arg_v = (char **)malloc(sizeof(char *) * (arg_c + 1)); + arg_v[0] = strdup("/system/servers/input_server"); + arg_v[1] = NULL; + thread_id isThread = load_image(arg_c, (const char**)arg_v, (const char **)environ); + free(arg_v[0]); + + resume_thread(isThread); + setpgid(isThread, 0); +#endif } /*! diff --git a/src/servers/app/AppServer.h b/src/servers/app/AppServer.h index f9f6e2be43..75bf2e0261 100644 --- a/src/servers/app/AppServer.h +++ b/src/servers/app/AppServer.h @@ -57,6 +57,7 @@ private: create_decorator *make_decorator; port_id fMessagePort; + port_id fServerInputPort; image_id fDecoratorID; diff --git a/src/servers/app/drawing/AccelerantDriver.cpp b/src/servers/app/drawing/AccelerantDriver.cpp index 9006ff2c56..f24d5186fb 100644 --- a/src/servers/app/drawing/AccelerantDriver.cpp +++ b/src/servers/app/drawing/AccelerantDriver.cpp @@ -69,12 +69,6 @@ AccelerantDriver::AccelerantDriver() card_fd = -1; accelerant_image = -1; mode_list = NULL; - - // we need this under Haiku too, as it is where the input_server - // sends it's data to. - port_id serverInputPort = create_port(200, SERVER_INPUT_PORT); - if (serverInputPort == B_NO_MORE_PORTS) - debugger("AccelerantDriver: out of ports\n"); } diff --git a/src/servers/app/drawing/AccelerantHWInterface.cpp b/src/servers/app/drawing/AccelerantHWInterface.cpp index 79ae154db1..20158f6ea3 100644 --- a/src/servers/app/drawing/AccelerantHWInterface.cpp +++ b/src/servers/app/drawing/AccelerantHWInterface.cpp @@ -89,13 +89,6 @@ AccelerantHWInterface::AccelerantHWInterface() fDisplayMode.virtual_width = 640; fDisplayMode.virtual_height = 480; fDisplayMode.space = B_RGB32; - - // TODO: Move this to a more general place - // we need this under Haiku too, as it is where the input_server - // sends it's data to. - port_id serverInputPort = create_port(200, SERVER_INPUT_PORT); - if (serverInputPort == B_NO_MORE_PORTS) - debugger("AccelerantDriver: out of ports\n"); } // destructor diff --git a/src/servers/app/drawing/DirectDriver.cpp b/src/servers/app/drawing/DirectDriver.cpp index 68c981f471..fad507fd6a 100644 --- a/src/servers/app/drawing/DirectDriver.cpp +++ b/src/servers/app/drawing/DirectDriver.cpp @@ -123,15 +123,6 @@ DirectDriver::DirectDriver() // We'll save this so that if we change the bit depth of the screen, we // can change it back when the driver is shut down. fSavedScreenMode=fCurrentScreenMode; - -#ifdef ENABLE_INPUT_SERVER_EMULATION - port_id serverInputPort = create_port(200, SERVER_INPUT_PORT); - if (serverInputPort == B_NO_MORE_PORTS) - { - debugger("DirectDriver: out of ports\n"); - return; - } -#endif } DirectDriver::~DirectDriver() diff --git a/src/servers/app/drawing/ViewDriver.cpp b/src/servers/app/drawing/ViewDriver.cpp index 6f11dfc6eb..fedb652a27 100644 --- a/src/servers/app/drawing/ViewDriver.cpp +++ b/src/servers/app/drawing/ViewDriver.cpp @@ -82,15 +82,10 @@ VDView::VDView(BRect bounds) SetViewColor(B_TRANSPARENT_32_BIT); viewbmp=new BBitmap(bounds,B_RGBA32,true); - // This link for sending mouse messages to the OBAppServer. + // This link for sending mouse messages to the Haiku app_server. // This is only to take the place of the Input Server. - port_id serverInputPort = create_port(200, SERVER_INPUT_PORT); - if (serverInputPort == B_NO_MORE_PORTS) - { - debugger("ViewDriver: out of ports\n"); - return; - } - serverlink = new BPortLink(serverInputPort); + port_id input_port = find_port(SERVER_INPUT_PORT); + serverlink = new BPortLink(input_port); // Create a cursor which isn't just a box cursor=new BBitmap(BRect(0,0,20,20),B_RGBA32,true); diff --git a/src/servers/app/drawing/ViewHWInterface.cpp b/src/servers/app/drawing/ViewHWInterface.cpp index 865c4a944d..33a75ea8fa 100644 --- a/src/servers/app/drawing/ViewHWInterface.cpp +++ b/src/servers/app/drawing/ViewHWInterface.cpp @@ -146,12 +146,8 @@ CardView::CardView(BRect bounds) // This link for sending mouse messages to the Haiku app_server. // This is only to take the place of the input_server. - port_id serverInputPort = create_port(200, SERVER_INPUT_PORT); - if (serverInputPort == B_NO_MORE_PORTS) { - debugger("ViewHWInterface: out of ports\n"); - return; - } - fServerLink = new BPortLink(serverInputPort); + port_id input_port = find_port(SERVER_INPUT_PORT); + fServerLink = new BPortLink(input_port); } CardView::~CardView()