/ CoreGraphics / include / CoreGraphics / CGRemoteOperation.h
CGRemoteOperation.h
 1  /*
 2   This file is part of Darling.
 3  
 4   Copyright (C) 2019-2020 Lubos Dolezel
 5  
 6   Darling is free software: you can redistribute it and/or modify
 7   it under the terms of the GNU General Public License as published by
 8   the Free Software Foundation, either version 3 of the License, or
 9   (at your option) any later version.
10  
11   Darling is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15  
16   You should have received a copy of the GNU General Public License
17   along with Darling.  If not, see <http://www.gnu.org/licenses/>.
18  */
19  
20  #ifndef CGREMOTEOPERATION_H
21  #define CGREMOTEOPERATION_H
22  
23  #import <CoreGraphics/CGGeometry.h>
24  
25  #include <CoreGraphics/CGError.h>
26  #include <stdint.h>
27  
28  typedef CGError CGEventErr;
29  typedef uint32_t CGButtonCount;
30  typedef uint32_t CGWheelCount;
31  typedef uint16_t CGCharCode;
32  typedef uint16_t CGKeyCode;
33  typedef uint32_t CGRectCount;
34  
35  typedef CF_OPTIONS(uint32_t, CGEventFilterMask) {
36      kCGEventFilterMaskPermitLocalMouseEvents = 0x00000001,
37      kCGEventFilterMaskPermitLocalKeyboardEvents = 0x00000002,
38      kCGEventFilterMaskPermitSystemDefinedEvents = 0x00000004
39  };
40  
41  typedef CF_ENUM(uint32_t, CGEventSuppressionState) {
42      kCGEventSuppressionStateSuppressionInterval = 0,
43      kCGEventSuppressionStateRemoteMouseDrag,
44      kCGNumberOfEventSuppressionStates
45  };
46  
47  typedef CF_OPTIONS(uint32_t, CGScreenUpdateOperation) {
48      kCGScreenUpdateOperationRefresh                    =        0,
49      kCGScreenUpdateOperationMove                       = 1u <<  0,
50      kCGScreenUpdateOperationReducedDirtyRectangleCount = 1u << 31,
51  };
52  
53  typedef struct CGScreenUpdateMoveDelta {
54      int32_t dX, dY;
55  } CGScreenUpdateMoveDelta;
56  
57  typedef void (*CGScreenUpdateMoveCallback)(CGScreenUpdateMoveDelta delta, size_t count, const CGRect *rects, void *userInfo);
58  typedef void (*CGScreenRefreshCallback)(uint32_t count, const CGRect *rects, void *userInfo);
59  
60  #define kCGEventFilterMaskPermitAllEvents (kCGEventFilterMaskPermitLocalMouseEvents | kCGEventFilterMaskPermitLocalKeyboardEvents | kCGEventFilterMaskPermitSystemDefinedEvents)
61  
62  // TODO: All those deprecated functions
63  extern CGError CGScreenRegisterMoveCallback(CGScreenUpdateMoveCallback callback, void *userInfo);
64  extern void CGScreenUnregisterMoveCallback(CGScreenUpdateMoveCallback callback, void *userInfo);
65  
66  CGError CGRegisterScreenRefreshCallback(CGScreenRefreshCallback callback, void *userInfo);
67  void CGUnregisterScreenRefreshCallback(CGScreenRefreshCallback callback, void *userInfo);
68  CGError CGWaitForScreenRefreshRects(CGRect * _Nullable *rects, uint32_t *count);
69  void CGReleaseScreenRefreshRects(CGRect *rects);
70  CGError CGWaitForScreenUpdateRects(CGScreenUpdateOperation requestedOperations, CGScreenUpdateOperation *currentOperation, CGRect * _Nullable *rects, size_t *rectCount, CGScreenUpdateMoveDelta *delta);
71  
72  #endif