1 /*****************************************************************************/ 2 // OpenBeOS InputServer 3 // 4 // Version: [0.0.5] [Development Stage] 5 // 6 // [Description] 7 // 8 // 9 // This application and all source files used in its construction, except 10 // where noted, are licensed under the MIT License, and have been written 11 // and are: 12 // 13 // Copyright (c) 2002 OpenBeOS Project 14 // 15 // Permission is hereby granted, free of charge, to any person obtaining a 16 // copy of this software and associated documentation files (the "Software"), 17 // to deal in the Software without restriction, including without limitation 18 // the rights to use, copy, modify, merge, publish, distribute, sublicense, 19 // and/or sell copies of the Software, and to permit persons to whom the 20 // Software is furnished to do so, subject to the following conditions: 21 // 22 // The above copyright notice and this permission notice shall be included 23 // in all copies or substantial portions of the Software. 24 // 25 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 26 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 28 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 30 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 31 // DEALINGS IN THE SOFTWARE. 32 /*****************************************************************************/ 33 34 35 #include "InputServerDevice.h" 36 #include "InputServer.h" 37 38 /** 39 * Method: BInputServerDevice::BInputServerDevice() 40 * Descr: 41 */ 42 BInputServerDevice::BInputServerDevice() 43 { 44 } 45 46 47 /** 48 * Method: BInputServerDevice::~BInputServerDevice() 49 * Descr: 50 */ 51 BInputServerDevice::~BInputServerDevice() 52 { 53 } 54 55 56 /** 57 * Method: BInputServerDevice::InitCheck() 58 * Descr: 59 */ 60 status_t 61 BInputServerDevice::InitCheck() 62 { 63 return B_OK; 64 } 65 66 67 /** 68 * Method: BInputServerDevice::SystemShuttingDown() 69 * Descr: 70 */ 71 status_t 72 BInputServerDevice::SystemShuttingDown() 73 { 74 return B_OK; 75 } 76 77 78 /** 79 * Method: BInputServerDevice::Start() 80 * Descr: 81 */ 82 status_t 83 BInputServerDevice::Start(const char *device, 84 void *cookie) 85 { 86 return B_OK; 87 } 88 89 90 /** 91 * Method: BInputServerDevice::Stop() 92 * Descr: 93 */ 94 status_t 95 BInputServerDevice::Stop(const char *device, 96 void *cookie) 97 { 98 return B_OK; 99 } 100 101 102 /** 103 * Method: BInputServerDevice::Control() 104 * Descr: 105 */ 106 status_t 107 BInputServerDevice::Control(const char *device, 108 void *cookie, 109 uint32 code, 110 BMessage *message) 111 { 112 return B_OK; 113 } 114 115 116 /** 117 * Method: BInputServerDevice::RegisterDevices() 118 * Descr: 119 */ 120 status_t 121 BInputServerDevice::RegisterDevices(input_device_ref **devices) 122 { 123 /* 124 // Lock this section of code so that access to the device list 125 // is serialized. Be sure to release the lock before exitting. 126 // 127 InputServer::gInputDeviceListLocker.Lock(); 128 129 bool has_pointing_device = false; 130 bool has_keyboard_device = false; 131 132 input_device_ref *device = NULL; 133 for (int i = 0; NULL != (device = devices[i]); i++) 134 { 135 // :TODO: Check to make sure that each device is valid and 136 // that it is not already registered. 137 // getDeviceIndex() 138 139 InputServer::gInputDeviceList.AddItem(new InputDeviceListItem(this, device) ); 140 141 has_pointing_device = has_pointing_device || (device->type == B_POINTING_DEVICE); 142 has_keyboard_device = has_keyboard_device || (device->type == B_KEYBOARD_DEVICE); 143 } 144 145 // If the InputServer event loop is running, signal the InputServer 146 // to start all devices of the type managed by this InputServerDevice. 147 // 148 if (InputServer::EventLoopRunning() ) 149 { 150 if (has_pointing_device) 151 { 152 InputServer::StartStopDevices(NULL, B_POINTING_DEVICE, true); 153 } 154 if (has_keyboard_device) 155 { 156 InputServer::StartStopDevices(NULL, B_KEYBOARD_DEVICE, true); 157 } 158 } 159 160 InputServer::gInputDeviceListLocker.Unlock(); 161 */ 162 return B_OK; 163 } 164 165 166 /** 167 * Method: BInputServerDevice::UnregisterDevices() 168 * Descr: 169 */ 170 status_t 171 BInputServerDevice::UnregisterDevices(input_device_ref **devices) 172 { 173 status_t dummy; 174 175 return dummy; 176 } 177 178 179 /** 180 * Method: BInputServerDevice::EnqueueMessage() 181 * Descr: 182 */ 183 status_t 184 BInputServerDevice::EnqueueMessage(BMessage *message) 185 { 186 /* status_t err; 187 188 ssize_t length = message->FlattenedSize(); 189 char* buffer = new char[length]; 190 if ((err = message->Flatten(buffer,length)) < 0) { 191 } else { 192 if((write_port(mEventPort, 0, buffer, length)) < 0) { 193 194 }else { 195 free(buffer); 196 err = B_OK; 197 } 198 } 199 return err; 200 */ 201 return B_OK; 202 } 203 204 205 /** 206 * Method: BInputServerDevice::StartMonitoringDevice() 207 * Descr: 208 */ 209 status_t 210 BInputServerDevice::StartMonitoringDevice(const char *device) 211 { 212 status_t dummy; 213 214 return dummy; 215 } 216 217 218 /** 219 * Method: BInputServerDevice::StopMonitoringDevice() 220 * Descr: 221 */ 222 status_t 223 BInputServerDevice::StopMonitoringDevice(const char *device) 224 { 225 status_t dummy; 226 227 return dummy; 228 } 229 230 /** 231 ///////////////////////// Below this line is reserved functions ///////////////////////////// 232 */ 233 234 235 /** 236 * Method: BInputServerDevice::_ReservedInputServerDevice1() 237 * Descr: 238 */ 239 void 240 BInputServerDevice::_ReservedInputServerDevice1() 241 { 242 } 243 244 245 /** 246 * Method: BInputServerDevice::_ReservedInputServerDevice2() 247 * Descr: 248 */ 249 void 250 BInputServerDevice::_ReservedInputServerDevice2() 251 { 252 } 253 254 255 /** 256 * Method: BInputServerDevice::_ReservedInputServerDevice3() 257 * Descr: 258 */ 259 void 260 BInputServerDevice::_ReservedInputServerDevice3() 261 { 262 } 263 264 265 /** 266 * Method: BInputServerDevice::_ReservedInputServerDevice4() 267 * Descr: 268 */ 269 void 270 BInputServerDevice::_ReservedInputServerDevice4() 271 { 272 } 273 274 275