コード例 #1
0
        public unsafe EvdevVirtualMouse()
        {
            Device = new EvdevDevice("OpenTabletDriver Virtual Mouse");

            Device.EnableTypeCodes(
                EventType.EV_REL,
                EventCode.REL_X,
                EventCode.REL_Y
                );

            Device.EnableTypeCodes(
                EventType.EV_KEY,
                EventCode.BTN_LEFT,
                EventCode.BTN_MIDDLE,
                EventCode.BTN_RIGHT,
                EventCode.BTN_FORWARD,
                EventCode.BTN_BACK);

            var result = Device.Initialize();

            switch (result)
            {
            case ERRNO.NONE:
                Log.Debug("Evdev", $"Successfully initialized virtual mouse. (code {result})");
                break;

            default:
                Log.Write("Evdev", $"Failed to initialize virtual mouse. (error code {result})", LogLevel.Error);
                break;
            }
        }
コード例 #2
0
        public unsafe EvdevVirtualTablet()
        {
            Device = new EvdevDevice("OpenTabletDriver Virtual Artist Tablet");

            Device.EnableType(EventType.INPUT_PROP_DIRECT);
            Device.EnableType(EventType.EV_ABS);

            var xAbs = new input_absinfo
            {
                maximum    = Max,
                resolution = 100
            };
            input_absinfo *xPtr = &xAbs;

            Device.EnableCustomCode(EventType.EV_ABS, EventCode.ABS_X, (IntPtr)xPtr);

            var yAbs = new input_absinfo
            {
                maximum    = Max,
                resolution = 100
            };
            input_absinfo *yPtr = &yAbs;

            Device.EnableCustomCode(EventType.EV_ABS, EventCode.ABS_Y, (IntPtr)yPtr);

            var pressure = new input_absinfo
            {
                maximum = MaxPressure
            };
            input_absinfo *pressurePtr = &pressure;

            Device.EnableCustomCode(EventType.EV_ABS, EventCode.ABS_PRESSURE, (IntPtr)pressurePtr);

            Device.EnableTypeCodes(
                EventType.EV_KEY,
                EventCode.BTN_TOUCH,
                EventCode.BTN_STYLUS,
                EventCode.BTN_TOOL_PEN,
                EventCode.BTN_STYLUS2,
                EventCode.BTN_STYLUS3
                );

            var result = Device.Initialize();

            switch (result)
            {
            case ERRNO.NONE:
                Log.Debug("Evdev", $"Successfully initialized virtual pressure sensitive tablet. (code {result})");
                break;

            default:
                Log.Write("Evdev", $"Failed to initialize virtual pressure sensitive tablet. (error code {result})", LogLevel.Error);
                break;
            }
        }
コード例 #3
0
        public EvdevKeyboardHandler()
        {
            Device = new EvdevDevice("OpenTabletDriver Virtual Keyboard");

            Device.EnableTypeCodes(EventType.EV_KEY, XKeysymToEventCode.Values.Distinct().ToArray());

            var result = Device.Initialize();

            if (result != 0)
            {
                Log.Write("Evdev", $"Failed to initialize virtual keyboard. (error code {result})", true);
            }
        }
コード例 #4
0
        public EvdevKeyboardHandler()
        {
            Device = new EvdevDevice("OpenTabletDriver Virtual Keyboard");

            Device.EnableTypeCodes(EventType.EV_KEY, EtoKeysymToEventCode.Values.Distinct().ToArray());

            var result = Device.Initialize();

            switch (result)
            {
            case ERRNO.NONE:
                Log.Debug($"Successfully initialized virtual keyboard. (code {result})");
                break;

            default:
                Log.Write("Evdev", $"Failed to initialize virtual keyboard. (error code {result})", true);
                break;
            }
        }
コード例 #5
0
        public unsafe EvdevAbsolutePointer()
        {
            Device = new EvdevDevice("OpenTabletDriver Virtual Tablet");

            Device.EnableType(EventType.EV_ABS);

            var xAbs = new input_absinfo
            {
                maximum = (int)DesktopInterop.VirtualScreen.Width
            };
            input_absinfo *xPtr = &xAbs;

            Device.EnableCustomCode(EventType.EV_ABS, EventCode.ABS_X, (IntPtr)xPtr);

            var yAbs = new input_absinfo
            {
                maximum = (int)DesktopInterop.VirtualScreen.Height
            };
            input_absinfo *yPtr = &yAbs;

            Device.EnableCustomCode(EventType.EV_ABS, EventCode.ABS_Y, (IntPtr)yPtr);

            Device.EnableTypeCodes(
                EventType.EV_KEY,
                EventCode.BTN_LEFT,
                EventCode.BTN_MIDDLE,
                EventCode.BTN_RIGHT,
                EventCode.BTN_FORWARD,
                EventCode.BTN_BACK);

            var result = Device.Initialize();

            switch (result)
            {
            case ERRNO.NONE:
                Log.Debug("Evdev", $"Successfully initialized virtual tablet. (code {result})");
                break;

            default:
                Log.Write("Evdev", $"Failed to initialize virtual tablet. (error code {result})", LogLevel.Error);
                break;
            }
        }
コード例 #6
0
        public unsafe EvdevCursorHandler()
        {
            Device = new EvdevDevice("OpenTabletDriver Virtual Pointer");

            Device.EnableType(EventType.EV_ABS);

            var xAbs = new input_absinfo
            {
                maximum = (int)Platform.VirtualScreen.Width
            };
            input_absinfo *xPtr = &xAbs;

            Device.EnableCustomCode(EventType.EV_ABS, EventCode.ABS_X, (IntPtr)xPtr);

            var yAbs = new input_absinfo
            {
                maximum = (int)Platform.VirtualScreen.Height
            };
            input_absinfo *yPtr = &yAbs;

            Device.EnableCustomCode(EventType.EV_ABS, EventCode.ABS_Y, (IntPtr)yPtr);

            Device.EnableTypeCodes(
                EventType.EV_KEY,
                EventCode.BTN_LEFT,
                EventCode.BTN_MIDDLE,
                EventCode.BTN_RIGHT,
                EventCode.BTN_FORWARD,
                EventCode.BTN_BACK);

            var result = Device.Initialize();

            if (result != 0)
            {
                Log.Write("Evdev", $"Failed to initialize virtual pointer. (error code {result})", true);
            }
        }