CSInput.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //
  2. // Copyright © 2019 osy. All rights reserved.
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. //
  16. #import <Foundation/Foundation.h>
  17. #import "UTMRenderSource.h"
  18. @import CoreGraphics;
  19. typedef struct _SpiceSession SpiceSession;
  20. typedef NS_ENUM(NSInteger, CSInputKey) {
  21. kCSInputKeyPress,
  22. kCSInputKeyRelease
  23. };
  24. typedef NS_OPTIONS(NSUInteger, CSInputButton) {
  25. kCSInputButtonNone = 0,
  26. kCSInputButtonLeft = (1 << 0),
  27. kCSInputButtonMiddle = (1 << 1),
  28. kCSInputButtonRight = (1 << 2)
  29. };
  30. typedef NS_ENUM(NSInteger, CSInputScroll) {
  31. kCSInputScrollUp,
  32. kCSInputScrollDown,
  33. kCSInputScrollSmooth
  34. };
  35. NS_ASSUME_NONNULL_BEGIN
  36. @interface CSInput : NSObject
  37. @property (nonatomic, readonly, assign) BOOL serverModeCursor;
  38. @property (nonatomic, assign) BOOL disableInputs;
  39. - (void)sendKey:(CSInputKey)type code:(int)scancode;
  40. - (void)sendPause:(CSInputKey)type;
  41. - (void)releaseKeys;
  42. - (void)sendMouseMotion:(CSInputButton)button point:(CGPoint)point;
  43. - (void)sendMouseMotion:(CSInputButton)button point:(CGPoint)point forMonitorID:(NSInteger)monitorID;
  44. - (void)sendMouseScroll:(CSInputScroll)type button:(CSInputButton)button dy:(CGFloat)dy;
  45. - (void)sendMouseButton:(CSInputButton)button pressed:(BOOL)pressed point:(CGPoint)point;
  46. - (void)requestMouseMode:(BOOL)server;
  47. - (instancetype)init NS_UNAVAILABLE;
  48. - (instancetype)initWithSession:(SpiceSession *)session NS_DESIGNATED_INITIALIZER;
  49. @end
  50. NS_ASSUME_NONNULL_END