-
Notifications
You must be signed in to change notification settings - Fork 4
/
PMManagedWindow.h
115 lines (100 loc) · 3.46 KB
/
PMManagedWindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/**
* Étoilé ProjectManager - PMDecoratedWindow.h
*
* Copyright (C) 2009 David Chisnall
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
**/
#import <XCBKit/XCBWindow.h>
#import <XCBKit/ICCCM.h>
typedef enum _PMManagedWindowState
{
/**
* The managed window is waiting on the child to move
* to the available state so that it can figure out
* mapping behaviour.
*/
PMManagedWindowPendingState,
/**
* An "unknown" state, where the managed window is
* waiting for all the child properties to be cached
* before transitioning into the withdrawn/iconic/normal
* states
*/
PMManagedWindowWaitingOnPropertiesState,
PMManagedWindowWithdrawnState,
PMManagedWindowIconicState,
PMManagedWindowNormalState
} PMManagedWindowState;
@protocol PMManagedWindowDecorator;
@protocol PMManagedWindowDelegate;
@interface PMManagedWindow : NSObject {
id<PMManagedWindowDelegate> delegate;
XCBWindow *child;
XCBWindow *decorationWindow;
PMManagedWindowState state;
// The decoration strategy aka the "decorator"
NSObject<PMManagedWindowDecorator> *decorator;
// Pending events to be processed
NSArray* pendingEvents;
BOOL has_focus;
// Fields used during map and unmap transitions
NSMutableSet *pendingWindowProperties;
BOOL ignoreUnmap;
BOOL reparented;
// Fields used during window moving and resizing
XCBPoint mouseDownPosition;
XCBRect mouseDownClientFrame;
int moveresizeType;
// Fields used during focus
BOOL input_hint;
BOOL wm_take_focus;
// Other fields
XCBPoint refPoint;
icccm_wm_size_hints_t wm_size_hints;
xcb_window_t window_group;
int16_t req_border_width;
// Shape caching
BOOL shapedBounding, shapedClip;
}
- (id)initWithChildWindow: (XCBWindow*)win pendingEvents: (NSArray*)pending;
- (XCBWindow*)childWindow;
- (XCBWindow*)decorationWindow;
- (void)setDelegate: (id<PMManagedWindowDelegate>)delegate;
- (void)establishInactiveGrabs;
- (void)releaseInactiveGrabs;
/**
* Gets the outermost window managed
* by this object. It is the decoration
* window when the object is decorated, and
* the child window when there is
* no decoration window
*/
- (XCBWindow*)outermostWindow;
- (BOOL)hasFocus;
@end
@protocol PMManagedWindowDelegate
@optional
- (void)managedWindowWithdrawn: (PMManagedWindow*)managedWindow;
- (void)managedWindowDestroyed: (PMManagedWindow*)managedWindow;
- (void)managedWindowDidMap: (PMManagedWindow*)managedWindow;
@required
- (NSArray*)managedWindowDecorators: (PMManagedWindow*)managedWindow;
@end