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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
|
From 08bc76d60fdd39cf6d09e28070f37a0ad620adab Mon Sep 17 00:00:00 2001
From: Fedora X Ninjas <airlied@redhat.com>
Date: Fri, 4 Jun 2010 11:02:58 +1000
Subject: [PATCH 2/8] composite fixes backported
squashes three upstream patches
composite: use config notify hook to do pixmap resize. (v3) - backported to avoid ABI breakage
composite: initialise pOldPixmap to NullPixmap at alloc time.
composite: fix freeing of old pixmap until after move/resize/cbw
misapplied - fixup
---
composite/compalloc.c | 1 +
composite/compinit.c | 3 +-
composite/compint.h | 11 ++--
composite/compwindow.c | 124 +++++++++++++++--------------------------------
dix/window.c | 18 +++++++-
include/window.h | 11 ++++
6 files changed, 77 insertions(+), 91 deletions(-)
diff --git a/composite/compalloc.c b/composite/compalloc.c
index 73adc72..8a6beb9 100644
--- a/composite/compalloc.c
+++ b/composite/compalloc.c
@@ -143,6 +143,7 @@ compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
cw->oldy = COMP_ORIGIN_INVALID;
cw->damageRegistered = FALSE;
cw->damaged = FALSE;
+ cw->pOldPixmap = NullPixmap;
dixSetPrivate(&pWin->devPrivates, CompWindowPrivateKey, cw);
}
ccw->next = cw->clients;
diff --git a/composite/compinit.c b/composite/compinit.c
index e8b563d..2ee9332 100644
--- a/composite/compinit.c
+++ b/composite/compinit.c
@@ -69,6 +69,7 @@ compCloseScreen (int index, ScreenPtr pScreen)
pScreen->InstallColormap = cs->InstallColormap;
pScreen->ChangeWindowAttributes = cs->ChangeWindowAttributes;
pScreen->ReparentWindow = cs->ReparentWindow;
+
pScreen->MoveWindow = cs->MoveWindow;
pScreen->ResizeWindow = cs->ResizeWindow;
pScreen->ChangeBorderWidth = cs->ChangeBorderWidth;
@@ -389,6 +390,6 @@ compScreenInit (ScreenPtr pScreen)
dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, cs);
RegisterRealChildHeadProc(CompositeRealChildHead);
-
+ RegisterCompositeConfigNotifyProc(compConfigNotify);
return TRUE;
}
diff --git a/composite/compint.h b/composite/compint.h
index 845a196..a959ad5 100644
--- a/composite/compint.h
+++ b/composite/compint.h
@@ -126,14 +126,11 @@ typedef struct _CompScreen {
RealizeWindowProcPtr RealizeWindow;
UnrealizeWindowProcPtr UnrealizeWindow;
ClipNotifyProcPtr ClipNotify;
- /*
- * Called from ConfigureWindow, these
- * three track changes to the offscreen storage
- * geometry
- */
+
MoveWindowProcPtr MoveWindow;
ResizeWindowProcPtr ResizeWindow;
ChangeBorderWidthProcPtr ChangeBorderWidth;
+
/*
* Reparenting has an effect on Subwindows redirect
*/
@@ -316,4 +313,8 @@ CompositeRealChildHead (WindowPtr pWin);
int
DeleteWindowNoInputDevices(pointer value, XID wid);
+int
+compConfigNotify(WindowPtr pWin, int x, int y, int w, int h,
+ int bw, WindowPtr pSib);
+
#endif /* _COMPINT_H_ */
diff --git a/composite/compwindow.c b/composite/compwindow.c
index 2f5a717..550df39 100644
--- a/composite/compwindow.c
+++ b/composite/compwindow.c
@@ -334,37 +334,9 @@ compImplicitRedirect (WindowPtr pWin, WindowPtr pParent)
return FALSE;
}
-void
-compMoveWindow (WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind)
+static void compFreeOldPixmap(WindowPtr pWin)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
-
- compCheckTree (pScreen);
- if (pWin->redirectDraw != RedirectDrawNone)
- {
- WindowPtr pParent;
- int draw_x, draw_y;
- unsigned int w, h, bw;
-
- /* if this is a root window, can't be moved */
- if (!(pParent = pWin->parent))
- return;
-
- bw = wBorderWidth (pWin);
- draw_x = pParent->drawable.x + x + (int)bw;
- draw_y = pParent->drawable.y + y + (int)bw;
- w = pWin->drawable.width;
- h = pWin->drawable.height;
- compReallocPixmap (pWin, draw_x, draw_y, w, h, bw);
- }
- compCheckTree (pScreen);
-
- pScreen->MoveWindow = cs->MoveWindow;
- (*pScreen->MoveWindow) (pWin, x, y, pSib, kind);
- cs->MoveWindow = pScreen->MoveWindow;
- pScreen->MoveWindow = compMoveWindow;
-
if (pWin->redirectDraw != RedirectDrawNone)
{
CompWindowPtr cw = GetCompWindow (pWin);
@@ -374,7 +346,19 @@ compMoveWindow (WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind)
cw->pOldPixmap = NullPixmap;
}
}
+}
+void
+compMoveWindow (WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen (pScreen);
+
+ pScreen->MoveWindow = cs->MoveWindow;
+ (*pScreen->MoveWindow) (pWin, x, y, pSib, kind);
+ cs->MoveWindow = pScreen->MoveWindow;
+ pScreen->MoveWindow = compMoveWindow;
+ compFreeOldPixmap(pWin);
compCheckTree (pScreen);
}
@@ -385,37 +369,12 @@ compResizeWindow (WindowPtr pWin, int x, int y,
ScreenPtr pScreen = pWin->drawable.pScreen;
CompScreenPtr cs = GetCompScreen (pScreen);
- compCheckTree (pScreen);
- if (pWin->redirectDraw != RedirectDrawNone)
- {
- WindowPtr pParent;
- int draw_x, draw_y;
- unsigned int bw;
-
- /* if this is a root window, can't be moved */
- if (!(pParent = pWin->parent))
- return;
-
- bw = wBorderWidth (pWin);
- draw_x = pParent->drawable.x + x + (int)bw;
- draw_y = pParent->drawable.y + y + (int)bw;
- compReallocPixmap (pWin, draw_x, draw_y, w, h, bw);
- }
- compCheckTree (pScreen);
-
pScreen->ResizeWindow = cs->ResizeWindow;
(*pScreen->ResizeWindow) (pWin, x, y, w, h, pSib);
cs->ResizeWindow = pScreen->ResizeWindow;
pScreen->ResizeWindow = compResizeWindow;
- if (pWin->redirectDraw != RedirectDrawNone)
- {
- CompWindowPtr cw = GetCompWindow (pWin);
- if (cw->pOldPixmap)
- {
- (*pScreen->DestroyPixmap) (cw->pOldPixmap);
- cw->pOldPixmap = NullPixmap;
- }
- }
+
+ compFreeOldPixmap(pWin);
compCheckTree (pWin->drawable.pScreen);
}
@@ -425,38 +384,12 @@ compChangeBorderWidth (WindowPtr pWin, unsigned int bw)
ScreenPtr pScreen = pWin->drawable.pScreen;
CompScreenPtr cs = GetCompScreen (pScreen);
- compCheckTree (pScreen);
- if (pWin->redirectDraw != RedirectDrawNone)
- {
- WindowPtr pParent;
- int draw_x, draw_y;
- unsigned int w, h;
-
- /* if this is a root window, can't be moved */
- if (!(pParent = pWin->parent))
- return;
-
- draw_x = pWin->drawable.x;
- draw_y = pWin->drawable.y;
- w = pWin->drawable.width;
- h = pWin->drawable.height;
- compReallocPixmap (pWin, draw_x, draw_y, w, h, bw);
- }
- compCheckTree (pScreen);
-
pScreen->ChangeBorderWidth = cs->ChangeBorderWidth;
(*pScreen->ChangeBorderWidth) (pWin, bw);
cs->ChangeBorderWidth = pScreen->ChangeBorderWidth;
pScreen->ChangeBorderWidth = compChangeBorderWidth;
- if (pWin->redirectDraw != RedirectDrawNone)
- {
- CompWindowPtr cw = GetCompWindow (pWin);
- if (cw->pOldPixmap)
- {
- (*pScreen->DestroyPixmap) (cw->pOldPixmap);
- cw->pOldPixmap = NullPixmap;
- }
- }
+
+ compFreeOldPixmap(pWin);
compCheckTree (pWin->drawable.pScreen);
}
@@ -822,3 +755,26 @@ CompositeRealChildHead (WindowPtr pWin)
return pChildBefore;
}
}
+
+int
+compConfigNotify(WindowPtr pWin, int x, int y, int w, int h,
+ int bw, WindowPtr pSib)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ WindowPtr pParent = pWin->parent;
+ int draw_x, draw_y;
+ Bool alloc_ret;
+
+ if (pWin->redirectDraw == RedirectDrawNone)
+ return Success;
+
+ compCheckTree (pScreen);
+
+ draw_x = pParent->drawable.x + x + bw;
+ draw_y = pParent->drawable.y + y + bw;
+ alloc_ret = compReallocPixmap (pWin, draw_x, draw_y, w, h, bw);
+
+ if (alloc_ret == FALSE)
+ return BadAlloc;
+ return Success;
+}
diff --git a/dix/window.c b/dix/window.c
index e191f09..e4c850f 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -2104,6 +2104,13 @@ ReflectStackChange(
WindowsRestructured ();
}
+static compositeConfigNotifyProcPtr compositeConfigNotify;
+void
+RegisterCompositeConfigNotifyProc(compositeConfigNotifyProcPtr proc)
+{
+ compositeConfigNotify = proc;
+}
+
/*****
* ConfigureWindow
*****/
@@ -2220,7 +2227,6 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client)
else
pSib = pWin->nextSib;
-
if ((!pWin->overrideRedirect) &&
(RedirectSend(pParent)
))
@@ -2305,6 +2311,16 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client)
return(Success);
ActuallyDoSomething:
+ if (compositeConfigNotify)
+ {
+ int ret;
+ ret = compositeConfigNotify(pWin, x, y, w, h, bw, pSib);
+ if (ret) {
+ client->errorValue = 0;
+ return ret;
+ }
+ }
+
if (SubStrSend(pWin, pParent))
{
memset(&event, 0, sizeof(xEvent));
diff --git a/include/window.h b/include/window.h
index 6fb2f8c..ea2edab 100644
--- a/include/window.h
+++ b/include/window.h
@@ -266,4 +266,15 @@ extern _X_EXPORT void DisableMapUnmapEvents(
extern _X_EXPORT void EnableMapUnmapEvents(
WindowPtr /* pWin */ );
+typedef int (* compositeConfigNotifyProcPtr)(
+ WindowPtr /* pWin */,
+ int /* x */,
+ int /* y */,
+ int /* w */,
+ int /* h */,
+ int /* bw */,
+ WindowPtr /*pSib*/);
+
+_X_EXPORT void RegisterCompositeConfigNotifyProc(compositeConfigNotifyProcPtr proc);
+
#endif /* WINDOW_H */
--
1.7.1
|