added file debug output for daemon mode

added some R5 app_server communication init


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9112 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2004-09-29 15:42:47 +00:00
parent 8b41e11557
commit 33140fa001
3 changed files with 67 additions and 28 deletions
+1 -1
View File
@@ -253,7 +253,7 @@ AddOnManager::RegisterAddOns()
const directory_which directories[] = { const directory_which directories[] = {
B_USER_ADDONS_DIRECTORY, B_USER_ADDONS_DIRECTORY,
B_COMMON_ADDONS_DIRECTORY, B_COMMON_ADDONS_DIRECTORY,
// B_BEOS_ADDONS_DIRECTORY B_BEOS_ADDONS_DIRECTORY
}; };
const char subDirectories[][24] = { const char subDirectories[][24] = {
"input_server/devices", "input_server/devices",
+41 -18
View File
@@ -31,7 +31,6 @@
#include <stdio.h> #include <stdio.h>
#include <Debug.h>
#include <Directory.h> #include <Directory.h>
#include <Entry.h> #include <Entry.h>
#include <File.h> #include <File.h>
@@ -40,6 +39,7 @@
#include <Message.h> #include <Message.h>
#include <Path.h> #include <Path.h>
#include <String.h> #include <String.h>
#include <OS.h>
#include "InputServer.h" #include "InputServer.h"
#include "InputServerTypes.h" #include "InputServerTypes.h"
@@ -74,6 +74,10 @@ BLocker InputServer::gInputMethodListLocker;
DeviceManager InputServer::gDeviceManager; DeviceManager InputServer::gDeviceManager;
#if DEBUG == 2
FILE *InputServer::sLogFile = NULL;
#endif
/* /*
* *
*/ */
@@ -94,6 +98,11 @@ int main()
InputServer::InputServer(void) : BApplication(INPUTSERVER_SIGNATURE), InputServer::InputServer(void) : BApplication(INPUTSERVER_SIGNATURE),
sSafeMode(false) sSafeMode(false)
{ {
#if DEBUG == 2
if (sLogFile == NULL)
sLogFile = fopen("/var/log/input_server.log", "a");
#endif
CALLED(); CALLED();
void *pointer=NULL; void *pointer=NULL;
@@ -111,6 +120,20 @@ InputServer::InputServer(void) : BApplication(INPUTSERVER_SIGNATURE),
fAddOnManager = new AddOnManager(SafeMode()); fAddOnManager = new AddOnManager(SafeMode());
fAddOnManager->LoadState(); fAddOnManager->LoadState();
if (has_data(find_thread(NULL))) {
PRINT(("HasData == YES\n"));
uint32 buffer[2];
memset(buffer, 0, sizeof(buffer));
int32 code = receive_data(&fAppThreadId, buffer, sizeof(buffer));
PRINT(("tid : %ld, code :%ld\n", fAppThreadId, code));
for (int32 i=0; i<2; i++) {
PRINT(("data : %lx\n", buffer[i]));
}
fCursorSem = buffer[0];
fAppArea = buffer[1];
}
} }
/* /*
@@ -121,6 +144,9 @@ InputServer::~InputServer(void)
{ {
CALLED(); CALLED();
delete fAddOnManager; delete fAddOnManager;
#if DEBUG == 2
fclose(sLogFile);
#endif
} }
@@ -137,7 +163,6 @@ InputServer::ArgvReceived(int32 argc, char** argv)
// :TODO: Shutdown and restart the InputServer. // :TODO: Shutdown and restart the InputServer.
printf("InputServer::ArgvReceived - Restarting ...\n"); printf("InputServer::ArgvReceived - Restarting ...\n");
status_t quit_status; status_t quit_status;
//BMessenger msgr = BMessenger("application/x-vnd.OpenBeOS-input_server", -1, &quit_status);
BMessenger msgr = BMessenger(INPUTSERVER_SIGNATURE, -1, &quit_status); BMessenger msgr = BMessenger(INPUTSERVER_SIGNATURE, -1, &quit_status);
if (B_OK == quit_status) { if (B_OK == quit_status) {
BMessage msg = BMessage(B_QUIT_REQUESTED); BMessage msg = BMessage(B_QUIT_REQUESTED);
@@ -313,6 +338,8 @@ InputServer::MessageReceived(BMessage *message)
BMessage reply; BMessage reply;
status_t status = B_OK; status_t status = B_OK;
PRINT(("%s what:%c%c%c%c\n", __PRETTY_FUNCTION__, message->what>>24, message->what>>16, message->what>>8, message->what));
switch(message->what) switch(message->what)
{ {
case IS_SET_METHOD: case IS_SET_METHOD:
@@ -416,7 +443,7 @@ InputServer::MessageReceived(BMessage *message)
default: default:
{ {
PRINT(("Default message ... \n")); PRINT(("Default message ... \n"));
PRINT_OBJECT(*message); //PRINT_OBJECT(*message);
BMessenger app_server("application/x-vnd.Be-APPS", -1, NULL); BMessenger app_server("application/x-vnd.Be-APPS", -1, NULL);
if (app_server.IsValid()) { if (app_server.IsValid()) {
//app_server->SendMessage(message); //app_server->SendMessage(message);
@@ -630,9 +657,6 @@ InputServer::HandleSetMousePosition(BMessage *message, BMessage *outbound)
ASSERT(outbound == message); ASSERT(outbound == message);
fMousePos.x = 200;
fMousePos.y = 200;
int32 xValue, yValue; int32 xValue, yValue;
message->FindInt32("x",xValue); message->FindInt32("x",xValue);
@@ -1079,7 +1103,7 @@ InputServer::DispatchEvents(BList *eventList)
CacheEvents(eventList); CacheEvents(eventList);
if (fEventsCache.CountItems()>50) { if (fEventsCache.CountItems()>5) {
BMessage *event; BMessage *event;
@@ -1105,10 +1129,6 @@ InputServer::DispatchEvent(BMessage *message)
// variables // variables
int32 xValue, int32 xValue,
yValue; yValue;
uint32 buttons = 0;
message->FindInt32("x",xValue);
PRINT(("[DispatchEvent] x = %lu:\n", xValue));
port_id pid = find_port(SERVER_INPUT_PORT); port_id pid = find_port(SERVER_INPUT_PORT);
@@ -1118,18 +1138,21 @@ InputServer::DispatchEvent(BMessage *message)
BPortLink *appsvrlink = new BPortLink(pid); BPortLink *appsvrlink = new BPortLink(pid);
switch(message->what){ switch(message->what){
case B_MOUSE_MOVED:{ case B_MOUSE_MOVED:{
// get point and button from msg uint32 buttons;
if((message->FindInt32(X_VALUE,&xValue) == B_OK) && (message->FindInt32(Y_VALUE,&yValue) == B_OK)){ BPoint pt;
message->FindPoint("where",&pt);
// get point and button from msg
//if((message->FindInt32(X_VALUE,&xValue) == B_OK) && (message->FindInt32(Y_VALUE,&yValue) == B_OK)){
int64 time=(int64)real_time_clock(); int64 time=(int64)real_time_clock();
appsvrlink->StartMessage(B_MOUSE_MOVED); appsvrlink->StartMessage(B_MOUSE_MOVED);
appsvrlink->Attach(&time,sizeof(int64)); appsvrlink->Attach(&time,sizeof(int64));
appsvrlink->Attach((float)xValue); appsvrlink->Attach(&pt.x,sizeof(float));
appsvrlink->Attach((float)yValue); appsvrlink->Attach(&pt.y,sizeof(float));
message->FindInt32("buttons",buttons); message->FindInt32("buttons",buttons);
appsvrlink->Attach(&buttons,sizeof(int32)); appsvrlink->Attach(&buttons,sizeof(uint32));
appsvrlink->Flush(); appsvrlink->Flush();
PRINT(("B_MOUSE_MOVED: x = %lu: y = %lu: time = %llu: buttons = %lu\n",xValue,yValue,time,buttons)); PRINT(("B_MOUSE_MOVED: x = %lu: y = %lu: time = %llu: buttons = %lu\n",pt.x,pt.y,time,buttons));
} // }
break; break;
} }
case B_MOUSE_DOWN:{ case B_MOUSE_DOWN:{
+25 -9
View File
@@ -31,6 +31,7 @@
// BeAPI Headers // BeAPI Headers
#include <Application.h> #include <Application.h>
#include <Debug.h>
#include <InputServerDevice.h> #include <InputServerDevice.h>
#include <InputServerFilter.h> #include <InputServerFilter.h>
#include <InputServerMethod.h> #include <InputServerMethod.h>
@@ -44,7 +45,6 @@
#include <unistd.h> #include <unistd.h>
#include <Locker.h> #include <Locker.h>
#include <Debug.h>
#include <FindDirectory.h> #include <FindDirectory.h>
#include <InterfaceDefs.h> #include <InterfaceDefs.h>
#include <Message.h> #include <Message.h>
@@ -53,14 +53,6 @@
#define INPUTSERVER_SIGNATURE "application/x-vnd.OBOS-input_server" #define INPUTSERVER_SIGNATURE "application/x-vnd.OBOS-input_server"
#if DEBUG>=1
#define EXIT() printf("EXIT %s\n", __PRETTY_FUNCTION__)
#define CALLED() printf("CALLED %s\n", __PRETTY_FUNCTION__)
#else
#define EXIT() ((void)0)
#define CALLED() ((void)0)
#endif
class BPortLink; class BPortLink;
class InputDeviceListItem class InputDeviceListItem
@@ -215,7 +207,31 @@ private:
BList fEventsCache; BList fEventsCache;
//fMouseState; //fMouseState;
sem_id fCursorSem;
area_id fAppArea;
area_id fCloneArea;
void *fAppBuffer;
thread_id fAppThreadId;
#if DEBUG == 2
public:
static FILE *sLogFile;
#endif
}; };
#if DEBUG>=1
#if DEBUG == 2
#undef PRINT
inline void _iprint(const char *fmt, ...) { char buf[1024]; va_list ap; va_start(ap, fmt); vsprintf(buf, fmt, ap); va_end(ap); \
fputs(buf, InputServer::sLogFile); fflush(InputServer::sLogFile); }
#define PRINT(x) _iprint x
#endif
#define EXIT() PRINT(("EXIT %s\n", __PRETTY_FUNCTION__))
#define CALLED() PRINT(("CALLED %s\n", __PRETTY_FUNCTION__))
#else
#define EXIT() ((void)0)
#define CALLED() ((void)0)
#endif
#endif #endif