From de79eb2a1ce7541b26c1b31826041b0fbe1660a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Thu, 19 Aug 2004 11:43:20 +0000 Subject: [PATCH] code clean up, added addon monitoring code from storage kit git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8608 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/input/InputServer.FileTypes.rsrc | Bin 6411 -> 0 bytes src/servers/input/InputServer.cpp | 92 +++++++++++-------- src/servers/input/Jamfile | 13 ++- src/servers/input/input_server.rsrc | Bin 4272 -> 0 bytes 4 files changed, 68 insertions(+), 37 deletions(-) delete mode 100644 src/servers/input/InputServer.FileTypes.rsrc delete mode 100644 src/servers/input/input_server.rsrc diff --git a/src/servers/input/InputServer.FileTypes.rsrc b/src/servers/input/InputServer.FileTypes.rsrc deleted file mode 100644 index 0ca0bbd53741d4ea6e035e322f34d71360616f00..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6411 zcmeHL&2AD=6h33A77#5ZcABn8bmM{w8W-(mQd%Gw+96ES#KcIj9b=P*5~NLcn#@DE zbgRUL3!lKHZ!nMGQ;gp^cYZ+VhPFx5%po(Jx!?J}e>1mb5z(T#ox$HWUw3hvfmoNI z`*%*+_@F7Cn>`S>UkBgQiN5&0e%vEUC^z(Tg#QKp+Z_eGNkx2ullB!7*%AH`c-Ul0 zEaMjN@a3~K5B`Zr5IqI|*ykJImwf*12+vK|S%=vE^^LK(wsCFaF%XY|n=l4=d**AN zg8}ij$~^B&t(R-XwHIJ!q_S;Vd9jiI{k^olUMf5<7K{0^ov(KfPWru*erI4G&S?DR zt9_1Zdi9+Y*YwJ38jsT}FR6Mr=lAm)Mx1FB(tmk-9vQCdh7x3q6A2ti1dnJDG7KWc zIpPGk$h6?wxio_2D4SfH&BH`mI69wylQ@Thv8f8b4 zl$-!$4MT^(&~+V64{_Ee(h0Y07A6!P>I?k> z$4?`KYROy)B;xt6D&j9Z@%)cgu6X`Ov*@y1Fe8JR=yFW#y zY!~d~_x8Dca60I`JGQA*Hmmp+Ukc8EHL9BB5^A5rC5>olHaEF9_?!J9l`E#TvDs|4 ztBuW?C5?PmJpphZGVS}?{NW~)+dqX-f{j_4^9WoFfD w#1%>7N~z|(*Ud_>>v^@BCE?r$?gw41H!5uwQuX9>{z)VV=hN3$e;`2r0GcV2(f|Me diff --git a/src/servers/input/InputServer.cpp b/src/servers/input/InputServer.cpp index 3629baca1d..f616bc5c11 100644 --- a/src/servers/input/InputServer.cpp +++ b/src/servers/input/InputServer.cpp @@ -43,6 +43,14 @@ #include #include +#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 + #include "InputServerDeviceListEntry.h" #include "InputServerFilterListEntry.h" #include "InputServerMethodListEntry.h" @@ -59,7 +67,7 @@ extern "C" void RegisterDevices(input_device_ref** devices) { - printf("RegisterDevices\n"); + CALLED(); }; @@ -94,6 +102,7 @@ int main() */ InputServer::InputServer(void) : BApplication("application/x-vnd.OBOS-input_server") { + CALLED(); void *pointer=NULL; EventLoop(pointer); @@ -111,6 +120,7 @@ InputServer::InputServer(void) : BApplication("application/x-vnd.OBOS-input_serv */ InputServer::~InputServer(void) { + CALLED(); } @@ -121,10 +131,11 @@ InputServer::~InputServer(void) void InputServer::ArgvReceived(int32 argc, char** argv) { + CALLED(); if (2 == argc) { if (0 == strcmp("-q", argv[1]) ) { // :TODO: Shutdown and restart the InputServer. - printf("InputServer::ArgvReceived - Restarting . . .\n"); + printf("InputServer::ArgvReceived - Restarting ...\n"); status_t quit_status; //BMessenger msgr = BMessenger("application/x-vnd.OpenBeOS-input_server", -1, &quit_status); BMessenger msgr = BMessenger("application/x-vnd.OBOS-input_server", -1, &quit_status); @@ -146,6 +157,7 @@ InputServer::ArgvReceived(int32 argc, char** argv) void InputServer::InitKeyboardMouseStates(void) { + CALLED(); // This is where we read in the preferences data for the mouse and keyboard as well as // determine the screen resolution from the app_server and find the center of the screen // sMousePos is then set to the center of the screen. @@ -158,7 +170,8 @@ InputServer::InitKeyboardMouseStates(void) void InputServer::InitTestDevice() { - printf("InputServer::InitTestDevice - Enter\n"); + CALLED(); + const char* path = "/boot/home/Projects/InputServer/ISD/nervous/nervous"; printf("InputServer::InitTestDevice - Loading add-on . . .\n"); image_id addon_image = load_add_on(path); @@ -199,7 +212,7 @@ InputServer::InitTestDevice() //unload_add_on(addon_image); } } - printf("InputServer::InitTestDevice - Exit\n"); + EXIT(); } /* @@ -209,6 +222,8 @@ InputServer::InitTestDevice() void InputServer::InitDevices(void) { + CALLED(); + BDirectory dir; BPath addon_dir; BPath addon_path; @@ -221,8 +236,6 @@ InputServer::InitDevices(void) }; const int addon_dir_count = sizeof(addon_dirs) / sizeof(directory_which); - printf("InputServer::InitDevices - Enter\n"); - // Find all Input Server Devices in each of the predefined // addon directories. // @@ -240,7 +253,7 @@ InputServer::InitDevices(void) } } } - printf("InputServer::InitDevices - Exit\n"); + EXIT(); } @@ -296,6 +309,8 @@ InputServer::AddInputServerDevice(const char* path) void InputServer::InitFilters(void) { + CALLED(); + BDirectory dir; BPath addon_dir; BPath addon_path; @@ -308,8 +323,6 @@ InputServer::InitFilters(void) }; const int addon_dir_count = sizeof(addon_dirs) / sizeof(directory_which); - printf("InputServer::InitFilters - Enter\n"); - // Find all Input Filters in each of the predefined // addon directories. // @@ -327,7 +340,7 @@ InputServer::InitFilters(void) } } } - printf("InputServer::InitFilters - Exit\n"); + EXIT(); } @@ -383,6 +396,8 @@ InputServer::AddInputServerFilter(const char* path) void InputServer::InitMethods(void) { + CALLED(); + BDirectory dir; BPath addon_dir; BPath addon_path; @@ -395,8 +410,6 @@ InputServer::InitMethods(void) }; const int addon_dir_count = sizeof(addon_dirs) / sizeof(directory_which); - printf("InputServer::InitMethods - Enter\n"); - // Find all Input Methods in each of the predefined // addon directories. // @@ -414,7 +427,7 @@ InputServer::InitMethods(void) } } } - printf("InputServer::InitMethods - Exit\n"); + EXIT(); } @@ -470,6 +483,8 @@ InputServer::AddInputServerMethod(const char* path) bool InputServer::QuitRequested(void) { + CALLED(); + kill_thread(ISPortThread); delete_port(EventLooperPort); EventLooperPort = -1; @@ -490,6 +505,7 @@ InputServer::QuitRequested(void) // --------------------------------------------------------------- void InputServer::ReadyToRun(void) { + CALLED(); } @@ -500,6 +516,8 @@ void InputServer::ReadyToRun(void) void InputServer::MessageReceived(BMessage *message) { + CALLED(); + BMessage *reply = NULL; switch(message->what) @@ -610,7 +628,7 @@ InputServer::MessageReceived(BMessage *message) break;*/ default: { - printf("Default message . . .\n"); + PRINT(("Default message ...\n")); BMessenger app_server("application/x-vnd.Be-APPS", -1, NULL); if (app_server.IsValid()) { //app_server->SendMessage(message); @@ -762,7 +780,7 @@ InputServer::HandleSetMousePosition(BMessage *message, BMessage *outbound) yValue; message->FindInt32("x",xValue); - printf("[HandleSetMousePosition] x = %lu:\n",xValue); + PRINT(("[HandleSetMousePosition] x = %lu:\n",xValue)); switch(message->what){ case B_MOUSE_MOVED:{ @@ -1039,7 +1057,7 @@ const BMessenger* InputServer::MethodReplicant(void) status_t InputServer::EventLoop(void *) { - printf("Starting event loop . . .\n"); + CALLED(); EventLooperPort = create_port(100, "obos_is_event_port"); if(EventLooperPort < 0) { _sPrintf("OBOS InputServer: create_port error: (0x%x) %s\n",EventLooperPort,strerror(EventLooperPort)); @@ -1079,13 +1097,15 @@ InputServer::DispatchEvents(BList *eventList) int InputServer::DispatchEvent(BMessage *message) { + CALLED(); + // variables int32 xValue, yValue; uint32 buttons = 0; message->FindInt32("x",xValue); - printf("[DispatchEvent] x = %lu:\n",xValue); + PRINT(("[DispatchEvent] x = %lu:\n", xValue)); port_id pid = find_port(SERVER_INPUT_PORT); BPortLink *appsvrlink = new BPortLink(pid); @@ -1101,7 +1121,7 @@ int InputServer::DispatchEvent(BMessage *message) message->FindInt32("buttons",buttons); appsvrlink->Attach(&buttons,sizeof(int32)); appsvrlink->Flush(); - printf("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",xValue,yValue,time,buttons)); } break; } @@ -1412,19 +1432,19 @@ status_t InputServer::StartStopDevices(const char* deviceName, input_device_type deviceType, bool doStart) { - printf("StartStopDevice: Enter\n"); + CALLED(); for (int i = gInputDeviceList.CountItems() - 1; i >= 0; i--) { - printf("Device #%d\n", i); + PRINT(("Device #%d\n", i)); InputDeviceListItem* item = (InputDeviceListItem*)gInputDeviceList.ItemAt(i); if (NULL != item) { BInputServerDevice* isd = item->mIsd; input_device_ref* dev = item->mDev; - printf("Hey\n"); + PRINT(("Hey\n")); if ( (NULL != isd) && (NULL != dev) ) { - printf(" Starting/stopping: %s\n", dev->name); + PRINT((" Starting/stopping: %s\n", dev->name)); if (deviceType == dev->type) { if (doStart) isd->Start(dev->name, dev->cookie); @@ -1433,7 +1453,7 @@ status_t InputServer::StartStopDevices(const char* deviceName, } } } - printf("StartStopDevice: Exit\n"); + EXIT(); return B_OK; } @@ -1452,7 +1472,7 @@ status_t InputServer::ControlDevices(const char* deviceName, for (int i = gInputDeviceList.CountItems() - 1; i >= 0; i--) { - printf("ControlDevice #%d\n", i); + PRINT(("ControlDevice #%d\n", i)); InputDeviceListItem* item = (InputDeviceListItem*)gInputDeviceList.ItemAt(i); if (NULL != item) { @@ -1460,7 +1480,7 @@ status_t InputServer::ControlDevices(const char* deviceName, input_device_ref* dev = item->mDev; if ( (NULL != isd) && (NULL != dev) ) { - printf(" Controlling: %s\n", dev->name); + PRINT((" Controlling: %s\n", dev->name)); if (deviceType == dev->type) { // :TODO: Descriminate based on Device Name also. @@ -1553,7 +1573,7 @@ void InputServer::WatchPort() // Block until we find the size of the next message length = port_buffer_size(EventLooperPort); buffer = (char*)malloc(length); - printf("[Event Looper] BMessage Size = %lu\n", length); + PRINT(("[Event Looper] BMessage Size = %lu\n", length)); //event = NULL; BMessage *event = new BMessage(); err = read_port(EventLooperPort, &code, buffer, length); @@ -1563,20 +1583,20 @@ void InputServer::WatchPort() } else { printf("InputServer: read_port error: (0x%lx) %s\n",err,strerror(err)); } - }else{ + } else { if ((err = event->Unflatten(buffer)) < 0) { printf("[InputServer] Unflatten() error: (0x%lx) %s\n",err,strerror(err)); } else { - // This is where the message should be processed. - event->PrintToStream(); - - HandleSetMousePosition(event, event); - - DispatchEvent(event); - - //printf("Event writen to port\n"); - delete(event); + // This is where the message should be processed. + PRINT_OBJECT(*event); + + HandleSetMousePosition(event, event); + + DispatchEvent(event); + + PRINT(("Event writen to port\n")); + delete(event); } } diff --git a/src/servers/input/Jamfile b/src/servers/input/Jamfile index 7db111703f..54c28285ab 100644 --- a/src/servers/input/Jamfile +++ b/src/servers/input/Jamfile @@ -4,11 +4,22 @@ AddResources input_server : input_server.rdef ; UsePrivateHeaders app ; UsePrivateHeaders input ; +UsePrivateHeaders storage ; Server input_server : InputServer.cpp InputServerDevice.cpp InputServerFilter.cpp InputServerMethod.cpp + + # storage + AddOnMonitor.cpp + AddOnMonitorHandler.cpp + NodeMonitorHandler.cpp + + : be libopenbeos.so ; -LinkSharedOSLibs input_server : be root libopenbeos.so ; + +SEARCH on [ FGristFiles AddOnMonitor.cpp + AddOnMonitorHandler.cpp + NodeMonitorHandler.cpp ] += [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) kits storage ] ; diff --git a/src/servers/input/input_server.rsrc b/src/servers/input/input_server.rsrc deleted file mode 100644 index 4b8d6e92401a81fc0390830e198f6ca79c46ad0e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4272 zcmeHL&1xD^6h2eav??~42$_(Tv}>&vx=1#cn5YcID47t_l~^;SLNH=Y2wfHCEehSY zQfQx{Z!s@W=%#N_?D@{Uj#`tAG$j;|%*>hledqVy%glJ_5z%UG?*U)-a4hp_4uLJP z?T?uD@!HZlhKDQ|zYYD%3ehii4F8|Gh$S6{zOw%Dp1wIr@YMh(k67p2ASZ15SgZ7w z^(RLE!1|ieak7yfT=Z7h1b=*4cUK38C6PAU2| zFC#uO-#!(#whGy2`FuW8^fPX!b>8cq_nLkGbWZ1Y-|XF@r+1%-~&`lIaO zkW?6k5rfpUkicWc=$1!Blp@kvAVC-pjF{md5JoT%+>YWSECQ<#K7xV9hqe}p!(8RS z8VrN$N;K>+oN$B@SY%HWDK#-*E9Ed@5Qc%}L^!O89O9F0vkQ$!_5$m`U@$!3q9Xqq zPCCwp6vmkWwrpe1a6l^Q;3uhZm9V}JP9zcfW>`Ys2q))*)kcDU4q~G()0rbt#o0TF z8RtVnCX7qZW?^1Rm`!0s&ZD}e`DmT^xXzjxJk<=thfZzU8U$DiNlv4tMl;JPNE$K; zGuC4oQsp`(2L7!&+Ha%XV0NI{N@0j4Wh&vZc%YQ*4^ElFCF_cNFl?UWu+q&4KnH8(6?r{d)96> z`|b12)2r-d=QLOJv+YjzqThJq_b&Y&UCZ##Uinvk>!RO$dFE5OR>WgH&4+xGT2!vr zcksx^u|maC&D-9o*Bj;ior)(tKxW5=gim05Ogb(ddT#9?q8-$BU7sm2K2|ktf7?6S zYq-0UtX;PX7QUekt2)c_s%~}kN|G9f^xO&|3%t1`^zhM(dMQewQt`wL|3Db$Wp}^S P0BKy$&-dTAm_WY)mdSLy