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 status_t dummy; 64 65 return dummy; 66 } 67 68 69 /** 70 * Method: BInputServerDevice::SystemShuttingDown() 71 * Descr: 72 */ 73 status_t 74 BInputServerDevice::SystemShuttingDown() 75 { 76 status_t dummy; 77 78 return dummy; 79 } 80 81 82 /** 83 * Method: BInputServerDevice::Start() 84 * Descr: 85 */ 86 status_t 87 BInputServerDevice::Start(const char *device, 88 void *cookie) 89 { 90 status_t dummy; 91 92 return dummy; 93 } 94 95 96 /** 97 * Method: BInputServerDevice::Stop() 98 * Descr: 99 */ 100 status_t 101 BInputServerDevice::Stop(const char *device, 102 void *cookie) 103 { 104 status_t dummy; 105 106 return dummy; 107 } 108 109 110 /** 111 * Method: BInputServerDevice::Control() 112 * Descr: 113 */ 114 status_t 115 BInputServerDevice::Control(const char *device, 116 void *cookie, 117 uint32 code, 118 BMessage *message) 119 { 120 status_t dummy; 121 122 return dummy; 123 } 124 125 126 /** 127 * Method: BInputServerDevice::RegisterDevices() 128 * Descr: 129 */ 130 status_t 131 BInputServerDevice::RegisterDevices(input_device_ref **devices) 132 { 133 /* 134 // Lock this section of code so that access to the device list 135 // is serialized. Be sure to release the lock before exitting. 136 // 137 InputServer::gInputDeviceListLocker.Lock(); 138 139 bool has_pointing_device = false; 140 bool has_keyboard_device = false; 141 142 input_device_ref *device = NULL; 143 for (int i = 0; NULL != (device = devices[i]); i++) 144 { 145 // :TODO: Check to make sure that each device is valid and 146 // that it is not already registered. 147 // getDeviceIndex() 148 149 InputServer::gInputDeviceList.AddItem(new InputDeviceListItem(this, device) ); 150 151 has_pointing_device = has_pointing_device || (device->type == B_POINTING_DEVICE); 152 has_keyboard_device = has_keyboard_device || (device->type == B_KEYBOARD_DEVICE); 153 } 154 155 // If the InputServer event loop is running, signal the InputServer 156 // to start all devices of the type managed by this InputServerDevice. 157 // 158 if (InputServer::EventLoopRunning() ) 159 { 160 if (has_pointing_device) 161 { 162 InputServer::StartStopDevices(NULL, B_POINTING_DEVICE, true); 163 } 164 if (has_keyboard_device) 165 { 166 InputServer::StartStopDevices(NULL, B_KEYBOARD_DEVICE, true); 167 } 168 } 169 170 InputServer::gInputDeviceListLocker.Unlock(); 171 */ 172 return B_OK; 173 } 174 175 176 /** 177 * Method: BInputServerDevice::UnregisterDevices() 178 * Descr: 179 */ 180 status_t 181 BInputServerDevice::UnregisterDevices(input_device_ref **devices) 182 { 183 status_t dummy; 184 185 return dummy; 186 } 187 188 189 /** 190 * Method: BInputServerDevice::EnqueueMessage() 191 * Descr: 192 */ 193 status_t 194 BInputServerDevice::EnqueueMessage(BMessage *message) 195 { 196 /* status_t err; 197 198 ssize_t length = message->FlattenedSize(); 199 char* buffer = new char[length]; 200 if ((err = message->Flatten(buffer,length)) < 0) { 201 } else { 202 if((write_port(mEventPort, 0, buffer, length)) < 0) { 203 204 }else { 205 free(buffer); 206 err = B_OK; 207 } 208 } 209 return err; 210 */ 211 return B_OK; 212 } 213 214 215 /** 216 * Method: BInputServerDevice::StartMonitoringDevice() 217 * Descr: 218 */ 219 status_t 220 BInputServerDevice::StartMonitoringDevice(const char *device) 221 { 222 status_t dummy; 223 224 return dummy; 225 } 226 227 228 /** 229 * Method: BInputServerDevice::StopMonitoringDevice() 230 * Descr: 231 */ 232 status_t 233 BInputServerDevice::StopMonitoringDevice(const char *device) 234 { 235 status_t dummy; 236 237 return dummy; 238 } 239 240 /** 241 ///////////////////////// Below this line is reserved functions ///////////////////////////// 242 */ 243 244 245 /** 246 * Method: BInputServerDevice::_ReservedInputServerDevice1() 247 * Descr: 248 */ 249 void 250 BInputServerDevice::_ReservedInputServerDevice1() 251 { 252 } 253 254 255 /** 256 * Method: BInputServerDevice::_ReservedInputServerDevice2() 257 * Descr: 258 */ 259 void 260 BInputServerDevice::_ReservedInputServerDevice2() 261 { 262 } 263 264 265 /** 266 * Method: BInputServerDevice::_ReservedInputServerDevice3() 267 * Descr: 268 */ 269 void 270 BInputServerDevice::_ReservedInputServerDevice3() 271 { 272 } 273 274 275 /** 276 * Method: BInputServerDevice::_ReservedInputServerDevice4() 277 * Descr: 278 */ 279 void 280 BInputServerDevice::_ReservedInputServerDevice4() 281 { 282 } 283 284 285