virtual void init() { if (mInotifyFd == -1) { mInotifyFd = inotify_init1(IN_CLOEXEC); if (mInotifyFd == -1) { rtLogWarn("hotplug disabled: %s", getSystemError(errno).c_str()); } else { rtLogDebug("initializing inotify, adding watch: %s", kDevInput); mWatchFd = inotify_add_watch(mInotifyFd, kDevInput, (IN_DELETE | IN_CREATE)); if (mWatchFd == -1) { rtLogWarn("hotplug disabled: %s", getSystemError(errno).c_str()); } else { rtLogDebug("adding change notify descriptor: %d to poll list", mInotifyFd); pollfd p; p.fd = mInotifyFd; p.events = (POLLIN | POLLERR); p.revents = 0; mFds.push_back(p); } } } registerDevices(getKeyboardDevices()); registerDevices(getMouseDevices()); }
// // ISDL12InputSubsystem::initMouse // void ISDL12InputSubsystem::initMouse(int id) { shutdownMouse(0); const std::vector<IInputDeviceInfo> devices = getMouseDevices(); std::string device_name; for (std::vector<IInputDeviceInfo>::const_iterator it = devices.begin(); it != devices.end(); ++it) { if (it->mId == id) device_name = it->mDeviceName; } Printf(PRINT_HIGH, "I_InitInput: intializing %s\n", device_name.c_str()); if (id == SDL_MOUSE_DRIVER) setMouseInputDevice(new ISDL12MouseInputDevice(id)); #ifdef USE_RAW_WIN32_MOUSE else if (id == RAW_WIN32_MOUSE_DRIVER) setMouseInputDevice(new IRawWin32MouseInputDevice(id)); #endif assert(getMouseInputDevice() != NULL); registerInputDevice(getMouseInputDevice()); getMouseInputDevice()->resume(); }