2
* Copyright © 2008 Dennis Kasprzyk
3
* Copyright © 2007 Novell, Inc.
5
* Permission to use, copy, modify, distribute, and sell this software
6
* and its documentation for any purpose is hereby granted without
7
* fee, provided that the above copyright notice appear in all copies
8
* and that both that copyright notice and this permission notice
9
* appear in supporting documentation, and that the name of
10
* Dennis Kasprzyk not be used in advertising or publicity pertaining to
11
* distribution of the software without specific, written prior permission.
12
* Dennis Kasprzyk makes no representations about the suitability of this
13
* software for any purpose. It is provided "as is" without express or
16
* DENNIS KASPRZYK DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
18
* NO EVENT SHALL DENNIS KASPRZYK BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
20
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
21
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
22
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
24
* Authors: Dennis Kasprzyk <onestone@compiz-fusion.org>
25
* David Reveman <davidr@novell.com>
28
#ifndef _PRIVATEWINDOW_H
29
#define _PRIVATEWINDOW_H
31
#include <core/core.h>
32
#include <core/window.h>
33
#include <core/point.h>
34
#include <core/timer.h>
35
#include "privatescreen.h"
37
#define WINDOW_INVISIBLE(w) \
38
((w)->attrib.map_state != IsViewable || \
39
(w)->attrib.x + (w)->width + (w)->output.right <= 0 || \
40
(w)->attrib.y + (w)->height + (w)->output.bottom <= 0 || \
41
(w)->attrib.x - (w)->output.left >= (int) screen->width () || \
42
(w)->attrib.y - (w)->output.top >= (int) screen->height () )
44
typedef CompWindowExtents CompFullscreenMonitorSet;
49
PrivateWindow (CoreWindow *window);
52
void recalcNormalHints ();
54
void updateFrameWindow ();
56
void setWindowMatrix ();
58
bool restack (Window aboveId);
60
bool initializeSyncCounter ();
62
bool isGroupTransient (Window clientLeader);
64
static bool stackLayerCheck (CompWindow *w,
68
static bool avoidStackingRelativeTo (CompWindow *w);
70
static CompWindow * findSiblingBelow (CompWindow *w,
73
static CompWindow * findLowestSiblingBelow (CompWindow *w);
75
static bool validSiblingBelow (CompWindow *w,
78
void saveGeometry (int mask);
80
int restoreGeometry (XWindowChanges *xwc, int mask);
82
void reconfigureXWindow (unsigned int valueMask,
85
static bool stackTransients (CompWindow *w,
88
CompWindowList &updateList);
90
static void stackAncestors (CompWindow *w,
92
CompWindowList &updateList);
94
static bool isAncestorTo (CompWindow *transient,
95
CompWindow *ancestor);
97
Window getClientLeaderOfAncestor ();
99
CompWindow * getModalTransient ();
101
int addWindowSizeChanges (XWindowChanges *xwc,
102
CompWindow::Geometry old);
104
int addWindowStackChanges (XWindowChanges *xwc,
105
CompWindow *sibling);
107
static CompWindow * findValidStackSiblingBelow (CompWindow *w,
108
CompWindow *sibling);
110
void ensureWindowVisibility ();
114
static void revealAncestors (CompWindow *w,
115
CompWindow *transient);
117
static void minimizeTransients (CompWindow *w,
118
CompWindow *ancestor);
120
static void unminimizeTransients (CompWindow *w,
121
CompWindow *ancestor);
123
bool getUsageTimestamp (Time& timestamp);
125
bool isWindowFocusAllowed (Time timestamp);
127
static void handleDamageRect (CompWindow *w,
140
bool handlePingTimeout (unsigned int lastPing);
142
void handlePing (int lastPing);
144
void applyStartupProperties (CompStartupSequence *s);
146
void updateNormalHints ();
148
void updateWmHints ();
150
void updateClassHints ();
152
void updateTransientHint ();
154
void updateIconGeometry ();
156
Window getClientLeader ();
158
char * getStartupId ();
161
rectsToRegion (unsigned int, XRectangle *);
163
void updateRegion ();
165
bool handleSyncAlarm ();
167
void configure (XConfigureEvent *ce);
169
void configureFrame (XConfigureEvent *ce);
171
void circulate (XCirculateEvent *ce);
173
unsigned int adjustConfigureRequestForGravity (XWindowChanges *xwc,
180
bool getUserTime (Time& time);
181
void setUserTime (Time time);
183
bool allowWindowFocus (unsigned int noFocusMask,
188
void updateMwmHints ();
190
void updateStartupId ();
194
void updatePassiveButtonGrabs ();
196
void setFullscreenMonitors (CompFullscreenMonitorSet *monitors);
198
static unsigned int windowTypeFromString (const char *str);
200
static int compareWindowActiveness (CompWindow *w1,
203
void setOverrideRedirect (bool overrideRedirect);
205
void readIconHint ();
218
unsigned int activeNum;
219
XWindowAttributes attrib;
220
CompWindow::Geometry geometry;
221
CompWindow::Geometry serverGeometry;
224
XSizeHints sizeHints;
232
CompRegion inputRegion;
233
CompRegion frameRegion;
238
unsigned int actions;
239
unsigned int protocols;
240
unsigned int mwmDecor;
241
unsigned int mwmFunc;
250
CompPoint initialViewport;
252
Time initialTimestamp;
253
bool initialTimestampSet;
255
bool fullscreenMonitorsSet;
256
CompRect fullscreenMonitorRect;
260
bool inShowDesktopMode;
265
unsigned int desktop;
276
unsigned int lastPong;
279
CompWindowExtents input;
280
CompWindowExtents output;
284
std::vector<CompIcon *> icons;
287
CompRect iconGeometry;
289
XWindowChanges saveWc;
292
XSyncCounter syncCounter;
293
XSyncValue syncValue;
294
XSyncAlarm syncAlarm;
295
CompTimer syncWaitTimer;
298
CompWindow::Geometry syncGeometry;
301
Time lastCloseRequestTime;
304
/* Minimal tracking of the window which happens
311
CoreWindow (Window id, XWindowAttributes &wa);
313
CompWindow * manage (Window id);
315
friend class PrivateWindow;
316
friend class PrivateScreen;
317
friend class CompScreen;