Merge lp:~3v1n0/compiz/cursors-update-on-theme+size-changes into lp:compiz/0.9.12
- cursors-update-on-theme+size-changes
- Merge into 0.9.12
Status: | Merged |
---|---|
Approved by: | Andrea Azzarone |
Approved revision: | 3955 |
Merged at revision: | 3987 |
Proposed branch: | lp:~3v1n0/compiz/cursors-update-on-theme+size-changes |
Merge into: | lp:compiz/0.9.12 |
Prerequisite: | lp:~3v1n0/compiz/add-cursor-update-notify |
Diff against target: |
746 lines (+109/-133) 24 files modified
CMakeLists.txt (+1/-0) include/core/screen.h (+1/-0) plugins/expo/src/expo.cpp (+1/-8) plugins/expo/src/expo.h (+0/-3) plugins/freewins/src/action.cpp (+1/-5) plugins/freewins/src/events.cpp (+2/-4) plugins/freewins/src/freewins.h (+0/-2) plugins/move/src/move.cpp (+4/-6) plugins/move/src/move.h (+0/-2) plugins/resize/src/logic/include/resize-logic.h (+1/-11) plugins/resize/src/logic/include/screen-interface.h (+1/-0) plugins/resize/src/logic/src/resize-logic.cpp (+23/-12) plugins/resize/src/logic/tests/mock-screen.h (+1/-0) plugins/resize/src/resize.cpp (+0/-37) plugins/resize/src/screen-impl.h (+5/-0) plugins/shelf/src/shelf.cpp (+1/-7) plugins/shelf/src/shelf.h (+0/-1) plugins/shift/src/shift.cpp (+0/-3) plugins/shift/src/shift.h (+0/-2) plugins/widget/src/widget.cpp (+2/-6) plugins/widget/src/widget.h (+0/-1) src/privatescreen.h (+6/-3) src/privatescreen/tests/test-privatescreen.cpp (+1/-0) src/screen.cpp (+58/-20) |
To merge this branch: | bzr merge lp:~3v1n0/compiz/cursors-update-on-theme+size-changes |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Andrea Azzarone | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Review via email: mp+275332@code.launchpad.net |
This proposal supersedes a proposal from 2015-10-20.
Commit message
Screen: monitor root RESOURCE_MANAGER and update cursors when Size or Theme changes
Also add cursorCache and updateCursors notify function
Description of the change
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
Andrea Azzarone (azzar1) wrote : Posted in a previous version of this proposal | # |
LGTM. Not sure what happend with that diff still around but should not be a problem.
Andrea Azzarone (azzar1) : Posted in a previous version of this proposal | # |
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:3953
http://
Executed test runs:
FAILURE: http://
None: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:3954
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:3954
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 3955. By Marco Trevisan (Treviño)
-
Screen: no need to update cursors on startup, we have none of them
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3954
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
None: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3955
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'CMakeLists.txt' |
2 | --- CMakeLists.txt 2015-07-30 20:12:45 +0000 |
3 | +++ CMakeLists.txt 2015-10-22 15:51:58 +0000 |
4 | @@ -101,6 +101,7 @@ |
5 | xext |
6 | xdamage |
7 | xcomposite |
8 | + xcursor |
9 | x11-xcb |
10 | xrandr |
11 | xinerama |
12 | |
13 | === modified file 'include/core/screen.h' |
14 | --- include/core/screen.h 2015-10-22 15:51:57 +0000 |
15 | +++ include/core/screen.h 2015-10-22 15:51:58 +0000 |
16 | @@ -395,6 +395,7 @@ |
17 | virtual const char * displayString () = 0; |
18 | virtual CompRect getCurrentOutputExtents () = 0; |
19 | virtual Cursor normalCursor () = 0; |
20 | + virtual Cursor cursorCache (unsigned int cursorName) = 0; |
21 | virtual bool grabbed () = 0; |
22 | virtual SnDisplay * snDisplay () = 0; |
23 | |
24 | |
25 | === modified file 'plugins/expo/src/expo.cpp' |
26 | --- plugins/expo/src/expo.cpp 2015-04-10 21:55:21 +0000 |
27 | +++ plugins/expo/src/expo.cpp 2015-10-22 15:51:58 +0000 |
28 | @@ -610,7 +610,7 @@ |
29 | CompWindowGrabMoveMask | |
30 | CompWindowGrabButtonMask); |
31 | |
32 | - screen->updateGrab (grabIndex, dragCursor); |
33 | + screen->updateGrab (grabIndex, screen->cursorCache (XC_fleur)); |
34 | |
35 | w->raise (); |
36 | w->moveInputFocusTo (); |
37 | @@ -1578,8 +1578,6 @@ |
38 | upKey = XKeysymToKeycode (s->dpy (), XStringToKeysym ("Up")); |
39 | downKey = XKeysymToKeycode (s->dpy (), XStringToKeysym ("Down")); |
40 | |
41 | - dragCursor = XCreateFontCursor (screen->dpy (), XC_fleur); |
42 | - |
43 | EXPOINITBIND (ExpoKey, doExpo); |
44 | EXPOTERMBIND (ExpoKey, termExpo); |
45 | EXPOINITBIND (ExpoButton, doExpo); |
46 | @@ -1603,11 +1601,6 @@ |
47 | GL_RGBA, GL_UNSIGNED_BYTE); |
48 | } |
49 | |
50 | -ExpoScreen::~ExpoScreen () |
51 | -{ |
52 | - if (dragCursor != None) |
53 | - XFreeCursor (screen->dpy (), dragCursor); |
54 | -} |
55 | |
56 | ExpoWindow::ExpoWindow (CompWindow *w) : |
57 | PluginClassHandler<ExpoWindow, CompWindow> (w), |
58 | |
59 | === modified file 'plugins/expo/src/expo.h' |
60 | --- plugins/expo/src/expo.h 2013-07-14 10:38:09 +0000 |
61 | +++ plugins/expo/src/expo.h 2015-10-22 15:51:58 +0000 |
62 | @@ -42,7 +42,6 @@ |
63 | public: |
64 | |
65 | ExpoScreen (CompScreen *); |
66 | - ~ExpoScreen (); |
67 | |
68 | void handleEvent (XEvent *); |
69 | |
70 | @@ -153,8 +152,6 @@ |
71 | KeyCode rightKey; |
72 | KeyCode upKey; |
73 | KeyCode downKey; |
74 | - |
75 | - Cursor dragCursor; |
76 | }; |
77 | |
78 | class ExpoWindow : |
79 | |
80 | === modified file 'plugins/freewins/src/action.cpp' |
81 | --- plugins/freewins/src/action.cpp 2013-03-26 22:02:39 +0000 |
82 | +++ plugins/freewins/src/action.cpp 2015-10-22 15:51:58 +0000 |
83 | @@ -82,8 +82,6 @@ |
84 | useW = getRealWindow (w); |
85 | } |
86 | |
87 | - mRotateCursor = XCreateFontCursor (screen->dpy (), XC_fleur); |
88 | - |
89 | if (!screen->otherGrabExist ("freewins", 0)) |
90 | if (!mGrabIndex) |
91 | { |
92 | @@ -305,11 +303,9 @@ |
93 | useW = getRealWindow (w); |
94 | } |
95 | |
96 | - mRotateCursor = XCreateFontCursor (screen->dpy (), XC_fleur); |
97 | - |
98 | if (!screen->otherGrabExist ("freewins", 0)) |
99 | if (!mGrabIndex) |
100 | - mGrabIndex = screen->pushGrab (mRotateCursor, "freewins"); |
101 | + mGrabIndex = screen->pushGrab (screen->cursorCache(XC_fleur), "freewins"); |
102 | } |
103 | |
104 | if (useW) |
105 | |
106 | === modified file 'plugins/freewins/src/events.cpp' |
107 | --- plugins/freewins/src/events.cpp 2013-03-26 22:02:39 +0000 |
108 | +++ plugins/freewins/src/events.cpp 2015-10-22 15:51:58 +0000 |
109 | @@ -60,13 +60,12 @@ |
110 | |
111 | window->activate (); |
112 | mGrab = grabResize; |
113 | - fws->mRotateCursor = XCreateFontCursor (screen->dpy (), XC_plus); |
114 | if(!screen->otherGrabExist ("freewins", "resize", 0)) |
115 | if(!fws->mGrabIndex) |
116 | { |
117 | unsigned int mods = 0; |
118 | mods &= CompNoMask; |
119 | - fws->mGrabIndex = screen->pushGrab (fws->mRotateCursor, "resize"); |
120 | + fws->mGrabIndex = screen->pushGrab (screen->cursorCache (XC_plus), "resize"); |
121 | window->grabNotify (window->x () + (window->width () / 2), |
122 | window->y () + (window->height () / 2), mods, |
123 | CompWindowGrabMoveMask | CompWindowGrabButtonMask); |
124 | @@ -81,13 +80,12 @@ |
125 | |
126 | window->activate (); |
127 | mGrab = grabMove; |
128 | - fws->mRotateCursor = XCreateFontCursor (screen->dpy (), XC_fleur); |
129 | if(!screen->otherGrabExist ("freewins", "resize", 0)) |
130 | if(!fws->mGrabIndex) |
131 | { |
132 | unsigned int mods = 0; |
133 | mods &= CompNoMask; |
134 | - fws->mGrabIndex = screen->pushGrab (fws->mRotateCursor, "resize"); |
135 | + fws->mGrabIndex = screen->pushGrab (screen->cursorCache (XC_fleur), "resize"); |
136 | window->grabNotify (window->x () + (window->width () / 2), |
137 | window->y () + (window->height () / 2), mods, |
138 | CompWindowGrabResizeMask | CompWindowGrabButtonMask); |
139 | |
140 | === modified file 'plugins/freewins/src/freewins.h' |
141 | --- plugins/freewins/src/freewins.h 2013-02-20 14:24:30 +0000 |
142 | +++ plugins/freewins/src/freewins.h 2015-10-22 15:51:58 +0000 |
143 | @@ -281,8 +281,6 @@ |
144 | int mSnapMask; |
145 | int mInvertMask; |
146 | |
147 | - Cursor mRotateCursor; |
148 | - |
149 | CompScreen::GrabHandle mGrabIndex; |
150 | |
151 | void preparePaint (int); |
152 | |
153 | === modified file 'plugins/move/src/move.cpp' |
154 | --- plugins/move/src/move.cpp 2015-10-22 15:51:57 +0000 |
155 | +++ plugins/move/src/move.cpp 2015-10-22 15:51:58 +0000 |
156 | @@ -105,10 +105,12 @@ |
157 | |
158 | if (!ms->grab) |
159 | { |
160 | + Cursor moveCursor = screen->cursorCache (XC_fleur); |
161 | + |
162 | if (state & CompAction::StateInitButton) |
163 | - ms->grab = s->pushPointerGrab (ms->moveCursor, "move"); |
164 | + ms->grab = s->pushPointerGrab (moveCursor, "move"); |
165 | else |
166 | - ms->grab = s->pushGrab (ms->moveCursor, "move"); |
167 | + ms->grab = s->pushGrab (moveCursor, "move"); |
168 | } |
169 | |
170 | if (ms->grab) |
171 | @@ -716,7 +718,6 @@ |
172 | key[i] = XKeysymToKeycode (screen->dpy (), |
173 | XStringToKeysym (mKeys[i].name)); |
174 | |
175 | - moveCursor = XCreateFontCursor (screen->dpy (), XC_fleur); |
176 | if (cScreen) |
177 | { |
178 | CompositeScreenInterface::setHandler (cScreen); |
179 | @@ -739,9 +740,6 @@ |
180 | { |
181 | if (region) |
182 | XDestroyRegion (region); |
183 | - |
184 | - if (moveCursor) |
185 | - XFreeCursor (screen->dpy (), moveCursor); |
186 | } |
187 | |
188 | bool |
189 | |
190 | === modified file 'plugins/move/src/move.h' |
191 | --- plugins/move/src/move.h 2013-04-13 21:59:11 +0000 |
192 | +++ plugins/move/src/move.h 2015-10-22 15:51:58 +0000 |
193 | @@ -82,8 +82,6 @@ |
194 | |
195 | CompScreen::GrabHandle grab; |
196 | |
197 | - Cursor moveCursor; |
198 | - |
199 | unsigned int origState; |
200 | |
201 | int snapOffX; |
202 | |
203 | === modified file 'plugins/resize/src/logic/include/resize-logic.h' |
204 | --- plugins/resize/src/logic/include/resize-logic.h 2014-05-28 07:08:10 +0000 |
205 | +++ plugins/resize/src/logic/include/resize-logic.h 2015-10-22 15:51:58 +0000 |
206 | @@ -113,20 +113,10 @@ |
207 | int pointerDx; |
208 | int pointerDy; |
209 | KeyCode key[NUM_KEYS]; |
210 | + unsigned int keyCursorNames[NUM_KEYS]; |
211 | |
212 | CompScreen::GrabHandle grabIndex; |
213 | |
214 | - Cursor leftCursor; |
215 | - Cursor rightCursor; |
216 | - Cursor upCursor; |
217 | - Cursor upLeftCursor; |
218 | - Cursor upRightCursor; |
219 | - Cursor downCursor; |
220 | - Cursor downLeftCursor; |
221 | - Cursor downRightCursor; |
222 | - Cursor middleCursor; |
223 | - Cursor cursor[NUM_KEYS]; |
224 | - |
225 | bool isConstrained; |
226 | CompRegion constraintRegion; |
227 | bool inRegionStatus; |
228 | |
229 | === modified file 'plugins/resize/src/logic/include/screen-interface.h' |
230 | --- plugins/resize/src/logic/include/screen-interface.h 2015-10-22 15:51:57 +0000 |
231 | +++ plugins/resize/src/logic/include/screen-interface.h 2015-10-22 15:51:58 +0000 |
232 | @@ -59,6 +59,7 @@ |
233 | virtual CompScreen::GrabHandle pushPointerGrab (Cursor cursor, const char *name) = 0; |
234 | virtual CompScreen::GrabHandle pushKeyboardGrab (const char *name) = 0; |
235 | virtual void removeGrab (CompScreen::GrabHandle handle, CompPoint *restorePointer) = 0; |
236 | + virtual Cursor cursorCache (unsigned int cursorName) = 0; |
237 | |
238 | /* CompOption::Class */ |
239 | virtual CompOption * getOption (const CompString &name) = 0; |
240 | |
241 | === modified file 'plugins/resize/src/logic/src/resize-logic.cpp' |
242 | --- plugins/resize/src/logic/src/resize-logic.cpp 2015-10-22 15:51:57 +0000 |
243 | +++ plugins/resize/src/logic/src/resize-logic.cpp 2015-10-22 15:51:58 +0000 |
244 | @@ -27,6 +27,7 @@ |
245 | |
246 | #include <core/core.h> |
247 | #include <core/atoms.h> |
248 | +#include <X11/cursorfont.h> |
249 | |
250 | #include "resize-logic.h" |
251 | |
252 | @@ -48,6 +49,16 @@ |
253 | static const unsigned short TOUCH_TOP = 3; |
254 | static const unsigned short TOUCH_BOTTOM = 4; |
255 | |
256 | +#define LEFT_CURSOR XC_left_side |
257 | +#define RIGHT_CURSOR XC_right_side |
258 | +#define UP_CURSOR XC_top_side |
259 | +#define UP_LEFT_CURSOR XC_top_left_corner |
260 | +#define UP_RIGHT_CURSOR XC_top_right_corner |
261 | +#define DOWN_CURSOR XC_bottom_side |
262 | +#define DOWN_LEFT_CURSOR XC_bottom_left_corner |
263 | +#define DOWN_RIGHT_CURSOR XC_bottom_right_corner |
264 | +#define MIDDLE_CURSOR XC_fleur |
265 | + |
266 | using namespace resize; |
267 | |
268 | ResizeLogic::ResizeLogic() : |
269 | @@ -428,7 +439,7 @@ |
270 | lastMaskY = mask; |
271 | } |
272 | |
273 | - mScreen->updateGrab (grabIndex, cursor[i]); |
274 | + mScreen->updateGrab (grabIndex, screen->cursorCache (keyCursorNames[i])); |
275 | } |
276 | break; |
277 | } |
278 | @@ -652,36 +663,36 @@ |
279 | Cursor |
280 | ResizeLogic::cursorFromResizeMask (unsigned int mask) |
281 | { |
282 | - Cursor cursor; |
283 | + unsigned int cursor_name; |
284 | |
285 | if (mask & ResizeLeftMask) |
286 | { |
287 | if (mask & ResizeDownMask) |
288 | - cursor = downLeftCursor; |
289 | + cursor_name = DOWN_LEFT_CURSOR; |
290 | else if (mask & ResizeUpMask) |
291 | - cursor = upLeftCursor; |
292 | + cursor_name = UP_LEFT_CURSOR; |
293 | else |
294 | - cursor = leftCursor; |
295 | + cursor_name = LEFT_CURSOR; |
296 | } |
297 | else if (mask & ResizeRightMask) |
298 | { |
299 | if (mask & ResizeDownMask) |
300 | - cursor = downRightCursor; |
301 | + cursor_name = DOWN_RIGHT_CURSOR; |
302 | else if (mask & ResizeUpMask) |
303 | - cursor = upRightCursor; |
304 | + cursor_name = UP_RIGHT_CURSOR; |
305 | else |
306 | - cursor = rightCursor; |
307 | + cursor_name = RIGHT_CURSOR; |
308 | } |
309 | else if (mask & ResizeUpMask) |
310 | { |
311 | - cursor = upCursor; |
312 | + cursor_name = UP_CURSOR; |
313 | } |
314 | else |
315 | { |
316 | - cursor = downCursor; |
317 | + cursor_name = DOWN_CURSOR; |
318 | } |
319 | |
320 | - return cursor; |
321 | + return screen->cursorCache (cursor_name); |
322 | } |
323 | |
324 | void |
325 | @@ -1327,7 +1338,7 @@ |
326 | Cursor cursor; |
327 | |
328 | if (state & CompAction::StateInitKey) |
329 | - cursor = middleCursor; |
330 | + cursor = screen->cursorCache (MIDDLE_CURSOR); |
331 | else |
332 | cursor = cursorFromResizeMask (mask); |
333 | |
334 | |
335 | === modified file 'plugins/resize/src/logic/tests/mock-screen.h' |
336 | --- plugins/resize/src/logic/tests/mock-screen.h 2015-10-22 15:51:57 +0000 |
337 | +++ plugins/resize/src/logic/tests/mock-screen.h 2015-10-22 15:51:58 +0000 |
338 | @@ -54,6 +54,7 @@ |
339 | MOCK_METHOD2(pushPointerGrab, CompScreen::GrabHandle(Cursor cursor, const char *name)); |
340 | MOCK_METHOD1(pushKeyboardGrab, CompScreen::GrabHandle(const char *name)); |
341 | MOCK_METHOD2(removeGrab, void(CompScreen::GrabHandle handle, CompPoint *restorePointer)); |
342 | + MOCK_METHOD1(cursorCache, Cursor (unsigned int)); |
343 | |
344 | MOCK_METHOD1(getOption, CompOption*(const CompString &name)); |
345 | |
346 | |
347 | === modified file 'plugins/resize/src/resize.cpp' |
348 | --- plugins/resize/src/resize.cpp 2013-05-15 10:23:30 +0000 |
349 | +++ plugins/resize/src/resize.cpp 2015-10-22 15:51:58 +0000 |
350 | @@ -380,7 +380,6 @@ |
351 | logic.options = this; |
352 | |
353 | CompOption::Vector atomTemplate; |
354 | - Display *dpy = s->dpy (); |
355 | ResizeOptions::ChangeNotify notify = |
356 | boost::bind (&ResizeScreen::optionChanged, this, _1, _2); |
357 | |
358 | @@ -404,21 +403,6 @@ |
359 | for (unsigned int i = 0; i < NUM_KEYS; i++) |
360 | logic.key[i] = XKeysymToKeycode (s->dpy (), XStringToKeysym (logic.rKeys[i].name)); |
361 | |
362 | - logic.leftCursor = XCreateFontCursor (dpy, XC_left_side); |
363 | - logic.rightCursor = XCreateFontCursor (dpy, XC_right_side); |
364 | - logic.upCursor = XCreateFontCursor (dpy, XC_top_side); |
365 | - logic.upLeftCursor = XCreateFontCursor (dpy, XC_top_left_corner); |
366 | - logic.upRightCursor = XCreateFontCursor (dpy, XC_top_right_corner); |
367 | - logic.downCursor = XCreateFontCursor (dpy, XC_bottom_side); |
368 | - logic.downLeftCursor = XCreateFontCursor (dpy, XC_bottom_left_corner); |
369 | - logic.downRightCursor = XCreateFontCursor (dpy, XC_bottom_right_corner); |
370 | - logic.middleCursor = XCreateFontCursor (dpy, XC_fleur); |
371 | - |
372 | - logic.cursor[0] = logic.leftCursor; |
373 | - logic.cursor[1] = logic.rightCursor; |
374 | - logic.cursor[2] = logic.upCursor; |
375 | - logic.cursor[3] = logic.downCursor; |
376 | - |
377 | optionSetInitiateKeyInitiate (resizeInitiateDefaultMode); |
378 | optionSetInitiateKeyTerminate (resizeTerminate); |
379 | optionSetInitiateButtonInitiate (resizeInitiateDefaultMode); |
380 | @@ -442,27 +426,6 @@ |
381 | |
382 | ResizeScreen::~ResizeScreen () |
383 | { |
384 | - Display *dpy = screen->dpy (); |
385 | - |
386 | - if (logic.leftCursor) |
387 | - XFreeCursor (dpy, logic.leftCursor); |
388 | - if (logic.rightCursor) |
389 | - XFreeCursor (dpy, logic.rightCursor); |
390 | - if (logic.upCursor) |
391 | - XFreeCursor (dpy, logic.upCursor); |
392 | - if (logic.downCursor) |
393 | - XFreeCursor (dpy, logic.downCursor); |
394 | - if (logic.middleCursor) |
395 | - XFreeCursor (dpy, logic.middleCursor); |
396 | - if (logic.upLeftCursor) |
397 | - XFreeCursor (dpy, logic.upLeftCursor); |
398 | - if (logic.upRightCursor) |
399 | - XFreeCursor (dpy, logic.upRightCursor); |
400 | - if (logic.downLeftCursor) |
401 | - XFreeCursor (dpy, logic.downLeftCursor); |
402 | - if (logic.downRightCursor) |
403 | - XFreeCursor (dpy, logic.downRightCursor); |
404 | - |
405 | delete logic.mScreen; |
406 | delete logic.cScreen; |
407 | delete logic.gScreen; |
408 | |
409 | === modified file 'plugins/resize/src/screen-impl.h' |
410 | --- plugins/resize/src/screen-impl.h 2015-10-22 15:51:57 +0000 |
411 | +++ plugins/resize/src/screen-impl.h 2015-10-22 15:51:58 +0000 |
412 | @@ -134,6 +134,11 @@ |
413 | return mImpl->height (); |
414 | } |
415 | |
416 | + virtual Cursor cursorCache (unsigned int cursorName) |
417 | + { |
418 | + return mImpl->cursorCache (cursorName); |
419 | + } |
420 | + |
421 | private: |
422 | CompScreen *mImpl; |
423 | }; |
424 | |
425 | === modified file 'plugins/shelf/src/shelf.cpp' |
426 | --- plugins/shelf/src/shelf.cpp 2013-05-09 13:43:07 +0000 |
427 | +++ plugins/shelf/src/shelf.cpp 2015-10-22 15:51:58 +0000 |
428 | @@ -509,7 +509,7 @@ |
429 | { |
430 | window->activate (); |
431 | ss->grabbedWindow = window->id (); |
432 | - ss->grabIndex = screen->pushGrab (ss->moveCursor, "shelf"); |
433 | + ss->grabIndex = screen->pushGrab (screen->cursorCache (XC_fleur), "shelf"); |
434 | |
435 | ss->lastPointerX = x; |
436 | ss->lastPointerY = y; |
437 | @@ -760,7 +760,6 @@ |
438 | gScreen (GLScreen::get (screen)), |
439 | grabIndex (0), |
440 | grabbedWindow (None), |
441 | - moveCursor (XCreateFontCursor (screen->dpy (), XC_fleur)), |
442 | lastPointerX (0), |
443 | lastPointerY (0) |
444 | { |
445 | @@ -780,11 +779,6 @@ |
446 | _3)); |
447 | } |
448 | |
449 | -ShelfScreen::~ShelfScreen () |
450 | -{ |
451 | - if (moveCursor) |
452 | - XFreeCursor (screen->dpy (), moveCursor); |
453 | -} |
454 | |
455 | ShelfWindow::ShelfWindow (CompWindow *window) : |
456 | PluginClassHandler <ShelfWindow, CompWindow> (window), |
457 | |
458 | === modified file 'plugins/shelf/src/shelf.h' |
459 | --- plugins/shelf/src/shelf.h 2012-09-07 23:29:42 +0000 |
460 | +++ plugins/shelf/src/shelf.h 2015-10-22 15:51:58 +0000 |
461 | @@ -145,7 +145,6 @@ |
462 | public: |
463 | |
464 | ShelfScreen (CompScreen *); |
465 | - ~ShelfScreen (); |
466 | |
467 | CompositeScreen *cScreen; |
468 | GLScreen *gScreen; |
469 | |
470 | === modified file 'plugins/shift/src/shift.cpp' |
471 | --- plugins/shift/src/shift.cpp 2013-05-11 09:30:49 +0000 |
472 | +++ plugins/shift/src/shift.cpp 2015-10-22 15:51:58 +0000 |
473 | @@ -1968,7 +1968,6 @@ |
474 | mMvTarget (0), |
475 | mMvVelocity (0), |
476 | mInvert (false), |
477 | - mCursor (XCreateFontCursor (screen->dpy (), XC_left_ptr)), |
478 | mWindows (NULL), |
479 | mNWindows (0), |
480 | mWindowsSize (0), |
481 | @@ -2059,8 +2058,6 @@ |
482 | { |
483 | freeWindowTitle (); |
484 | |
485 | - XFreeCursor (screen->dpy (), mCursor); |
486 | - |
487 | if (mWindows) |
488 | free (mWindows); |
489 | |
490 | |
491 | === modified file 'plugins/shift/src/shift.h' |
492 | --- plugins/shift/src/shift.h 2013-04-27 16:51:53 +0000 |
493 | +++ plugins/shift/src/shift.h 2015-10-22 15:51:58 +0000 |
494 | @@ -143,8 +143,6 @@ |
495 | float mMvVelocity; |
496 | bool mInvert; |
497 | |
498 | - Cursor mCursor; |
499 | - |
500 | /* only used for sorting */ |
501 | CompWindow **mWindows; |
502 | int mNWindows; |
503 | |
504 | === modified file 'plugins/widget/src/widget.cpp' |
505 | --- plugins/widget/src/widget.cpp 2013-05-28 21:31:18 +0000 |
506 | +++ plugins/widget/src/widget.cpp 2015-10-22 15:51:58 +0000 |
507 | @@ -312,7 +312,7 @@ |
508 | } |
509 | |
510 | if (!mGrabIndex) |
511 | - mGrabIndex = screen->pushGrab (mCursor, "widget"); |
512 | + mGrabIndex = screen->pushGrab (screen->cursorCache (XC_watch), "widget"); |
513 | |
514 | enableFunctions (this, true); |
515 | |
516 | @@ -672,8 +672,7 @@ |
517 | mLastActiveWindow (None), |
518 | mCompizWidgetAtom (XInternAtom (screen->dpy (), "_COMPIZ_WIDGET", false)), |
519 | mFadeTime (0), |
520 | - mGrabIndex (0), |
521 | - mCursor (XCreateFontCursor (screen->dpy (), XC_watch)) |
522 | + mGrabIndex (0) |
523 | { |
524 | CompAction::CallBack cb; |
525 | ChangeNotify notify; |
526 | @@ -706,9 +705,6 @@ |
527 | { |
528 | screen->matchExpHandlerChangedSetEnabled (this, false); |
529 | screen->matchExpHandlerChanged (); |
530 | - |
531 | - if (mCursor) |
532 | - XFreeCursor (screen->dpy (), mCursor); |
533 | } |
534 | |
535 | WidgetWindow::WidgetWindow (CompWindow *window) : |
536 | |
537 | === modified file 'plugins/widget/src/widget.h' |
538 | --- plugins/widget/src/widget.h 2013-05-28 21:31:18 +0000 |
539 | +++ plugins/widget/src/widget.h 2015-10-22 15:51:58 +0000 |
540 | @@ -107,7 +107,6 @@ |
541 | WidgetState mState; |
542 | int mFadeTime; |
543 | CompScreen::GrabHandle mGrabIndex; |
544 | - Cursor mCursor; |
545 | }; |
546 | |
547 | #define WIDGET_SCREEN(screen) \ |
548 | |
549 | === modified file 'src/privatescreen.h' |
550 | --- src/privatescreen.h 2015-10-22 15:51:57 +0000 |
551 | +++ src/privatescreen.h 2015-10-22 15:51:58 +0000 |
552 | @@ -710,6 +710,10 @@ |
553 | |
554 | void setDefaultWindowAttributes (XWindowAttributes *); |
555 | |
556 | + void updateCursors (const CompString& theme, int size); |
557 | + |
558 | + Cursor cursorCache (unsigned int cursorName); |
559 | + |
560 | static void compScreenSnEvent (SnMonitorEvent *event, |
561 | void *userData); |
562 | |
563 | @@ -777,9 +781,8 @@ |
564 | Window wmSnSelectionWindow; |
565 | |
566 | int clientPointerDeviceId; |
567 | - Cursor normalCursor; |
568 | - Cursor busyCursor; |
569 | Cursor invisibleCursor; |
570 | + std::vector<Cursor> cursors; |
571 | CompRect workArea; |
572 | |
573 | bool initialized; |
574 | @@ -969,8 +972,8 @@ |
575 | void unhookServerWindow (CompWindow *w); |
576 | |
577 | Cursor normalCursor (); |
578 | - |
579 | Cursor invisibleCursor (); |
580 | + Cursor cursorCache (unsigned int cursorName); |
581 | |
582 | /* Adds an X Pointer and Keyboard grab to the stack. Since |
583 | * compiz as a client only need to grab once, multiple clients |
584 | |
585 | === modified file 'src/privatescreen/tests/test-privatescreen.cpp' |
586 | --- src/privatescreen/tests/test-privatescreen.cpp 2015-10-22 15:51:57 +0000 |
587 | +++ src/privatescreen/tests/test-privatescreen.cpp 2015-10-22 15:51:58 +0000 |
588 | @@ -178,6 +178,7 @@ |
589 | MOCK_METHOD0(displayString, const char * ()); |
590 | MOCK_METHOD0(getCurrentOutputExtents, CompRect ()); |
591 | MOCK_METHOD0(normalCursor, Cursor ()); |
592 | + MOCK_METHOD1(cursorCache, Cursor (unsigned int)); |
593 | MOCK_METHOD0(grabbed, bool ()); |
594 | MOCK_METHOD0(snDisplay, SnDisplay * ()); |
595 | MOCK_CONST_METHOD0(createFailed, bool ()); |
596 | |
597 | === modified file 'src/screen.cpp' |
598 | --- src/screen.cpp 2015-10-22 15:51:57 +0000 |
599 | +++ src/screen.cpp 2015-10-22 15:51:58 +0000 |
600 | @@ -54,6 +54,7 @@ |
601 | #include <X11/extensions/shape.h> |
602 | #include <X11/cursorfont.h> |
603 | #include <X11/extensions/XInput2.h> |
604 | +#include <X11/Xcursor/Xcursor.h> |
605 | |
606 | #include <core/global.h> |
607 | #include <core/screen.h> |
608 | @@ -78,10 +79,12 @@ |
609 | namespace |
610 | { |
611 | bool inHandleEvent = false; |
612 | - |
613 | bool screenInitalized = false; |
614 | } |
615 | |
616 | +#define normalCursorName XC_left_ptr |
617 | +#define busyCursorName XC_watch |
618 | + |
619 | #define MwmHintsFunctions (1L << 0) |
620 | #define MwmHintsDecorations (1L << 1) |
621 | static const unsigned short PropMotifWmHintElements = 3; |
622 | @@ -2149,9 +2152,9 @@ |
623 | if (priv->initialized) |
624 | { |
625 | if (!emptySequence()) |
626 | - XIDefineCursor (priv->dpy, priv->clientPointerDeviceId, priv->rootWindow(), priv->busyCursor); |
627 | + XIDefineCursor (priv->dpy, priv->clientPointerDeviceId, priv->rootWindow(), priv->cursorCache (busyCursorName)); |
628 | else |
629 | - XIDefineCursor (priv->dpy, priv->clientPointerDeviceId, priv->rootWindow(), priv->normalCursor); |
630 | + XIDefineCursor (priv->dpy, priv->clientPointerDeviceId, priv->rootWindow(), priv->cursorCache (normalCursorName)); |
631 | } |
632 | } |
633 | |
634 | @@ -3083,7 +3086,7 @@ |
635 | Cursor |
636 | CompScreenImpl::normalCursor () |
637 | { |
638 | - return privateScreen.normalCursor; |
639 | + return privateScreen.cursorCache (normalCursorName); |
640 | } |
641 | |
642 | Cursor |
643 | @@ -3092,6 +3095,12 @@ |
644 | return privateScreen.invisibleCursor; |
645 | } |
646 | |
647 | +Cursor |
648 | +CompScreenImpl::cursorCache (unsigned int cursorName) |
649 | +{ |
650 | + return privateScreen.cursorCache (cursorName); |
651 | +} |
652 | + |
653 | #define POINTER_GRAB_MASK (ButtonReleaseMask | \ |
654 | ButtonPressMask | \ |
655 | PointerMotionMask) |
656 | @@ -4153,8 +4162,47 @@ |
657 | _cursorChangeNotify (theme, size); |
658 | } |
659 | |
660 | -void CompScreenImpl::_cursorChangeNotify (const CompString&, int) |
661 | -{ |
662 | +Cursor |
663 | +PrivateScreen::cursorCache (unsigned int cursorName) |
664 | +{ |
665 | + if (cursorName >= XC_num_glyphs) |
666 | + return 0; |
667 | + |
668 | + if (cursors.size() > cursorName && cursors[cursorName]) |
669 | + return cursors[cursorName]; |
670 | + |
671 | + cursors.resize(std::max<size_t>(cursorName + 1, cursors.size()), 0); |
672 | + cursors[cursorName] = XCreateFontCursor (dpy, cursorName); |
673 | + |
674 | + return cursors[cursorName]; |
675 | +} |
676 | + |
677 | +void |
678 | +PrivateScreen::updateCursors (const CompString& theme, int size) |
679 | +{ |
680 | + if (size > 0) |
681 | + XcursorSetDefaultSize (dpy, size); |
682 | + |
683 | + if (!theme.empty()) |
684 | + XcursorSetTheme (dpy, theme.c_str()); |
685 | + |
686 | + for (auto it = begin (cursors); it != end (cursors); ++it) |
687 | + { |
688 | + if (*it) |
689 | + { |
690 | + XFreeCursor (dpy, *it); |
691 | + *it = XCreateFontCursor (dpy, it - begin (cursors)); |
692 | + } |
693 | + } |
694 | + |
695 | + XIDefineCursor (dpy, clientPointerDeviceId, root, cursorCache (normalCursorName)); |
696 | + startupSequence.updateStartupFeedback (); |
697 | +} |
698 | + |
699 | +void |
700 | +CompScreenImpl::_cursorChangeNotify (const CompString& theme, int size) |
701 | +{ |
702 | + privateScreen.updateCursors (theme, size); |
703 | } |
704 | |
705 | /* Returns default viewport for some window geometry. If the window spans |
706 | @@ -5154,15 +5202,10 @@ |
707 | eventManager.setSupportingWmCheck (dpy, rootWindow()); |
708 | screen->updateSupportedWmHints (); |
709 | |
710 | + |
711 | + XIGetClientPointer (dpy, None, &clientPointerDeviceId); |
712 | updateResources (); |
713 | |
714 | - XIGetClientPointer (dpy, None, &clientPointerDeviceId); |
715 | - |
716 | - normalCursor = XCreateFontCursor (dpy, XC_left_ptr); |
717 | - busyCursor = XCreateFontCursor (dpy, XC_watch); |
718 | - |
719 | - XIDefineCursor (dpy, clientPointerDeviceId, rootWindow(), normalCursor); |
720 | - |
721 | /* Attempt to gain SubstructureRedirectMask */ |
722 | CompScreenImpl::checkForError (dpy); |
723 | |
724 | @@ -5337,8 +5380,6 @@ |
725 | currentDesktop (0), |
726 | wmSnSelectionWindow (None), |
727 | clientPointerDeviceId (None), |
728 | - normalCursor (None), |
729 | - busyCursor (None), |
730 | invisibleCursor (None), |
731 | initialized (false), |
732 | screen(screen), |
733 | @@ -5459,11 +5500,8 @@ |
734 | |
735 | eventManager.destroyGrabWindow (dpy); |
736 | |
737 | - if (normalCursor != None) |
738 | - XFreeCursor (dpy, normalCursor); |
739 | - |
740 | - if (busyCursor != None) |
741 | - XFreeCursor (dpy, busyCursor); |
742 | + for (auto cursor : cursors) |
743 | + XFreeCursor (dpy, cursor); |
744 | |
745 | if (invisibleCursor != None) |
746 | XFreeCursor (dpy, invisibleCursor); |
FAILED: Continuous integration, rev:3952 jenkins. qa.ubuntu. com/job/ compiz- ci/103/ jenkins. qa.ubuntu. com/job/ compiz- wily-amd64- ci/48/console jenkins. qa.ubuntu. com/job/ compiz- wily-armhf- ci/48/console jenkins. qa.ubuntu. com/job/ compiz- wily-i386- ci/48/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/compiz- ci/103/ rebuild
http://