internal WispStylusDevice UpdateStylusDevices(int stylusId) { // REENTRANCY NOTE: Use PenThread to talk to wisptis.exe to make sure we are not reentrant! // PenImc will cache all the stylus device info so we don't have // any Out of Proc calls to wisptis.exe to get this info. StylusDeviceInfo[] stylusDevicesInfo = _penThread.WorkerRefreshCursorInfo(_tabletInfo.PimcTablet.Value); int cCursors = stylusDevicesInfo.Length; if (cCursors > StylusDevices.Count) { for (int iCursor = 0; iCursor < cCursors; iCursor++) { StylusDeviceInfo stylusDeviceInfo = stylusDevicesInfo[iCursor]; // See if we found it. If so go and create the new StylusDevice and add it. if (stylusDeviceInfo.CursorId == stylusId) { WispStylusDevice newStylusDevice = new WispStylusDevice( this, stylusDeviceInfo.CursorName, stylusDeviceInfo.CursorId, stylusDeviceInfo.CursorInverted, stylusDeviceInfo.ButtonCollection); StylusDevices.AddStylusDevice(iCursor, newStylusDevice); return(newStylusDevice); } } } return(null); // Nothing to add }
internal WispTabletDevice(TabletDeviceInfo tabletInfo, PenThread penThread) : base(tabletInfo) { _penThread = penThread; int count = tabletInfo.StylusDevicesInfo.Length; WispStylusDevice[] styluses = new WispStylusDevice[count]; for (int i = 0; i < count; i++) { StylusDeviceInfo cursorInfo = tabletInfo.StylusDevicesInfo[i]; styluses[i] = new WispStylusDevice( this, cursorInfo.CursorName, cursorInfo.CursorId, cursorInfo.CursorInverted, cursorInfo.ButtonCollection); } _stylusDeviceCollection = new StylusDeviceCollection(styluses); // We only create a TabletDevice when one is connected (physically or virtually). // So we can log the connection in the constructor. StylusTraceLogger.LogDeviceConnect( new StylusTraceLogger.StylusDeviceInfo( Id, Name, ProductId, TabletHardwareCapabilities, TabletSize, ScreenSize, _tabletInfo.DeviceType, StylusDevices.Count)); }
internal TabletDevice(TabletDeviceInfo tabletInfo, PenThread penThread) { _tabletInfo = tabletInfo; _penThread = penThread; int count = tabletInfo.StylusDevicesInfo.Length; StylusDevice[] styluses = new StylusDevice[count]; for (int i = 0; i < count; i++) { StylusDeviceInfo cursorInfo = tabletInfo.StylusDevicesInfo[i]; styluses[i] = new StylusDevice( this, cursorInfo.CursorName, cursorInfo.CursorId, cursorInfo.CursorInverted, cursorInfo.ButtonCollection); } _stylusDeviceCollection = new StylusDeviceCollection(styluses); if (_tabletInfo.DeviceType == TabletDeviceType.Touch) { // _multiTouchSystemGestureLogic = new MultiTouchSystemGestureLogic(); } }
///////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// internal WispTabletDevice(TabletDeviceInfo tabletInfo, PenThread penThread) : base(tabletInfo) { _penThread = penThread; // Constructing a WispTabletDevice means we will actually use this tablet for input purposes. // Lock the tablet and underlying WISP tablet at this point. // This is balanced in DisposeOrDeferDisposal. _penThread.WorkerAcquireTabletLocks(tabletInfo.PimcTablet.Value, tabletInfo.WispTabletKey); int count = tabletInfo.StylusDevicesInfo.Length; WispStylusDevice[] styluses = new WispStylusDevice[count]; for (int i = 0; i < count; i++) { StylusDeviceInfo cursorInfo = tabletInfo.StylusDevicesInfo[i]; styluses[i] = new WispStylusDevice( this, cursorInfo.CursorName, cursorInfo.CursorId, cursorInfo.CursorInverted, cursorInfo.ButtonCollection); } _stylusDeviceCollection = new StylusDeviceCollection(styluses); // We only create a TabletDevice when one is connected (physically or virtually). // So we can log the connection in the constructor. StylusTraceLogger.LogDeviceConnect( new StylusTraceLogger.StylusDeviceInfo( Id, Name, ProductId, TabletHardwareCapabilities, TabletSize, ScreenSize, _tabletInfo.DeviceType, StylusDevices.Count)); }
private static StylusDeviceInfo[] GetStylusDevicesInfo(IPimcTablet pimcTablet) { int cCursors; pimcTablet.GetCursorCount(out cCursors); // Calls Unmanaged code - SecurityCritical with SUC. StylusDeviceInfo[] stylusDevicesInfo = new StylusDeviceInfo[cCursors]; for ( int iCursor = 0; iCursor < cCursors; iCursor++ ) { string sCursorName; int cursorId; bool fCursorInverted; pimcTablet.GetCursorInfo(iCursor, out sCursorName, out cursorId, out fCursorInverted); // Calls Unmanaged code - SecurityCritical with SUC. int cButtons; pimcTablet.GetCursorButtonCount(iCursor, out cButtons); // Calls Unmanaged code - SecurityCritical with SUC. StylusButton[] buttons = new StylusButton[cButtons]; for ( int iButton = 0; iButton < cButtons; iButton++ ) { string sButtonName; Guid buttonGuid; pimcTablet.GetCursorButtonInfo(iCursor, iButton, out sButtonName, out buttonGuid); // Calls Unmanaged code - SecurityCritical with SUC. buttons[iButton] = new StylusButton(sButtonName, buttonGuid); } StylusButtonCollection buttonCollection = new StylusButtonCollection(buttons); stylusDevicesInfo[iCursor].CursorName = sCursorName; stylusDevicesInfo[iCursor].CursorId = cursorId; stylusDevicesInfo[iCursor].CursorInverted = fCursorInverted; stylusDevicesInfo[iCursor].ButtonCollection = buttonCollection; } return stylusDevicesInfo; }