/ CoreGraphics / X11.backend / CGSConnectionX11.h
CGSConnectionX11.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  
20  #ifndef CGSCONNECTIONX11_H
21  #define CGSCONNECTIONX11_H
22  #import <CoreGraphics/CGSConnection.h>
23  #import <X11/Xlib.h>
24  #import <CoreFoundation/CFRunLoop.h>
25  #import <CoreFoundation/CFSocket.h>
26  
27  @interface CGSConnectionX11 : CGSConnection {
28  	Display *_display;
29  	// We use CFRunLoop directly, without going through any Foundation wrapper,
30      // because Apple's Cocoa has none. Unlike Apple's Cocoa, we need to watch
31      // over a Unix domain socket, not a Mach port.
32      CFSocketRef _cfSocket;
33      CFRunLoopSourceRef _source;
34  
35  	// NOTE: A CGSScreen refers to a 'crtc' in X11 paralance, and *not* to an X11 screen.
36  	// In other words, it refers to a physical monitor.
37  	NSArray<CGSScreen*>* _screens;
38  
39  	CGSKeyboardLayout* _keyboardLayout;
40  	int _keyboardLayoutGroup;
41  
42  	int _xkbEventBase;
43  	int _xrrEventBase;
44  }
45  
46  -(instancetype) initWithConnectionID:(CGSConnectionID)connId;
47  -(void) dealloc;
48  -(CGSWindow*) newWindow:(CGSRegionRef)region;
49  
50  -(void) processPendingEvents;
51  
52  +(BOOL) isAvailable;
53  
54  @end
55  
56  #endif
57