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 | 101 | xext | 101 | xext |
6 | 102 | xdamage | 102 | xdamage |
7 | 103 | xcomposite | 103 | xcomposite |
8 | 104 | xcursor | ||
9 | 104 | x11-xcb | 105 | x11-xcb |
10 | 105 | xrandr | 106 | xrandr |
11 | 106 | xinerama | 107 | xinerama |
12 | 107 | 108 | ||
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 | 395 | virtual const char * displayString () = 0; | 395 | virtual const char * displayString () = 0; |
18 | 396 | virtual CompRect getCurrentOutputExtents () = 0; | 396 | virtual CompRect getCurrentOutputExtents () = 0; |
19 | 397 | virtual Cursor normalCursor () = 0; | 397 | virtual Cursor normalCursor () = 0; |
20 | 398 | virtual Cursor cursorCache (unsigned int cursorName) = 0; | ||
21 | 398 | virtual bool grabbed () = 0; | 399 | virtual bool grabbed () = 0; |
22 | 399 | virtual SnDisplay * snDisplay () = 0; | 400 | virtual SnDisplay * snDisplay () = 0; |
23 | 400 | 401 | ||
24 | 401 | 402 | ||
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 | 610 | CompWindowGrabMoveMask | | 610 | CompWindowGrabMoveMask | |
30 | 611 | CompWindowGrabButtonMask); | 611 | CompWindowGrabButtonMask); |
31 | 612 | 612 | ||
33 | 613 | screen->updateGrab (grabIndex, dragCursor); | 613 | screen->updateGrab (grabIndex, screen->cursorCache (XC_fleur)); |
34 | 614 | 614 | ||
35 | 615 | w->raise (); | 615 | w->raise (); |
36 | 616 | w->moveInputFocusTo (); | 616 | w->moveInputFocusTo (); |
37 | @@ -1578,8 +1578,6 @@ | |||
38 | 1578 | upKey = XKeysymToKeycode (s->dpy (), XStringToKeysym ("Up")); | 1578 | upKey = XKeysymToKeycode (s->dpy (), XStringToKeysym ("Up")); |
39 | 1579 | downKey = XKeysymToKeycode (s->dpy (), XStringToKeysym ("Down")); | 1579 | downKey = XKeysymToKeycode (s->dpy (), XStringToKeysym ("Down")); |
40 | 1580 | 1580 | ||
41 | 1581 | dragCursor = XCreateFontCursor (screen->dpy (), XC_fleur); | ||
42 | 1582 | |||
43 | 1583 | EXPOINITBIND (ExpoKey, doExpo); | 1581 | EXPOINITBIND (ExpoKey, doExpo); |
44 | 1584 | EXPOTERMBIND (ExpoKey, termExpo); | 1582 | EXPOTERMBIND (ExpoKey, termExpo); |
45 | 1585 | EXPOINITBIND (ExpoButton, doExpo); | 1583 | EXPOINITBIND (ExpoButton, doExpo); |
46 | @@ -1603,11 +1601,6 @@ | |||
47 | 1603 | GL_RGBA, GL_UNSIGNED_BYTE); | 1601 | GL_RGBA, GL_UNSIGNED_BYTE); |
48 | 1604 | } | 1602 | } |
49 | 1605 | 1603 | ||
50 | 1606 | ExpoScreen::~ExpoScreen () | ||
51 | 1607 | { | ||
52 | 1608 | if (dragCursor != None) | ||
53 | 1609 | XFreeCursor (screen->dpy (), dragCursor); | ||
54 | 1610 | } | ||
55 | 1611 | 1604 | ||
56 | 1612 | ExpoWindow::ExpoWindow (CompWindow *w) : | 1605 | ExpoWindow::ExpoWindow (CompWindow *w) : |
57 | 1613 | PluginClassHandler<ExpoWindow, CompWindow> (w), | 1606 | PluginClassHandler<ExpoWindow, CompWindow> (w), |
58 | 1614 | 1607 | ||
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 | 42 | public: | 42 | public: |
64 | 43 | 43 | ||
65 | 44 | ExpoScreen (CompScreen *); | 44 | ExpoScreen (CompScreen *); |
66 | 45 | ~ExpoScreen (); | ||
67 | 46 | 45 | ||
68 | 47 | void handleEvent (XEvent *); | 46 | void handleEvent (XEvent *); |
69 | 48 | 47 | ||
70 | @@ -153,8 +152,6 @@ | |||
71 | 153 | KeyCode rightKey; | 152 | KeyCode rightKey; |
72 | 154 | KeyCode upKey; | 153 | KeyCode upKey; |
73 | 155 | KeyCode downKey; | 154 | KeyCode downKey; |
74 | 156 | |||
75 | 157 | Cursor dragCursor; | ||
76 | 158 | }; | 155 | }; |
77 | 159 | 156 | ||
78 | 160 | class ExpoWindow : | 157 | class ExpoWindow : |
79 | 161 | 158 | ||
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 | 82 | useW = getRealWindow (w); | 82 | useW = getRealWindow (w); |
85 | 83 | } | 83 | } |
86 | 84 | 84 | ||
87 | 85 | mRotateCursor = XCreateFontCursor (screen->dpy (), XC_fleur); | ||
88 | 86 | |||
89 | 87 | if (!screen->otherGrabExist ("freewins", 0)) | 85 | if (!screen->otherGrabExist ("freewins", 0)) |
90 | 88 | if (!mGrabIndex) | 86 | if (!mGrabIndex) |
91 | 89 | { | 87 | { |
92 | @@ -305,11 +303,9 @@ | |||
93 | 305 | useW = getRealWindow (w); | 303 | useW = getRealWindow (w); |
94 | 306 | } | 304 | } |
95 | 307 | 305 | ||
96 | 308 | mRotateCursor = XCreateFontCursor (screen->dpy (), XC_fleur); | ||
97 | 309 | |||
98 | 310 | if (!screen->otherGrabExist ("freewins", 0)) | 306 | if (!screen->otherGrabExist ("freewins", 0)) |
99 | 311 | if (!mGrabIndex) | 307 | if (!mGrabIndex) |
101 | 312 | mGrabIndex = screen->pushGrab (mRotateCursor, "freewins"); | 308 | mGrabIndex = screen->pushGrab (screen->cursorCache(XC_fleur), "freewins"); |
102 | 313 | } | 309 | } |
103 | 314 | 310 | ||
104 | 315 | if (useW) | 311 | if (useW) |
105 | 316 | 312 | ||
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 | 60 | 60 | ||
111 | 61 | window->activate (); | 61 | window->activate (); |
112 | 62 | mGrab = grabResize; | 62 | mGrab = grabResize; |
113 | 63 | fws->mRotateCursor = XCreateFontCursor (screen->dpy (), XC_plus); | ||
114 | 64 | if(!screen->otherGrabExist ("freewins", "resize", 0)) | 63 | if(!screen->otherGrabExist ("freewins", "resize", 0)) |
115 | 65 | if(!fws->mGrabIndex) | 64 | if(!fws->mGrabIndex) |
116 | 66 | { | 65 | { |
117 | 67 | unsigned int mods = 0; | 66 | unsigned int mods = 0; |
118 | 68 | mods &= CompNoMask; | 67 | mods &= CompNoMask; |
120 | 69 | fws->mGrabIndex = screen->pushGrab (fws->mRotateCursor, "resize"); | 68 | fws->mGrabIndex = screen->pushGrab (screen->cursorCache (XC_plus), "resize"); |
121 | 70 | window->grabNotify (window->x () + (window->width () / 2), | 69 | window->grabNotify (window->x () + (window->width () / 2), |
122 | 71 | window->y () + (window->height () / 2), mods, | 70 | window->y () + (window->height () / 2), mods, |
123 | 72 | CompWindowGrabMoveMask | CompWindowGrabButtonMask); | 71 | CompWindowGrabMoveMask | CompWindowGrabButtonMask); |
124 | @@ -81,13 +80,12 @@ | |||
125 | 81 | 80 | ||
126 | 82 | window->activate (); | 81 | window->activate (); |
127 | 83 | mGrab = grabMove; | 82 | mGrab = grabMove; |
128 | 84 | fws->mRotateCursor = XCreateFontCursor (screen->dpy (), XC_fleur); | ||
129 | 85 | if(!screen->otherGrabExist ("freewins", "resize", 0)) | 83 | if(!screen->otherGrabExist ("freewins", "resize", 0)) |
130 | 86 | if(!fws->mGrabIndex) | 84 | if(!fws->mGrabIndex) |
131 | 87 | { | 85 | { |
132 | 88 | unsigned int mods = 0; | 86 | unsigned int mods = 0; |
133 | 89 | mods &= CompNoMask; | 87 | mods &= CompNoMask; |
135 | 90 | fws->mGrabIndex = screen->pushGrab (fws->mRotateCursor, "resize"); | 88 | fws->mGrabIndex = screen->pushGrab (screen->cursorCache (XC_fleur), "resize"); |
136 | 91 | window->grabNotify (window->x () + (window->width () / 2), | 89 | window->grabNotify (window->x () + (window->width () / 2), |
137 | 92 | window->y () + (window->height () / 2), mods, | 90 | window->y () + (window->height () / 2), mods, |
138 | 93 | CompWindowGrabResizeMask | CompWindowGrabButtonMask); | 91 | CompWindowGrabResizeMask | CompWindowGrabButtonMask); |
139 | 94 | 92 | ||
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 | 281 | int mSnapMask; | 281 | int mSnapMask; |
145 | 282 | int mInvertMask; | 282 | int mInvertMask; |
146 | 283 | 283 | ||
147 | 284 | Cursor mRotateCursor; | ||
148 | 285 | |||
149 | 286 | CompScreen::GrabHandle mGrabIndex; | 284 | CompScreen::GrabHandle mGrabIndex; |
150 | 287 | 285 | ||
151 | 288 | void preparePaint (int); | 286 | void preparePaint (int); |
152 | 289 | 287 | ||
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 | 105 | 105 | ||
158 | 106 | if (!ms->grab) | 106 | if (!ms->grab) |
159 | 107 | { | 107 | { |
160 | 108 | Cursor moveCursor = screen->cursorCache (XC_fleur); | ||
161 | 109 | |||
162 | 108 | if (state & CompAction::StateInitButton) | 110 | if (state & CompAction::StateInitButton) |
164 | 109 | ms->grab = s->pushPointerGrab (ms->moveCursor, "move"); | 111 | ms->grab = s->pushPointerGrab (moveCursor, "move"); |
165 | 110 | else | 112 | else |
167 | 111 | ms->grab = s->pushGrab (ms->moveCursor, "move"); | 113 | ms->grab = s->pushGrab (moveCursor, "move"); |
168 | 112 | } | 114 | } |
169 | 113 | 115 | ||
170 | 114 | if (ms->grab) | 116 | if (ms->grab) |
171 | @@ -716,7 +718,6 @@ | |||
172 | 716 | key[i] = XKeysymToKeycode (screen->dpy (), | 718 | key[i] = XKeysymToKeycode (screen->dpy (), |
173 | 717 | XStringToKeysym (mKeys[i].name)); | 719 | XStringToKeysym (mKeys[i].name)); |
174 | 718 | 720 | ||
175 | 719 | moveCursor = XCreateFontCursor (screen->dpy (), XC_fleur); | ||
176 | 720 | if (cScreen) | 721 | if (cScreen) |
177 | 721 | { | 722 | { |
178 | 722 | CompositeScreenInterface::setHandler (cScreen); | 723 | CompositeScreenInterface::setHandler (cScreen); |
179 | @@ -739,9 +740,6 @@ | |||
180 | 739 | { | 740 | { |
181 | 740 | if (region) | 741 | if (region) |
182 | 741 | XDestroyRegion (region); | 742 | XDestroyRegion (region); |
183 | 742 | |||
184 | 743 | if (moveCursor) | ||
185 | 744 | XFreeCursor (screen->dpy (), moveCursor); | ||
186 | 745 | } | 743 | } |
187 | 746 | 744 | ||
188 | 747 | bool | 745 | bool |
189 | 748 | 746 | ||
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 | 82 | 82 | ||
195 | 83 | CompScreen::GrabHandle grab; | 83 | CompScreen::GrabHandle grab; |
196 | 84 | 84 | ||
197 | 85 | Cursor moveCursor; | ||
198 | 86 | |||
199 | 87 | unsigned int origState; | 85 | unsigned int origState; |
200 | 88 | 86 | ||
201 | 89 | int snapOffX; | 87 | int snapOffX; |
202 | 90 | 88 | ||
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 | 113 | int pointerDx; | 113 | int pointerDx; |
208 | 114 | int pointerDy; | 114 | int pointerDy; |
209 | 115 | KeyCode key[NUM_KEYS]; | 115 | KeyCode key[NUM_KEYS]; |
210 | 116 | unsigned int keyCursorNames[NUM_KEYS]; | ||
211 | 116 | 117 | ||
212 | 117 | CompScreen::GrabHandle grabIndex; | 118 | CompScreen::GrabHandle grabIndex; |
213 | 118 | 119 | ||
214 | 119 | Cursor leftCursor; | ||
215 | 120 | Cursor rightCursor; | ||
216 | 121 | Cursor upCursor; | ||
217 | 122 | Cursor upLeftCursor; | ||
218 | 123 | Cursor upRightCursor; | ||
219 | 124 | Cursor downCursor; | ||
220 | 125 | Cursor downLeftCursor; | ||
221 | 126 | Cursor downRightCursor; | ||
222 | 127 | Cursor middleCursor; | ||
223 | 128 | Cursor cursor[NUM_KEYS]; | ||
224 | 129 | |||
225 | 130 | bool isConstrained; | 120 | bool isConstrained; |
226 | 131 | CompRegion constraintRegion; | 121 | CompRegion constraintRegion; |
227 | 132 | bool inRegionStatus; | 122 | bool inRegionStatus; |
228 | 133 | 123 | ||
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 | 59 | virtual CompScreen::GrabHandle pushPointerGrab (Cursor cursor, const char *name) = 0; | 59 | virtual CompScreen::GrabHandle pushPointerGrab (Cursor cursor, const char *name) = 0; |
234 | 60 | virtual CompScreen::GrabHandle pushKeyboardGrab (const char *name) = 0; | 60 | virtual CompScreen::GrabHandle pushKeyboardGrab (const char *name) = 0; |
235 | 61 | virtual void removeGrab (CompScreen::GrabHandle handle, CompPoint *restorePointer) = 0; | 61 | virtual void removeGrab (CompScreen::GrabHandle handle, CompPoint *restorePointer) = 0; |
236 | 62 | virtual Cursor cursorCache (unsigned int cursorName) = 0; | ||
237 | 62 | 63 | ||
238 | 63 | /* CompOption::Class */ | 64 | /* CompOption::Class */ |
239 | 64 | virtual CompOption * getOption (const CompString &name) = 0; | 65 | virtual CompOption * getOption (const CompString &name) = 0; |
240 | 65 | 66 | ||
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 | 27 | 27 | ||
246 | 28 | #include <core/core.h> | 28 | #include <core/core.h> |
247 | 29 | #include <core/atoms.h> | 29 | #include <core/atoms.h> |
248 | 30 | #include <X11/cursorfont.h> | ||
249 | 30 | 31 | ||
250 | 31 | #include "resize-logic.h" | 32 | #include "resize-logic.h" |
251 | 32 | 33 | ||
252 | @@ -48,6 +49,16 @@ | |||
253 | 48 | static const unsigned short TOUCH_TOP = 3; | 49 | static const unsigned short TOUCH_TOP = 3; |
254 | 49 | static const unsigned short TOUCH_BOTTOM = 4; | 50 | static const unsigned short TOUCH_BOTTOM = 4; |
255 | 50 | 51 | ||
256 | 52 | #define LEFT_CURSOR XC_left_side | ||
257 | 53 | #define RIGHT_CURSOR XC_right_side | ||
258 | 54 | #define UP_CURSOR XC_top_side | ||
259 | 55 | #define UP_LEFT_CURSOR XC_top_left_corner | ||
260 | 56 | #define UP_RIGHT_CURSOR XC_top_right_corner | ||
261 | 57 | #define DOWN_CURSOR XC_bottom_side | ||
262 | 58 | #define DOWN_LEFT_CURSOR XC_bottom_left_corner | ||
263 | 59 | #define DOWN_RIGHT_CURSOR XC_bottom_right_corner | ||
264 | 60 | #define MIDDLE_CURSOR XC_fleur | ||
265 | 61 | |||
266 | 51 | using namespace resize; | 62 | using namespace resize; |
267 | 52 | 63 | ||
268 | 53 | ResizeLogic::ResizeLogic() : | 64 | ResizeLogic::ResizeLogic() : |
269 | @@ -428,7 +439,7 @@ | |||
270 | 428 | lastMaskY = mask; | 439 | lastMaskY = mask; |
271 | 429 | } | 440 | } |
272 | 430 | 441 | ||
274 | 431 | mScreen->updateGrab (grabIndex, cursor[i]); | 442 | mScreen->updateGrab (grabIndex, screen->cursorCache (keyCursorNames[i])); |
275 | 432 | } | 443 | } |
276 | 433 | break; | 444 | break; |
277 | 434 | } | 445 | } |
278 | @@ -652,36 +663,36 @@ | |||
279 | 652 | Cursor | 663 | Cursor |
280 | 653 | ResizeLogic::cursorFromResizeMask (unsigned int mask) | 664 | ResizeLogic::cursorFromResizeMask (unsigned int mask) |
281 | 654 | { | 665 | { |
283 | 655 | Cursor cursor; | 666 | unsigned int cursor_name; |
284 | 656 | 667 | ||
285 | 657 | if (mask & ResizeLeftMask) | 668 | if (mask & ResizeLeftMask) |
286 | 658 | { | 669 | { |
287 | 659 | if (mask & ResizeDownMask) | 670 | if (mask & ResizeDownMask) |
289 | 660 | cursor = downLeftCursor; | 671 | cursor_name = DOWN_LEFT_CURSOR; |
290 | 661 | else if (mask & ResizeUpMask) | 672 | else if (mask & ResizeUpMask) |
292 | 662 | cursor = upLeftCursor; | 673 | cursor_name = UP_LEFT_CURSOR; |
293 | 663 | else | 674 | else |
295 | 664 | cursor = leftCursor; | 675 | cursor_name = LEFT_CURSOR; |
296 | 665 | } | 676 | } |
297 | 666 | else if (mask & ResizeRightMask) | 677 | else if (mask & ResizeRightMask) |
298 | 667 | { | 678 | { |
299 | 668 | if (mask & ResizeDownMask) | 679 | if (mask & ResizeDownMask) |
301 | 669 | cursor = downRightCursor; | 680 | cursor_name = DOWN_RIGHT_CURSOR; |
302 | 670 | else if (mask & ResizeUpMask) | 681 | else if (mask & ResizeUpMask) |
304 | 671 | cursor = upRightCursor; | 682 | cursor_name = UP_RIGHT_CURSOR; |
305 | 672 | else | 683 | else |
307 | 673 | cursor = rightCursor; | 684 | cursor_name = RIGHT_CURSOR; |
308 | 674 | } | 685 | } |
309 | 675 | else if (mask & ResizeUpMask) | 686 | else if (mask & ResizeUpMask) |
310 | 676 | { | 687 | { |
312 | 677 | cursor = upCursor; | 688 | cursor_name = UP_CURSOR; |
313 | 678 | } | 689 | } |
314 | 679 | else | 690 | else |
315 | 680 | { | 691 | { |
317 | 681 | cursor = downCursor; | 692 | cursor_name = DOWN_CURSOR; |
318 | 682 | } | 693 | } |
319 | 683 | 694 | ||
321 | 684 | return cursor; | 695 | return screen->cursorCache (cursor_name); |
322 | 685 | } | 696 | } |
323 | 686 | 697 | ||
324 | 687 | void | 698 | void |
325 | @@ -1327,7 +1338,7 @@ | |||
326 | 1327 | Cursor cursor; | 1338 | Cursor cursor; |
327 | 1328 | 1339 | ||
328 | 1329 | if (state & CompAction::StateInitKey) | 1340 | if (state & CompAction::StateInitKey) |
330 | 1330 | cursor = middleCursor; | 1341 | cursor = screen->cursorCache (MIDDLE_CURSOR); |
331 | 1331 | else | 1342 | else |
332 | 1332 | cursor = cursorFromResizeMask (mask); | 1343 | cursor = cursorFromResizeMask (mask); |
333 | 1333 | 1344 | ||
334 | 1334 | 1345 | ||
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 | 54 | MOCK_METHOD2(pushPointerGrab, CompScreen::GrabHandle(Cursor cursor, const char *name)); | 54 | MOCK_METHOD2(pushPointerGrab, CompScreen::GrabHandle(Cursor cursor, const char *name)); |
340 | 55 | MOCK_METHOD1(pushKeyboardGrab, CompScreen::GrabHandle(const char *name)); | 55 | MOCK_METHOD1(pushKeyboardGrab, CompScreen::GrabHandle(const char *name)); |
341 | 56 | MOCK_METHOD2(removeGrab, void(CompScreen::GrabHandle handle, CompPoint *restorePointer)); | 56 | MOCK_METHOD2(removeGrab, void(CompScreen::GrabHandle handle, CompPoint *restorePointer)); |
342 | 57 | MOCK_METHOD1(cursorCache, Cursor (unsigned int)); | ||
343 | 57 | 58 | ||
344 | 58 | MOCK_METHOD1(getOption, CompOption*(const CompString &name)); | 59 | MOCK_METHOD1(getOption, CompOption*(const CompString &name)); |
345 | 59 | 60 | ||
346 | 60 | 61 | ||
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 | 380 | logic.options = this; | 380 | logic.options = this; |
352 | 381 | 381 | ||
353 | 382 | CompOption::Vector atomTemplate; | 382 | CompOption::Vector atomTemplate; |
354 | 383 | Display *dpy = s->dpy (); | ||
355 | 384 | ResizeOptions::ChangeNotify notify = | 383 | ResizeOptions::ChangeNotify notify = |
356 | 385 | boost::bind (&ResizeScreen::optionChanged, this, _1, _2); | 384 | boost::bind (&ResizeScreen::optionChanged, this, _1, _2); |
357 | 386 | 385 | ||
358 | @@ -404,21 +403,6 @@ | |||
359 | 404 | for (unsigned int i = 0; i < NUM_KEYS; i++) | 403 | for (unsigned int i = 0; i < NUM_KEYS; i++) |
360 | 405 | logic.key[i] = XKeysymToKeycode (s->dpy (), XStringToKeysym (logic.rKeys[i].name)); | 404 | logic.key[i] = XKeysymToKeycode (s->dpy (), XStringToKeysym (logic.rKeys[i].name)); |
361 | 406 | 405 | ||
362 | 407 | logic.leftCursor = XCreateFontCursor (dpy, XC_left_side); | ||
363 | 408 | logic.rightCursor = XCreateFontCursor (dpy, XC_right_side); | ||
364 | 409 | logic.upCursor = XCreateFontCursor (dpy, XC_top_side); | ||
365 | 410 | logic.upLeftCursor = XCreateFontCursor (dpy, XC_top_left_corner); | ||
366 | 411 | logic.upRightCursor = XCreateFontCursor (dpy, XC_top_right_corner); | ||
367 | 412 | logic.downCursor = XCreateFontCursor (dpy, XC_bottom_side); | ||
368 | 413 | logic.downLeftCursor = XCreateFontCursor (dpy, XC_bottom_left_corner); | ||
369 | 414 | logic.downRightCursor = XCreateFontCursor (dpy, XC_bottom_right_corner); | ||
370 | 415 | logic.middleCursor = XCreateFontCursor (dpy, XC_fleur); | ||
371 | 416 | |||
372 | 417 | logic.cursor[0] = logic.leftCursor; | ||
373 | 418 | logic.cursor[1] = logic.rightCursor; | ||
374 | 419 | logic.cursor[2] = logic.upCursor; | ||
375 | 420 | logic.cursor[3] = logic.downCursor; | ||
376 | 421 | |||
377 | 422 | optionSetInitiateKeyInitiate (resizeInitiateDefaultMode); | 406 | optionSetInitiateKeyInitiate (resizeInitiateDefaultMode); |
378 | 423 | optionSetInitiateKeyTerminate (resizeTerminate); | 407 | optionSetInitiateKeyTerminate (resizeTerminate); |
379 | 424 | optionSetInitiateButtonInitiate (resizeInitiateDefaultMode); | 408 | optionSetInitiateButtonInitiate (resizeInitiateDefaultMode); |
380 | @@ -442,27 +426,6 @@ | |||
381 | 442 | 426 | ||
382 | 443 | ResizeScreen::~ResizeScreen () | 427 | ResizeScreen::~ResizeScreen () |
383 | 444 | { | 428 | { |
384 | 445 | Display *dpy = screen->dpy (); | ||
385 | 446 | |||
386 | 447 | if (logic.leftCursor) | ||
387 | 448 | XFreeCursor (dpy, logic.leftCursor); | ||
388 | 449 | if (logic.rightCursor) | ||
389 | 450 | XFreeCursor (dpy, logic.rightCursor); | ||
390 | 451 | if (logic.upCursor) | ||
391 | 452 | XFreeCursor (dpy, logic.upCursor); | ||
392 | 453 | if (logic.downCursor) | ||
393 | 454 | XFreeCursor (dpy, logic.downCursor); | ||
394 | 455 | if (logic.middleCursor) | ||
395 | 456 | XFreeCursor (dpy, logic.middleCursor); | ||
396 | 457 | if (logic.upLeftCursor) | ||
397 | 458 | XFreeCursor (dpy, logic.upLeftCursor); | ||
398 | 459 | if (logic.upRightCursor) | ||
399 | 460 | XFreeCursor (dpy, logic.upRightCursor); | ||
400 | 461 | if (logic.downLeftCursor) | ||
401 | 462 | XFreeCursor (dpy, logic.downLeftCursor); | ||
402 | 463 | if (logic.downRightCursor) | ||
403 | 464 | XFreeCursor (dpy, logic.downRightCursor); | ||
404 | 465 | |||
405 | 466 | delete logic.mScreen; | 429 | delete logic.mScreen; |
406 | 467 | delete logic.cScreen; | 430 | delete logic.cScreen; |
407 | 468 | delete logic.gScreen; | 431 | delete logic.gScreen; |
408 | 469 | 432 | ||
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 | 134 | return mImpl->height (); | 134 | return mImpl->height (); |
414 | 135 | } | 135 | } |
415 | 136 | 136 | ||
416 | 137 | virtual Cursor cursorCache (unsigned int cursorName) | ||
417 | 138 | { | ||
418 | 139 | return mImpl->cursorCache (cursorName); | ||
419 | 140 | } | ||
420 | 141 | |||
421 | 137 | private: | 142 | private: |
422 | 138 | CompScreen *mImpl; | 143 | CompScreen *mImpl; |
423 | 139 | }; | 144 | }; |
424 | 140 | 145 | ||
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 | 509 | { | 509 | { |
430 | 510 | window->activate (); | 510 | window->activate (); |
431 | 511 | ss->grabbedWindow = window->id (); | 511 | ss->grabbedWindow = window->id (); |
433 | 512 | ss->grabIndex = screen->pushGrab (ss->moveCursor, "shelf"); | 512 | ss->grabIndex = screen->pushGrab (screen->cursorCache (XC_fleur), "shelf"); |
434 | 513 | 513 | ||
435 | 514 | ss->lastPointerX = x; | 514 | ss->lastPointerX = x; |
436 | 515 | ss->lastPointerY = y; | 515 | ss->lastPointerY = y; |
437 | @@ -760,7 +760,6 @@ | |||
438 | 760 | gScreen (GLScreen::get (screen)), | 760 | gScreen (GLScreen::get (screen)), |
439 | 761 | grabIndex (0), | 761 | grabIndex (0), |
440 | 762 | grabbedWindow (None), | 762 | grabbedWindow (None), |
441 | 763 | moveCursor (XCreateFontCursor (screen->dpy (), XC_fleur)), | ||
442 | 764 | lastPointerX (0), | 763 | lastPointerX (0), |
443 | 765 | lastPointerY (0) | 764 | lastPointerY (0) |
444 | 766 | { | 765 | { |
445 | @@ -780,11 +779,6 @@ | |||
446 | 780 | _3)); | 779 | _3)); |
447 | 781 | } | 780 | } |
448 | 782 | 781 | ||
449 | 783 | ShelfScreen::~ShelfScreen () | ||
450 | 784 | { | ||
451 | 785 | if (moveCursor) | ||
452 | 786 | XFreeCursor (screen->dpy (), moveCursor); | ||
453 | 787 | } | ||
454 | 788 | 782 | ||
455 | 789 | ShelfWindow::ShelfWindow (CompWindow *window) : | 783 | ShelfWindow::ShelfWindow (CompWindow *window) : |
456 | 790 | PluginClassHandler <ShelfWindow, CompWindow> (window), | 784 | PluginClassHandler <ShelfWindow, CompWindow> (window), |
457 | 791 | 785 | ||
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 | 145 | public: | 145 | public: |
463 | 146 | 146 | ||
464 | 147 | ShelfScreen (CompScreen *); | 147 | ShelfScreen (CompScreen *); |
465 | 148 | ~ShelfScreen (); | ||
466 | 149 | 148 | ||
467 | 150 | CompositeScreen *cScreen; | 149 | CompositeScreen *cScreen; |
468 | 151 | GLScreen *gScreen; | 150 | GLScreen *gScreen; |
469 | 152 | 151 | ||
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 | 1968 | mMvTarget (0), | 1968 | mMvTarget (0), |
475 | 1969 | mMvVelocity (0), | 1969 | mMvVelocity (0), |
476 | 1970 | mInvert (false), | 1970 | mInvert (false), |
477 | 1971 | mCursor (XCreateFontCursor (screen->dpy (), XC_left_ptr)), | ||
478 | 1972 | mWindows (NULL), | 1971 | mWindows (NULL), |
479 | 1973 | mNWindows (0), | 1972 | mNWindows (0), |
480 | 1974 | mWindowsSize (0), | 1973 | mWindowsSize (0), |
481 | @@ -2059,8 +2058,6 @@ | |||
482 | 2059 | { | 2058 | { |
483 | 2060 | freeWindowTitle (); | 2059 | freeWindowTitle (); |
484 | 2061 | 2060 | ||
485 | 2062 | XFreeCursor (screen->dpy (), mCursor); | ||
486 | 2063 | |||
487 | 2064 | if (mWindows) | 2061 | if (mWindows) |
488 | 2065 | free (mWindows); | 2062 | free (mWindows); |
489 | 2066 | 2063 | ||
490 | 2067 | 2064 | ||
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 | 143 | float mMvVelocity; | 143 | float mMvVelocity; |
496 | 144 | bool mInvert; | 144 | bool mInvert; |
497 | 145 | 145 | ||
498 | 146 | Cursor mCursor; | ||
499 | 147 | |||
500 | 148 | /* only used for sorting */ | 146 | /* only used for sorting */ |
501 | 149 | CompWindow **mWindows; | 147 | CompWindow **mWindows; |
502 | 150 | int mNWindows; | 148 | int mNWindows; |
503 | 151 | 149 | ||
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 | 312 | } | 312 | } |
509 | 313 | 313 | ||
510 | 314 | if (!mGrabIndex) | 314 | if (!mGrabIndex) |
512 | 315 | mGrabIndex = screen->pushGrab (mCursor, "widget"); | 315 | mGrabIndex = screen->pushGrab (screen->cursorCache (XC_watch), "widget"); |
513 | 316 | 316 | ||
514 | 317 | enableFunctions (this, true); | 317 | enableFunctions (this, true); |
515 | 318 | 318 | ||
516 | @@ -672,8 +672,7 @@ | |||
517 | 672 | mLastActiveWindow (None), | 672 | mLastActiveWindow (None), |
518 | 673 | mCompizWidgetAtom (XInternAtom (screen->dpy (), "_COMPIZ_WIDGET", false)), | 673 | mCompizWidgetAtom (XInternAtom (screen->dpy (), "_COMPIZ_WIDGET", false)), |
519 | 674 | mFadeTime (0), | 674 | mFadeTime (0), |
522 | 675 | mGrabIndex (0), | 675 | mGrabIndex (0) |
521 | 676 | mCursor (XCreateFontCursor (screen->dpy (), XC_watch)) | ||
523 | 677 | { | 676 | { |
524 | 678 | CompAction::CallBack cb; | 677 | CompAction::CallBack cb; |
525 | 679 | ChangeNotify notify; | 678 | ChangeNotify notify; |
526 | @@ -706,9 +705,6 @@ | |||
527 | 706 | { | 705 | { |
528 | 707 | screen->matchExpHandlerChangedSetEnabled (this, false); | 706 | screen->matchExpHandlerChangedSetEnabled (this, false); |
529 | 708 | screen->matchExpHandlerChanged (); | 707 | screen->matchExpHandlerChanged (); |
530 | 709 | |||
531 | 710 | if (mCursor) | ||
532 | 711 | XFreeCursor (screen->dpy (), mCursor); | ||
533 | 712 | } | 708 | } |
534 | 713 | 709 | ||
535 | 714 | WidgetWindow::WidgetWindow (CompWindow *window) : | 710 | WidgetWindow::WidgetWindow (CompWindow *window) : |
536 | 715 | 711 | ||
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 | 107 | WidgetState mState; | 107 | WidgetState mState; |
542 | 108 | int mFadeTime; | 108 | int mFadeTime; |
543 | 109 | CompScreen::GrabHandle mGrabIndex; | 109 | CompScreen::GrabHandle mGrabIndex; |
544 | 110 | Cursor mCursor; | ||
545 | 111 | }; | 110 | }; |
546 | 112 | 111 | ||
547 | 113 | #define WIDGET_SCREEN(screen) \ | 112 | #define WIDGET_SCREEN(screen) \ |
548 | 114 | 113 | ||
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 | 710 | 710 | ||
554 | 711 | void setDefaultWindowAttributes (XWindowAttributes *); | 711 | void setDefaultWindowAttributes (XWindowAttributes *); |
555 | 712 | 712 | ||
556 | 713 | void updateCursors (const CompString& theme, int size); | ||
557 | 714 | |||
558 | 715 | Cursor cursorCache (unsigned int cursorName); | ||
559 | 716 | |||
560 | 713 | static void compScreenSnEvent (SnMonitorEvent *event, | 717 | static void compScreenSnEvent (SnMonitorEvent *event, |
561 | 714 | void *userData); | 718 | void *userData); |
562 | 715 | 719 | ||
563 | @@ -777,9 +781,8 @@ | |||
564 | 777 | Window wmSnSelectionWindow; | 781 | Window wmSnSelectionWindow; |
565 | 778 | 782 | ||
566 | 779 | int clientPointerDeviceId; | 783 | int clientPointerDeviceId; |
567 | 780 | Cursor normalCursor; | ||
568 | 781 | Cursor busyCursor; | ||
569 | 782 | Cursor invisibleCursor; | 784 | Cursor invisibleCursor; |
570 | 785 | std::vector<Cursor> cursors; | ||
571 | 783 | CompRect workArea; | 786 | CompRect workArea; |
572 | 784 | 787 | ||
573 | 785 | bool initialized; | 788 | bool initialized; |
574 | @@ -969,8 +972,8 @@ | |||
575 | 969 | void unhookServerWindow (CompWindow *w); | 972 | void unhookServerWindow (CompWindow *w); |
576 | 970 | 973 | ||
577 | 971 | Cursor normalCursor (); | 974 | Cursor normalCursor (); |
578 | 972 | |||
579 | 973 | Cursor invisibleCursor (); | 975 | Cursor invisibleCursor (); |
580 | 976 | Cursor cursorCache (unsigned int cursorName); | ||
581 | 974 | 977 | ||
582 | 975 | /* Adds an X Pointer and Keyboard grab to the stack. Since | 978 | /* Adds an X Pointer and Keyboard grab to the stack. Since |
583 | 976 | * compiz as a client only need to grab once, multiple clients | 979 | * compiz as a client only need to grab once, multiple clients |
584 | 977 | 980 | ||
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 | 178 | MOCK_METHOD0(displayString, const char * ()); | 178 | MOCK_METHOD0(displayString, const char * ()); |
590 | 179 | MOCK_METHOD0(getCurrentOutputExtents, CompRect ()); | 179 | MOCK_METHOD0(getCurrentOutputExtents, CompRect ()); |
591 | 180 | MOCK_METHOD0(normalCursor, Cursor ()); | 180 | MOCK_METHOD0(normalCursor, Cursor ()); |
592 | 181 | MOCK_METHOD1(cursorCache, Cursor (unsigned int)); | ||
593 | 181 | MOCK_METHOD0(grabbed, bool ()); | 182 | MOCK_METHOD0(grabbed, bool ()); |
594 | 182 | MOCK_METHOD0(snDisplay, SnDisplay * ()); | 183 | MOCK_METHOD0(snDisplay, SnDisplay * ()); |
595 | 183 | MOCK_CONST_METHOD0(createFailed, bool ()); | 184 | MOCK_CONST_METHOD0(createFailed, bool ()); |
596 | 184 | 185 | ||
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 | 54 | #include <X11/extensions/shape.h> | 54 | #include <X11/extensions/shape.h> |
602 | 55 | #include <X11/cursorfont.h> | 55 | #include <X11/cursorfont.h> |
603 | 56 | #include <X11/extensions/XInput2.h> | 56 | #include <X11/extensions/XInput2.h> |
604 | 57 | #include <X11/Xcursor/Xcursor.h> | ||
605 | 57 | 58 | ||
606 | 58 | #include <core/global.h> | 59 | #include <core/global.h> |
607 | 59 | #include <core/screen.h> | 60 | #include <core/screen.h> |
608 | @@ -78,10 +79,12 @@ | |||
609 | 78 | namespace | 79 | namespace |
610 | 79 | { | 80 | { |
611 | 80 | bool inHandleEvent = false; | 81 | bool inHandleEvent = false; |
612 | 81 | |||
613 | 82 | bool screenInitalized = false; | 82 | bool screenInitalized = false; |
614 | 83 | } | 83 | } |
615 | 84 | 84 | ||
616 | 85 | #define normalCursorName XC_left_ptr | ||
617 | 86 | #define busyCursorName XC_watch | ||
618 | 87 | |||
619 | 85 | #define MwmHintsFunctions (1L << 0) | 88 | #define MwmHintsFunctions (1L << 0) |
620 | 86 | #define MwmHintsDecorations (1L << 1) | 89 | #define MwmHintsDecorations (1L << 1) |
621 | 87 | static const unsigned short PropMotifWmHintElements = 3; | 90 | static const unsigned short PropMotifWmHintElements = 3; |
622 | @@ -2149,9 +2152,9 @@ | |||
623 | 2149 | if (priv->initialized) | 2152 | if (priv->initialized) |
624 | 2150 | { | 2153 | { |
625 | 2151 | if (!emptySequence()) | 2154 | if (!emptySequence()) |
627 | 2152 | XIDefineCursor (priv->dpy, priv->clientPointerDeviceId, priv->rootWindow(), priv->busyCursor); | 2155 | XIDefineCursor (priv->dpy, priv->clientPointerDeviceId, priv->rootWindow(), priv->cursorCache (busyCursorName)); |
628 | 2153 | else | 2156 | else |
630 | 2154 | XIDefineCursor (priv->dpy, priv->clientPointerDeviceId, priv->rootWindow(), priv->normalCursor); | 2157 | XIDefineCursor (priv->dpy, priv->clientPointerDeviceId, priv->rootWindow(), priv->cursorCache (normalCursorName)); |
631 | 2155 | } | 2158 | } |
632 | 2156 | } | 2159 | } |
633 | 2157 | 2160 | ||
634 | @@ -3083,7 +3086,7 @@ | |||
635 | 3083 | Cursor | 3086 | Cursor |
636 | 3084 | CompScreenImpl::normalCursor () | 3087 | CompScreenImpl::normalCursor () |
637 | 3085 | { | 3088 | { |
639 | 3086 | return privateScreen.normalCursor; | 3089 | return privateScreen.cursorCache (normalCursorName); |
640 | 3087 | } | 3090 | } |
641 | 3088 | 3091 | ||
642 | 3089 | Cursor | 3092 | Cursor |
643 | @@ -3092,6 +3095,12 @@ | |||
644 | 3092 | return privateScreen.invisibleCursor; | 3095 | return privateScreen.invisibleCursor; |
645 | 3093 | } | 3096 | } |
646 | 3094 | 3097 | ||
647 | 3098 | Cursor | ||
648 | 3099 | CompScreenImpl::cursorCache (unsigned int cursorName) | ||
649 | 3100 | { | ||
650 | 3101 | return privateScreen.cursorCache (cursorName); | ||
651 | 3102 | } | ||
652 | 3103 | |||
653 | 3095 | #define POINTER_GRAB_MASK (ButtonReleaseMask | \ | 3104 | #define POINTER_GRAB_MASK (ButtonReleaseMask | \ |
654 | 3096 | ButtonPressMask | \ | 3105 | ButtonPressMask | \ |
655 | 3097 | PointerMotionMask) | 3106 | PointerMotionMask) |
656 | @@ -4153,8 +4162,47 @@ | |||
657 | 4153 | _cursorChangeNotify (theme, size); | 4162 | _cursorChangeNotify (theme, size); |
658 | 4154 | } | 4163 | } |
659 | 4155 | 4164 | ||
662 | 4156 | void CompScreenImpl::_cursorChangeNotify (const CompString&, int) | 4165 | Cursor |
663 | 4157 | { | 4166 | PrivateScreen::cursorCache (unsigned int cursorName) |
664 | 4167 | { | ||
665 | 4168 | if (cursorName >= XC_num_glyphs) | ||
666 | 4169 | return 0; | ||
667 | 4170 | |||
668 | 4171 | if (cursors.size() > cursorName && cursors[cursorName]) | ||
669 | 4172 | return cursors[cursorName]; | ||
670 | 4173 | |||
671 | 4174 | cursors.resize(std::max<size_t>(cursorName + 1, cursors.size()), 0); | ||
672 | 4175 | cursors[cursorName] = XCreateFontCursor (dpy, cursorName); | ||
673 | 4176 | |||
674 | 4177 | return cursors[cursorName]; | ||
675 | 4178 | } | ||
676 | 4179 | |||
677 | 4180 | void | ||
678 | 4181 | PrivateScreen::updateCursors (const CompString& theme, int size) | ||
679 | 4182 | { | ||
680 | 4183 | if (size > 0) | ||
681 | 4184 | XcursorSetDefaultSize (dpy, size); | ||
682 | 4185 | |||
683 | 4186 | if (!theme.empty()) | ||
684 | 4187 | XcursorSetTheme (dpy, theme.c_str()); | ||
685 | 4188 | |||
686 | 4189 | for (auto it = begin (cursors); it != end (cursors); ++it) | ||
687 | 4190 | { | ||
688 | 4191 | if (*it) | ||
689 | 4192 | { | ||
690 | 4193 | XFreeCursor (dpy, *it); | ||
691 | 4194 | *it = XCreateFontCursor (dpy, it - begin (cursors)); | ||
692 | 4195 | } | ||
693 | 4196 | } | ||
694 | 4197 | |||
695 | 4198 | XIDefineCursor (dpy, clientPointerDeviceId, root, cursorCache (normalCursorName)); | ||
696 | 4199 | startupSequence.updateStartupFeedback (); | ||
697 | 4200 | } | ||
698 | 4201 | |||
699 | 4202 | void | ||
700 | 4203 | CompScreenImpl::_cursorChangeNotify (const CompString& theme, int size) | ||
701 | 4204 | { | ||
702 | 4205 | privateScreen.updateCursors (theme, size); | ||
703 | 4158 | } | 4206 | } |
704 | 4159 | 4207 | ||
705 | 4160 | /* Returns default viewport for some window geometry. If the window spans | 4208 | /* Returns default viewport for some window geometry. If the window spans |
706 | @@ -5154,15 +5202,10 @@ | |||
707 | 5154 | eventManager.setSupportingWmCheck (dpy, rootWindow()); | 5202 | eventManager.setSupportingWmCheck (dpy, rootWindow()); |
708 | 5155 | screen->updateSupportedWmHints (); | 5203 | screen->updateSupportedWmHints (); |
709 | 5156 | 5204 | ||
710 | 5205 | |||
711 | 5206 | XIGetClientPointer (dpy, None, &clientPointerDeviceId); | ||
712 | 5157 | updateResources (); | 5207 | updateResources (); |
713 | 5158 | 5208 | ||
714 | 5159 | XIGetClientPointer (dpy, None, &clientPointerDeviceId); | ||
715 | 5160 | |||
716 | 5161 | normalCursor = XCreateFontCursor (dpy, XC_left_ptr); | ||
717 | 5162 | busyCursor = XCreateFontCursor (dpy, XC_watch); | ||
718 | 5163 | |||
719 | 5164 | XIDefineCursor (dpy, clientPointerDeviceId, rootWindow(), normalCursor); | ||
720 | 5165 | |||
721 | 5166 | /* Attempt to gain SubstructureRedirectMask */ | 5209 | /* Attempt to gain SubstructureRedirectMask */ |
722 | 5167 | CompScreenImpl::checkForError (dpy); | 5210 | CompScreenImpl::checkForError (dpy); |
723 | 5168 | 5211 | ||
724 | @@ -5337,8 +5380,6 @@ | |||
725 | 5337 | currentDesktop (0), | 5380 | currentDesktop (0), |
726 | 5338 | wmSnSelectionWindow (None), | 5381 | wmSnSelectionWindow (None), |
727 | 5339 | clientPointerDeviceId (None), | 5382 | clientPointerDeviceId (None), |
728 | 5340 | normalCursor (None), | ||
729 | 5341 | busyCursor (None), | ||
730 | 5342 | invisibleCursor (None), | 5383 | invisibleCursor (None), |
731 | 5343 | initialized (false), | 5384 | initialized (false), |
732 | 5344 | screen(screen), | 5385 | screen(screen), |
733 | @@ -5459,11 +5500,8 @@ | |||
734 | 5459 | 5500 | ||
735 | 5460 | eventManager.destroyGrabWindow (dpy); | 5501 | eventManager.destroyGrabWindow (dpy); |
736 | 5461 | 5502 | ||
742 | 5462 | if (normalCursor != None) | 5503 | for (auto cursor : cursors) |
743 | 5463 | XFreeCursor (dpy, normalCursor); | 5504 | XFreeCursor (dpy, cursor); |
739 | 5464 | |||
740 | 5465 | if (busyCursor != None) | ||
741 | 5466 | XFreeCursor (dpy, busyCursor); | ||
744 | 5467 | 5505 | ||
745 | 5468 | if (invisibleCursor != None) | 5506 | if (invisibleCursor != None) |
746 | 5469 | XFreeCursor (dpy, invisibleCursor); | 5507 | 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://