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:
parent
01d2dcc52b
commit
1f04728a75
@ -73,10 +73,7 @@ AddOnManager::RegisterAddOn(BEntry &entry)
|
||||
return addon_image;
|
||||
}
|
||||
|
||||
BEntry parent;
|
||||
entry.GetParent(&parent);
|
||||
BPath parentPath(&parent);
|
||||
BString pathString = parentPath.Path();
|
||||
BString pathString = path.Path();
|
||||
|
||||
if (pathString.FindFirst("input_server/devices")>0) {
|
||||
BInputServerDevice *(*instantiate_func)();
|
||||
@ -157,6 +154,9 @@ AddOnManager::RegisterAddOn(BEntry &entry)
|
||||
|
||||
RegisterMethod(ism, ref, addon_image);
|
||||
|
||||
} else {
|
||||
PRINTERR(("AddOnManager::RegisterAddOn(): addon type not found for \"%s\" \n", path.Path()));
|
||||
goto exit_error;
|
||||
}
|
||||
|
||||
return B_OK;
|
||||
@ -239,6 +239,9 @@ AddOnManager::UnregisterAddOn(BEntry &entry)
|
||||
void
|
||||
AddOnManager::RegisterAddOns()
|
||||
{
|
||||
CALLED();
|
||||
status_t err;
|
||||
|
||||
class IAHandler : public AddOnMonitorHandler {
|
||||
private:
|
||||
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[] = {
|
||||
B_USER_ADDONS_DIRECTORY,
|
||||
B_COMMON_ADDONS_DIRECTORY,
|
||||
@ -278,8 +292,6 @@ AddOnManager::RegisterAddOns()
|
||||
"input_server/filters",
|
||||
"input_server/methods"
|
||||
};
|
||||
fHandler = new IAHandler(this);
|
||||
fAddOnMonitor = new AddOnMonitor(fHandler);
|
||||
|
||||
node_ref nref;
|
||||
BDirectory directory;
|
||||
@ -294,6 +306,10 @@ AddOnManager::RegisterAddOns()
|
||||
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();
|
||||
|
||||
#ifdef USE_R5_STYLE_COMM
|
||||
#ifdef R5_CURSOR_COMM
|
||||
if (has_data(find_thread(NULL))) {
|
||||
PRINT(("HasData == YES\n"));
|
||||
int32 buffer[2];
|
||||
@ -179,12 +179,13 @@ InputServer::InputServer(void) : BApplication(INPUTSERVER_SIGNATURE),
|
||||
if ((err = send_data(appThreadId, 0, buffer, sizeof(buffer)))!=B_OK)
|
||||
PRINTERR(("error when send_data %s\n", strerror(err)));
|
||||
}
|
||||
#else
|
||||
#endif
|
||||
#ifdef APPSERVER_PORTLINK_COMM
|
||||
port_id input_port = find_port(SERVER_INPUT_PORT);
|
||||
if (input_port == B_NAME_NOT_FOUND)
|
||||
PRINTERR(("input_server couldn't find app_server's input port\n"));
|
||||
fAppServerLink = new BPortLink(input_port);
|
||||
#endif // USE_R5_STYLE_COMM
|
||||
#endif
|
||||
|
||||
InitKeyboardMouseStates();
|
||||
|
||||
@ -205,12 +206,12 @@ InputServer::~InputServer(void)
|
||||
fAddOnManager->Lock();
|
||||
fAddOnManager->Quit();
|
||||
|
||||
#ifdef USE_R5_STYLE_COMM
|
||||
#ifdef R5_CURSOR_COMM
|
||||
delete_port(fAsPort);
|
||||
fAsPort = -1;
|
||||
fAppBuffer = NULL;
|
||||
delete_area(fCloneArea);
|
||||
#endif // USE_R5_STYLE_COMM
|
||||
#endif // R5_CURSOR_COMM
|
||||
|
||||
#if DEBUG == 2
|
||||
fclose(sLogFile);
|
||||
@ -765,7 +766,7 @@ InputServer::HandleSetMousePosition(BMessage *message, BMessage *outbound)
|
||||
case B_MOUSE_UP:
|
||||
case FAST_MOUSE_MOVED:
|
||||
// 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)) {
|
||||
fMousePos.x += xValue;
|
||||
fMousePos.y -= yValue;
|
||||
@ -776,9 +777,15 @@ InputServer::HandleSetMousePosition(BMessage *message, BMessage *outbound)
|
||||
outbound->AddInt32("modifiers", fKey_info.modifiers);
|
||||
PRINT(("new position : %f, %f, %ld, %ld\n", fMousePos.x, fMousePos.y, xValue, yValue));
|
||||
}
|
||||
|
||||
#ifdef USE_R5_STYLE_COMM
|
||||
if (fAppBuffer) {
|
||||
else if (outbound->FindPoint("where", &fMousePos) == B_OK) {
|
||||
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) {
|
||||
fAppBuffer[0] =
|
||||
(0x3 << 30)
|
||||
| ((uint32)fMousePos.x & 0x7fff) << 15
|
||||
@ -1195,7 +1202,7 @@ InputServer::DispatchEvent(BMessage *message)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef USE_R5_STYLE_COMM
|
||||
#ifdef APPSERVER_PORTLINK_COMM
|
||||
if (!fAppServerLink) {
|
||||
debugger("InputServer::DispatchEvent(): app_server link not valid\n");
|
||||
return false;
|
||||
@ -1214,7 +1221,7 @@ InputServer::DispatchEvent(BMessage *message)
|
||||
message->FindInt32("buttons",buttons);
|
||||
fAppServerLink->Attach(&buttons,sizeof(uint32));
|
||||
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;
|
||||
}
|
||||
case B_MOUSE_DOWN:{
|
||||
@ -1388,7 +1395,7 @@ InputServer::DispatchEvent(BMessage *message)
|
||||
|
||||
}
|
||||
|
||||
#else // USE_R5_STYLE_COMM
|
||||
#else // APPSERVER_PORTLINK_COMM
|
||||
|
||||
status_t err;
|
||||
|
||||
@ -1400,7 +1407,7 @@ InputServer::DispatchEvent(BMessage *message)
|
||||
if (fAsPort>0)
|
||||
write_port(fAsPort, 0, buffer, length);
|
||||
|
||||
#endif // USE_R5_STYLE_COMM
|
||||
#endif // APPSERVER_PORTLINK_COMM
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -53,13 +53,18 @@
|
||||
#include <Screen.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 this when R5 input_server communication should be used
|
||||
#define INPUTSERVER_SIGNATURE "application/x-vnd.Be-input_server" // use this when target should replace R5 input_server
|
||||
|
||||
#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;
|
||||
#endif
|
||||
|
||||
@ -234,16 +239,16 @@ private:
|
||||
BottomlineWindow *fBLWindow;
|
||||
bool fIMAware;
|
||||
|
||||
#ifndef USE_R5_STYLE_COMM
|
||||
#ifdef APPSERVER_PORTLINK_COMM
|
||||
// added this to communicate via portlink
|
||||
BPortLink *fAppServerLink;
|
||||
#else
|
||||
|
||||
#endif
|
||||
#ifdef R5_CURSOR_COMM
|
||||
sem_id fCursorSem;
|
||||
port_id fAsPort;
|
||||
area_id fCloneArea;
|
||||
uint32 *fAppBuffer;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if DEBUG == 2
|
||||
public:
|
||||
|
@ -36,7 +36,19 @@ UsePrivateHeaders input ;
|
||||
UsePrivateHeaders interface ;
|
||||
UsePrivateHeaders storage ;
|
||||
|
||||
|
||||
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 :
|
||||
InputServer.cpp
|
||||
@ -64,12 +76,24 @@ Server input_server :
|
||||
: stdc++.r4
|
||||
;
|
||||
|
||||
if $(COMPILE_FOR_R5) {
|
||||
LinkSharedOSLibs input_server : be ;
|
||||
if $(TARGET_PLATFORM) = haiku {
|
||||
# link for Haiku
|
||||
|
||||
LinkSharedOSLibs input_server :
|
||||
libroot.so libbe.so ;
|
||||
|
||||
} 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
|
||||
AddOnMonitorHandler.cpp
|
||||
NodeMonitorHandler.cpp ] += [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) kits storage ] ;
|
||||
|
Loading…
Reference in New Issue
Block a user