Reworked different build modes
Uncomment in Jamfile "#APPSERVER_TEST_MODE = 1 ;" to test app_server with input_server Uncomment in InputServer.h "//#define R5_CURSOR_COMM" to enable cursor comm when appserver BPortlink comm is used Default mode is R5 comm if TARGET != haiku and appserver BPortLink comm when TARGET = haiku For APPSERVER_TEST_MODE, make sure to change the ViewInputDevice path in AddOnManager.cpp To test with app_server, enable LaunchCursorThread() in AppServer.cpp and uncomment "#define INPUTSERVER_TEST_MODE 1" in ViewHWInterface.cpp Also make sure to change the input_server path in AppServer.cpp git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12493 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -73,10 +73,7 @@ AddOnManager::RegisterAddOn(BEntry &entry)
|
|||||||
return addon_image;
|
return addon_image;
|
||||||
}
|
}
|
||||||
|
|
||||||
BEntry parent;
|
BString pathString = path.Path();
|
||||||
entry.GetParent(&parent);
|
|
||||||
BPath parentPath(&parent);
|
|
||||||
BString pathString = parentPath.Path();
|
|
||||||
|
|
||||||
if (pathString.FindFirst("input_server/devices")>0) {
|
if (pathString.FindFirst("input_server/devices")>0) {
|
||||||
BInputServerDevice *(*instantiate_func)();
|
BInputServerDevice *(*instantiate_func)();
|
||||||
@@ -157,6 +154,9 @@ AddOnManager::RegisterAddOn(BEntry &entry)
|
|||||||
|
|
||||||
RegisterMethod(ism, ref, addon_image);
|
RegisterMethod(ism, ref, addon_image);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
PRINTERR(("AddOnManager::RegisterAddOn(): addon type not found for \"%s\" \n", path.Path()));
|
||||||
|
goto exit_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@@ -239,6 +239,9 @@ AddOnManager::UnregisterAddOn(BEntry &entry)
|
|||||||
void
|
void
|
||||||
AddOnManager::RegisterAddOns()
|
AddOnManager::RegisterAddOns()
|
||||||
{
|
{
|
||||||
|
CALLED();
|
||||||
|
status_t err;
|
||||||
|
|
||||||
class IAHandler : public AddOnMonitorHandler {
|
class IAHandler : public AddOnMonitorHandler {
|
||||||
private:
|
private:
|
||||||
AddOnManager * fManager;
|
AddOnManager * fManager;
|
||||||
@@ -268,6 +271,17 @@ AddOnManager::RegisterAddOns()
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
fHandler = new IAHandler(this);
|
||||||
|
fAddOnMonitor = new AddOnMonitor(fHandler);
|
||||||
|
|
||||||
|
#ifndef APPSERVER_TEST_MODE
|
||||||
|
err = fAddOnMonitor->InitCheck();
|
||||||
|
if (err != B_OK) {
|
||||||
|
PRINTERR(("AddOnManager::RegisterAddOns(): fAddOnMonitor->InitCheck() returned %s\n",
|
||||||
|
strerror(err)));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const directory_which directories[] = {
|
const directory_which directories[] = {
|
||||||
B_USER_ADDONS_DIRECTORY,
|
B_USER_ADDONS_DIRECTORY,
|
||||||
B_COMMON_ADDONS_DIRECTORY,
|
B_COMMON_ADDONS_DIRECTORY,
|
||||||
@@ -278,8 +292,6 @@ AddOnManager::RegisterAddOns()
|
|||||||
"input_server/filters",
|
"input_server/filters",
|
||||||
"input_server/methods"
|
"input_server/methods"
|
||||||
};
|
};
|
||||||
fHandler = new IAHandler(this);
|
|
||||||
fAddOnMonitor = new AddOnMonitor(fHandler);
|
|
||||||
|
|
||||||
node_ref nref;
|
node_ref nref;
|
||||||
BDirectory directory;
|
BDirectory directory;
|
||||||
@@ -294,6 +306,10 @@ AddOnManager::RegisterAddOns()
|
|||||||
fHandler->AddDirectory(&nref);
|
fHandler->AddDirectory(&nref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
BEntry entry("/boot/home/svnhaiku/trunk/tests/servers/input/view_input_device/input_server/devices/ViewInputDevice");
|
||||||
|
RegisterAddOn(entry);
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ InputServer::InputServer(void) : BApplication(INPUTSERVER_SIGNATURE),
|
|||||||
|
|
||||||
gDeviceManager.LoadState();
|
gDeviceManager.LoadState();
|
||||||
|
|
||||||
#ifdef USE_R5_STYLE_COMM
|
#ifdef R5_CURSOR_COMM
|
||||||
if (has_data(find_thread(NULL))) {
|
if (has_data(find_thread(NULL))) {
|
||||||
PRINT(("HasData == YES\n"));
|
PRINT(("HasData == YES\n"));
|
||||||
int32 buffer[2];
|
int32 buffer[2];
|
||||||
@@ -179,12 +179,13 @@ InputServer::InputServer(void) : BApplication(INPUTSERVER_SIGNATURE),
|
|||||||
if ((err = send_data(appThreadId, 0, buffer, sizeof(buffer)))!=B_OK)
|
if ((err = send_data(appThreadId, 0, buffer, sizeof(buffer)))!=B_OK)
|
||||||
PRINTERR(("error when send_data %s\n", strerror(err)));
|
PRINTERR(("error when send_data %s\n", strerror(err)));
|
||||||
}
|
}
|
||||||
#else
|
#endif
|
||||||
|
#ifdef APPSERVER_PORTLINK_COMM
|
||||||
port_id input_port = find_port(SERVER_INPUT_PORT);
|
port_id input_port = find_port(SERVER_INPUT_PORT);
|
||||||
if (input_port == B_NAME_NOT_FOUND)
|
if (input_port == B_NAME_NOT_FOUND)
|
||||||
PRINTERR(("input_server couldn't find app_server's input port\n"));
|
PRINTERR(("input_server couldn't find app_server's input port\n"));
|
||||||
fAppServerLink = new BPortLink(input_port);
|
fAppServerLink = new BPortLink(input_port);
|
||||||
#endif // USE_R5_STYLE_COMM
|
#endif
|
||||||
|
|
||||||
InitKeyboardMouseStates();
|
InitKeyboardMouseStates();
|
||||||
|
|
||||||
@@ -205,12 +206,12 @@ InputServer::~InputServer(void)
|
|||||||
fAddOnManager->Lock();
|
fAddOnManager->Lock();
|
||||||
fAddOnManager->Quit();
|
fAddOnManager->Quit();
|
||||||
|
|
||||||
#ifdef USE_R5_STYLE_COMM
|
#ifdef R5_CURSOR_COMM
|
||||||
delete_port(fAsPort);
|
delete_port(fAsPort);
|
||||||
fAsPort = -1;
|
fAsPort = -1;
|
||||||
fAppBuffer = NULL;
|
fAppBuffer = NULL;
|
||||||
delete_area(fCloneArea);
|
delete_area(fCloneArea);
|
||||||
#endif // USE_R5_STYLE_COMM
|
#endif // R5_CURSOR_COMM
|
||||||
|
|
||||||
#if DEBUG == 2
|
#if DEBUG == 2
|
||||||
fclose(sLogFile);
|
fclose(sLogFile);
|
||||||
@@ -765,7 +766,7 @@ InputServer::HandleSetMousePosition(BMessage *message, BMessage *outbound)
|
|||||||
case B_MOUSE_UP:
|
case B_MOUSE_UP:
|
||||||
case FAST_MOUSE_MOVED:
|
case FAST_MOUSE_MOVED:
|
||||||
// get point and button from msg
|
// get point and button from msg
|
||||||
if((outbound->FindInt32("x", &xValue) == B_OK)
|
if ((outbound->FindInt32("x", &xValue) == B_OK)
|
||||||
&& (outbound->FindInt32("y", &yValue) == B_OK)) {
|
&& (outbound->FindInt32("y", &yValue) == B_OK)) {
|
||||||
fMousePos.x += xValue;
|
fMousePos.x += xValue;
|
||||||
fMousePos.y -= yValue;
|
fMousePos.y -= yValue;
|
||||||
@@ -776,8 +777,14 @@ InputServer::HandleSetMousePosition(BMessage *message, BMessage *outbound)
|
|||||||
outbound->AddInt32("modifiers", fKey_info.modifiers);
|
outbound->AddInt32("modifiers", fKey_info.modifiers);
|
||||||
PRINT(("new position : %f, %f, %ld, %ld\n", fMousePos.x, fMousePos.y, xValue, yValue));
|
PRINT(("new position : %f, %f, %ld, %ld\n", fMousePos.x, fMousePos.y, xValue, yValue));
|
||||||
}
|
}
|
||||||
|
else if (outbound->FindPoint("where", &fMousePos) == B_OK) {
|
||||||
#ifdef USE_R5_STYLE_COMM
|
outbound->RemoveName("where");
|
||||||
|
fMousePos.ConstrainTo(fFrame);
|
||||||
|
outbound->AddPoint("where", fMousePos);
|
||||||
|
outbound->AddInt32("modifiers", fKey_info.modifiers);
|
||||||
|
PRINT(("new position : %f, %f\n", fMousePos.x, fMousePos.y));
|
||||||
|
}
|
||||||
|
#ifdef R5_CURSOR_COMM
|
||||||
if (fAppBuffer) {
|
if (fAppBuffer) {
|
||||||
fAppBuffer[0] =
|
fAppBuffer[0] =
|
||||||
(0x3 << 30)
|
(0x3 << 30)
|
||||||
@@ -1195,7 +1202,7 @@ InputServer::DispatchEvent(BMessage *message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef USE_R5_STYLE_COMM
|
#ifdef APPSERVER_PORTLINK_COMM
|
||||||
if (!fAppServerLink) {
|
if (!fAppServerLink) {
|
||||||
debugger("InputServer::DispatchEvent(): app_server link not valid\n");
|
debugger("InputServer::DispatchEvent(): app_server link not valid\n");
|
||||||
return false;
|
return false;
|
||||||
@@ -1214,7 +1221,7 @@ InputServer::DispatchEvent(BMessage *message)
|
|||||||
message->FindInt32("buttons",buttons);
|
message->FindInt32("buttons",buttons);
|
||||||
fAppServerLink->Attach(&buttons,sizeof(uint32));
|
fAppServerLink->Attach(&buttons,sizeof(uint32));
|
||||||
fAppServerLink->Flush();
|
fAppServerLink->Flush();
|
||||||
PRINT(("B_MOUSE_MOVED: x = %lu: y = %lu: time = %llu: buttons = %lu\n",pt.x,pt.y,time,buttons));
|
PRINT(("B_MOUSE_MOVED: x = %f: y = %f: time = %llu: buttons = %lu\n",pt.x,pt.y,time,buttons));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case B_MOUSE_DOWN:{
|
case B_MOUSE_DOWN:{
|
||||||
@@ -1388,7 +1395,7 @@ InputServer::DispatchEvent(BMessage *message)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // USE_R5_STYLE_COMM
|
#else // APPSERVER_PORTLINK_COMM
|
||||||
|
|
||||||
status_t err;
|
status_t err;
|
||||||
|
|
||||||
@@ -1400,7 +1407,7 @@ InputServer::DispatchEvent(BMessage *message)
|
|||||||
if (fAsPort>0)
|
if (fAsPort>0)
|
||||||
write_port(fAsPort, 0, buffer, length);
|
write_port(fAsPort, 0, buffer, length);
|
||||||
|
|
||||||
#endif // USE_R5_STYLE_COMM
|
#endif // APPSERVER_PORTLINK_COMM
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,13 +53,18 @@
|
|||||||
#include <Screen.h>
|
#include <Screen.h>
|
||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
|
#define APPSERVER_PORTLINK_COMM
|
||||||
|
//#define R5_CURSOR_COMM // define this when R5 cursor communication should be used
|
||||||
|
// #define APPSERVER_R5_COMM // define this when R5 app_server communication should be used
|
||||||
|
|
||||||
//#define USE_R5_STYLE_COMM
|
#define INPUTSERVER_SIGNATURE "application/x-vnd.Be-input_server" // use this when target should replace R5 input_server
|
||||||
// define this when R5 input_server communication should be used
|
|
||||||
|
|
||||||
#define INPUTSERVER_SIGNATURE "application/x-vnd.Be-input_server"
|
#ifdef APPSERVER_R5_COMM
|
||||||
|
#define R5_CURSOR_COMM
|
||||||
|
#undef APPSERVER_PORTLINK_COMM
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef USE_R5_STYLE_COMM
|
#ifdef APPSERVER_PORTLINK_COMM
|
||||||
class BPortLink;
|
class BPortLink;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -234,11 +239,11 @@ private:
|
|||||||
BottomlineWindow *fBLWindow;
|
BottomlineWindow *fBLWindow;
|
||||||
bool fIMAware;
|
bool fIMAware;
|
||||||
|
|
||||||
#ifndef USE_R5_STYLE_COMM
|
#ifdef APPSERVER_PORTLINK_COMM
|
||||||
// added this to communicate via portlink
|
// added this to communicate via portlink
|
||||||
BPortLink *fAppServerLink;
|
BPortLink *fAppServerLink;
|
||||||
#else
|
#endif
|
||||||
|
#ifdef R5_CURSOR_COMM
|
||||||
sem_id fCursorSem;
|
sem_id fCursorSem;
|
||||||
port_id fAsPort;
|
port_id fAsPort;
|
||||||
area_id fCloneArea;
|
area_id fCloneArea;
|
||||||
|
|||||||
@@ -36,7 +36,19 @@ UsePrivateHeaders input ;
|
|||||||
UsePrivateHeaders interface ;
|
UsePrivateHeaders interface ;
|
||||||
UsePrivateHeaders storage ;
|
UsePrivateHeaders storage ;
|
||||||
|
|
||||||
|
|
||||||
SubDirC++Flags -DADD_ON_STABLE_SECONDS=1 ; # for AddOnMonitorHandler.cpp
|
SubDirC++Flags -DADD_ON_STABLE_SECONDS=1 ; # for AddOnMonitorHandler.cpp
|
||||||
|
if $(TARGET_PLATFORM) != haiku {
|
||||||
|
SubDirC++Flags -DCOMPILE_FOR_R5 ;
|
||||||
|
#APPSERVER_TEST_MODE = 1 ;
|
||||||
|
if $(APPSERVER_TEST_MODE) {
|
||||||
|
SubDirC++Flags -DAPPSERVER_TEST_MODE ;
|
||||||
|
} else {
|
||||||
|
SubDirC++Flags -DAPPSERVER_R5_COMM ;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
APPSERVER_TEST_MODE = 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
Server input_server :
|
Server input_server :
|
||||||
InputServer.cpp
|
InputServer.cpp
|
||||||
@@ -64,12 +76,24 @@ Server input_server :
|
|||||||
: stdc++.r4
|
: stdc++.r4
|
||||||
;
|
;
|
||||||
|
|
||||||
if $(COMPILE_FOR_R5) {
|
if $(TARGET_PLATFORM) = haiku {
|
||||||
LinkSharedOSLibs input_server : be ;
|
# link for Haiku
|
||||||
|
|
||||||
|
LinkSharedOSLibs input_server :
|
||||||
|
libroot.so libbe.so ;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
LinkSharedOSLibs input_server : libroot.so libbe.so ;
|
# link as test application under R5
|
||||||
|
|
||||||
|
LinkSharedOSLibs input_server :
|
||||||
|
be ;
|
||||||
|
if $(APPSERVER_TEST_MODE) {
|
||||||
|
LinkSharedOSLibs input_server :
|
||||||
|
<boot!home!config!lib>libopenbeos.so ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SEARCH on [ FGristFiles AddOnMonitor.cpp
|
SEARCH on [ FGristFiles AddOnMonitor.cpp
|
||||||
AddOnMonitorHandler.cpp
|
AddOnMonitorHandler.cpp
|
||||||
NodeMonitorHandler.cpp ] += [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) kits storage ] ;
|
NodeMonitorHandler.cpp ] += [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) kits storage ] ;
|
||||||
|
|||||||
Reference in New Issue
Block a user