CGSWindow.h
1 /* 2 This file is part of Darling. 3 4 Copyright (C) 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 #ifndef CGSWINDOW_H 20 #define CGSWINDOW_H 21 #import <Foundation/NSObject.h> 22 #import <Foundation/NSDictionary.h> 23 #include <CoreGraphics/CoreGraphicsPrivate.h> 24 #include <stdatomic.h> 25 26 @class CGSSurface; 27 @class CGSConnection; 28 29 @interface CGSWindow : NSObject { 30 CGSConnection* _connection; 31 CGSWindowID _windowId; 32 _Atomic CGSSurfaceID _nextSurfaceId; 33 NSMutableDictionary<NSNumber*, CGSSurface*>* _surfaces; 34 } 35 36 -(instancetype) initWithRegion:(CGSRegionRef) region 37 connection:(CGSConnection*) connection 38 windowID:(CGSWindowID) windowID; 39 -(void) dealloc; 40 -(CGSSurface*) surfaceForId:(CGSSurfaceID) surfaceId; 41 42 -(CGError) orderWindow:(CGSWindowOrderingMode) place relativeTo:(CGSWindow*) window; 43 -(CGError) moveTo:(const CGPoint*) point; 44 -(CGError) setRegion:(CGSRegionRef) region; 45 -(CGError) getRect:(CGRect*) outRect; 46 -(CGError) setProperty:(CFStringRef) key value:(CFTypeRef) value; 47 -(CGError) getProperty:(CFStringRef) key value:(CFTypeRef*) value; 48 -(void) invalidate; 49 50 // Used, for example, by CGWindowContextCreate() 51 -(void*) nativeWindow; 52 -(CGSSurface*) createSurface; 53 54 @property (readonly) CGSWindowID windowId; 55 56 -(void) _surfaceInvalidated:(CGSSurfaceID) surfaceId; 57 58 @end 59 60 #endif