Merge lp:~3v1n0/compiz/push-grab-types into lp:compiz/0.9.12
- push-grab-types
- Merge into 0.9.12
Status: | Merged |
---|---|
Approved by: | Andrea Azzarone |
Approved revision: | 3935 |
Merged at revision: | 3983 |
Proposed branch: | lp:~3v1n0/compiz/push-grab-types |
Merge into: | lp:compiz/0.9.12 |
Diff against target: |
467 lines (+189/-73) 5 files modified
include/core/abiversion.h (+1/-1) include/core/screen.h (+2/-0) src/privatescreen.h (+31/-15) src/privatescreen/tests/test-privatescreen.cpp (+2/-0) src/screen.cpp (+153/-57) |
To merge this branch: | bzr merge lp:~3v1n0/compiz/push-grab-types |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
MC Return | Approve | ||
Andrea Azzarone | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Review via email: mp+271585@code.launchpad.net |
Commit message
Screen: add pushKeyboardGrab and pushPointerGrab methods to add different kinds of grabs
Description of the change
PS Jenkins bot (ps-jenkins) wrote : | # |
- 3932. By Marco Trevisan (Treviño)
-
debian/
patches/ ubuntu_ super_p. patch: refresh to fix merging
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3932
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 3933. By Marco Trevisan (Treviño)
-
Screen: use GrabType when calling removing or updating a Grab
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3933
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 3934. By Marco Trevisan (Treviño)
-
Screen: add missing space
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3934
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 3935. By Marco Trevisan (Treviño)
-
Screen: properly ungrab / change grab owners depending on the grab types
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3935
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 3936. By Marco Trevisan (Treviño)
-
PrivateScreen: fix typo in GrabType definition
- 3937. By Marco Trevisan (Treviño)
-
Merging with trunk
MC Return (mc-return) wrote : | # |
I'm late to the party, but wanted to express a:
Great job on that one, Marco. +1
Very useful separation indeed. Top Job.
Preview Diff
1 | === modified file 'include/core/abiversion.h' | |||
2 | --- include/core/abiversion.h 2015-02-17 14:57:27 +0000 | |||
3 | +++ include/core/abiversion.h 2015-10-26 17:12:40 +0000 | |||
4 | @@ -5,6 +5,6 @@ | |||
5 | 5 | # error Conflicting definitions of CORE_ABIVERSION | 5 | # error Conflicting definitions of CORE_ABIVERSION |
6 | 6 | #endif | 6 | #endif |
7 | 7 | 7 | ||
9 | 8 | #define CORE_ABIVERSION 20150217 | 8 | #define CORE_ABIVERSION 20150918 |
10 | 9 | 9 | ||
11 | 10 | #endif // COMPIZ_ABIVERSION_H | 10 | #endif // COMPIZ_ABIVERSION_H |
12 | 11 | 11 | ||
13 | === modified file 'include/core/screen.h' | |||
14 | --- include/core/screen.h 2012-12-03 10:36:42 +0000 | |||
15 | +++ include/core/screen.h 2015-10-26 17:12:40 +0000 | |||
16 | @@ -364,6 +364,8 @@ | |||
17 | 364 | virtual CompIcon *defaultIcon () const = 0; | 364 | virtual CompIcon *defaultIcon () const = 0; |
18 | 365 | virtual bool otherGrabExist (const char *, ...) = 0; | 365 | virtual bool otherGrabExist (const char *, ...) = 0; |
19 | 366 | virtual GrabHandle pushGrab (Cursor cursor, const char *name) = 0; | 366 | virtual GrabHandle pushGrab (Cursor cursor, const char *name) = 0; |
20 | 367 | virtual GrabHandle pushPointerGrab (Cursor cursor, const char *name) = 0; | ||
21 | 368 | virtual GrabHandle pushKeyboardGrab (const char *name) = 0; | ||
22 | 367 | virtual void removeGrab (GrabHandle handle, CompPoint *restorePointer) = 0; | 369 | virtual void removeGrab (GrabHandle handle, CompPoint *restorePointer) = 0; |
23 | 368 | virtual bool writeImageToFile (CompString &path, | 370 | virtual bool writeImageToFile (CompString &path, |
24 | 369 | const char *format, | 371 | const char *format, |
25 | 370 | 372 | ||
26 | === modified file 'src/privatescreen.h' | |||
27 | --- src/privatescreen.h 2014-12-02 19:37:10 +0000 | |||
28 | +++ src/privatescreen.h 2015-10-26 17:12:40 +0000 | |||
29 | @@ -239,6 +239,20 @@ | |||
30 | 239 | CompStringSet blacklist; | 239 | CompStringSet blacklist; |
31 | 240 | }; | 240 | }; |
32 | 241 | 241 | ||
33 | 242 | enum GrabType { | ||
34 | 243 | POINTER = 1 << 0, | ||
35 | 244 | KEYBOARD = 1 << 1, | ||
36 | 245 | ALL = POINTER|KEYBOARD | ||
37 | 246 | }; | ||
38 | 247 | |||
39 | 248 | struct Grab { | ||
40 | 249 | Grab (GrabType type, Cursor cursor, const char *name) : type(type), cursor(cursor), name(name) {} | ||
41 | 250 | Grab (Cursor cursor, const char *name) : Grab(GrabType::ALL, cursor, name) {} | ||
42 | 251 | GrabType type; | ||
43 | 252 | Cursor cursor; | ||
44 | 253 | const char *name; | ||
45 | 254 | }; | ||
46 | 255 | |||
47 | 242 | class GrabList | 256 | class GrabList |
48 | 243 | { | 257 | { |
49 | 244 | // TODO: std::list<Grab *> is almost certainly the wrong data | 258 | // TODO: std::list<Grab *> is almost certainly the wrong data |
50 | @@ -249,13 +263,14 @@ | |||
51 | 249 | public: | 263 | public: |
52 | 250 | typedef GrabPtrList::iterator GrabIterator; | 264 | typedef GrabPtrList::iterator GrabIterator; |
53 | 251 | 265 | ||
59 | 252 | bool grabsEmpty() const { return grabs.empty(); } | 266 | bool grabsEmpty () const { return grabs.empty (); } |
60 | 253 | void grabsPush(Grab* grab) { grabs.push_back (grab); } | 267 | void grabsPush (Grab* grab) { grabs.push_back (grab); } |
61 | 254 | GrabIterator grabsBegin() { return grabs.begin(); } | 268 | GrabIterator grabsBegin () { return begin (grabs); } |
62 | 255 | GrabIterator grabsEnd() { return grabs.end(); } | 269 | GrabIterator grabsEnd () { return end (grabs); } |
63 | 256 | void grabsRemove(Grab* grab); | 270 | void grabsRemove (Grab* grab); |
64 | 257 | bool grabExist (const char *grab); | 271 | bool grabExist (const char *grab); |
66 | 258 | Grab* grabsBack() { return grabs.back (); } | 272 | Grab* topGrab (GrabType t) { auto it = std::find_if (begin (grabs), end (grabs), [t] (Grab *g) { return (g->type & t); }); return (it != end (grabs)) ? *it : NULL; } |
67 | 273 | Grab* grabsBack () { return grabs.back (); } | ||
68 | 259 | 274 | ||
69 | 260 | private: | 275 | private: |
70 | 261 | GrabPtrList grabs; | 276 | GrabPtrList grabs; |
71 | @@ -349,12 +364,6 @@ | |||
72 | 349 | int count; | 364 | int count; |
73 | 350 | }; | 365 | }; |
74 | 351 | 366 | ||
75 | 352 | struct Grab { | ||
76 | 353 | Grab(Cursor cursor, const char *name) : cursor(cursor), name(name) {} | ||
77 | 354 | Cursor cursor; | ||
78 | 355 | const char *name; | ||
79 | 356 | }; | ||
80 | 357 | |||
81 | 358 | // data members that don't belong (these probably belong | 367 | // data members that don't belong (these probably belong |
82 | 359 | // in CompScreenImpl as PrivateScreen doesn't use them) | 368 | // in CompScreenImpl as PrivateScreen doesn't use them) |
83 | 360 | struct OrphanData : boost::noncopyable | 369 | struct OrphanData : boost::noncopyable |
84 | @@ -571,9 +580,6 @@ | |||
85 | 571 | Display* const& dpy; | 580 | Display* const& dpy; |
86 | 572 | }; | 581 | }; |
87 | 573 | 582 | ||
88 | 574 | |||
89 | 575 | |||
90 | 576 | |||
91 | 577 | unsigned int windowStateMask (Atom state); | 583 | unsigned int windowStateMask (Atom state); |
92 | 578 | 584 | ||
93 | 579 | }} // namespace compiz::private_screen | 585 | }} // namespace compiz::private_screen |
94 | @@ -703,6 +709,10 @@ | |||
95 | 703 | static void compScreenSnEvent (SnMonitorEvent *event, | 709 | static void compScreenSnEvent (SnMonitorEvent *event, |
96 | 704 | void *userData); | 710 | void *userData); |
97 | 705 | 711 | ||
98 | 712 | CompScreen::GrabHandle pushGrabGeneric (::compiz::private_screen::GrabType type, | ||
99 | 713 | Cursor cursor, | ||
100 | 714 | const char *name); | ||
101 | 715 | |||
102 | 706 | int getXkbEvent() const { return xkbEvent.get(); } | 716 | int getXkbEvent() const { return xkbEvent.get(); } |
103 | 707 | std::vector<XineramaScreenInfo>& getScreenInfo () { return screenInfo; } | 717 | std::vector<XineramaScreenInfo>& getScreenInfo () { return screenInfo; } |
104 | 708 | SnDisplay* getSnDisplay () const { return snDisplay; } | 718 | SnDisplay* getSnDisplay () const { return snDisplay; } |
105 | @@ -963,6 +973,12 @@ | |||
106 | 963 | * be grabbed once and the actual grab refcounted */ | 973 | * be grabbed once and the actual grab refcounted */ |
107 | 964 | GrabHandle pushGrab (Cursor cursor, const char *name); | 974 | GrabHandle pushGrab (Cursor cursor, const char *name); |
108 | 965 | 975 | ||
109 | 976 | /* Adds an X Pointer grab to the stack. */ | ||
110 | 977 | GrabHandle pushPointerGrab (Cursor cursor, const char *name); | ||
111 | 978 | |||
112 | 979 | /* Adds an X Keyboard grab to the stack. */ | ||
113 | 980 | GrabHandle pushKeyboardGrab (const char *name); | ||
114 | 981 | |||
115 | 966 | /* Allows you to change the pointer of your grab */ | 982 | /* Allows you to change the pointer of your grab */ |
116 | 967 | void updateGrab (GrabHandle handle, Cursor cursor); | 983 | void updateGrab (GrabHandle handle, Cursor cursor); |
117 | 968 | 984 | ||
118 | 969 | 985 | ||
119 | === modified file 'src/privatescreen/tests/test-privatescreen.cpp' | |||
120 | --- src/privatescreen/tests/test-privatescreen.cpp 2015-09-23 23:17:54 +0000 | |||
121 | +++ src/privatescreen/tests/test-privatescreen.cpp 2015-10-26 17:12:40 +0000 | |||
122 | @@ -148,6 +148,8 @@ | |||
123 | 148 | MOCK_CONST_METHOD0(defaultIcon, CompIcon *()); | 148 | MOCK_CONST_METHOD0(defaultIcon, CompIcon *()); |
124 | 149 | virtual bool otherGrabExist (const char *, ...) { return false; } // TODO How to mock? | 149 | virtual bool otherGrabExist (const char *, ...) { return false; } // TODO How to mock? |
125 | 150 | MOCK_METHOD2(pushGrab, GrabHandle (Cursor cursor, const char *name)); | 150 | MOCK_METHOD2(pushGrab, GrabHandle (Cursor cursor, const char *name)); |
126 | 151 | MOCK_METHOD2(pushPointerGrab, GrabHandle (Cursor cursor, const char *name)); | ||
127 | 152 | MOCK_METHOD1(pushKeyboardGrab, GrabHandle (const char *name)); | ||
128 | 151 | MOCK_METHOD2(removeGrab, void (GrabHandle handle, CompPoint *restorePointer)); | 153 | MOCK_METHOD2(removeGrab, void (GrabHandle handle, CompPoint *restorePointer)); |
129 | 152 | MOCK_METHOD4(writeImageToFile, bool (CompString &path, | 154 | MOCK_METHOD4(writeImageToFile, bool (CompString &path, |
130 | 153 | const char *format, | 155 | const char *format, |
131 | 154 | 156 | ||
132 | === modified file 'src/screen.cpp' | |||
133 | --- src/screen.cpp 2014-12-02 19:37:10 +0000 | |||
134 | +++ src/screen.cpp 2015-10-26 17:12:40 +0000 | |||
135 | @@ -104,7 +104,7 @@ | |||
136 | 104 | void CompScreenImpl::sizePluginClasses(unsigned int size) | 104 | void CompScreenImpl::sizePluginClasses(unsigned int size) |
137 | 105 | { | 105 | { |
138 | 106 | if(size != pluginClasses.size ()) | 106 | if(size != pluginClasses.size ()) |
140 | 107 | pluginClasses.resize (size); | 107 | pluginClasses.resize (size); |
141 | 108 | } | 108 | } |
142 | 109 | 109 | ||
143 | 110 | void CompScreenImpl::setWindowState (unsigned int state, Window id) | 110 | void CompScreenImpl::setWindowState (unsigned int state, Window id) |
144 | @@ -712,7 +712,7 @@ | |||
145 | 712 | return false; | 712 | return false; |
146 | 713 | 713 | ||
147 | 714 | if (!CompOption::findOption (getOptions (), name, &index)) | 714 | if (!CompOption::findOption (getOptions (), name, &index)) |
149 | 715 | return false; | 715 | return false; |
150 | 716 | 716 | ||
151 | 717 | switch (index) { | 717 | switch (index) { |
152 | 718 | case CoreOptions::ActivePlugins: | 718 | case CoreOptions::ActivePlugins: |
153 | @@ -870,7 +870,7 @@ | |||
154 | 870 | break; | 870 | break; |
155 | 871 | default: | 871 | default: |
156 | 872 | break; | 872 | break; |
158 | 873 | } | 873 | } |
159 | 874 | 874 | ||
160 | 875 | sn_display_process_event (snDisplay, &event); | 875 | sn_display_process_event (snDisplay, &event); |
161 | 876 | 876 | ||
162 | @@ -1584,8 +1584,8 @@ | |||
163 | 1584 | 1584 | ||
164 | 1585 | i = compiz::window::fillStateData (state, data); | 1585 | i = compiz::window::fillStateData (state, data); |
165 | 1586 | XChangeProperty (dpy, id, Atoms::winState, | 1586 | XChangeProperty (dpy, id, Atoms::winState, |
168 | 1587 | XA_ATOM, 32, PropModeReplace, | 1587 | XA_ATOM, 32, PropModeReplace, |
169 | 1588 | (unsigned char *) data, i); | 1588 | (unsigned char *) data, i); |
170 | 1589 | } | 1589 | } |
171 | 1590 | 1590 | ||
172 | 1591 | unsigned int | 1591 | unsigned int |
173 | @@ -2760,10 +2760,10 @@ | |||
174 | 2760 | } | 2760 | } |
175 | 2761 | else | 2761 | else |
176 | 2762 | { | 2762 | { |
178 | 2763 | CompWindow::Map::const_iterator it = windowsMap.find (id); | 2763 | CompWindow::Map::const_iterator it = windowsMap.find (id); |
179 | 2764 | 2764 | ||
182 | 2765 | if (it != windowsMap.end ()) | 2765 | if (it != windowsMap.end ()) |
183 | 2766 | return (lastFoundWindow = it->second); | 2766 | return (lastFoundWindow = it->second); |
184 | 2767 | } | 2767 | } |
185 | 2768 | 2768 | ||
186 | 2769 | return 0; | 2769 | return 0; |
187 | @@ -2933,7 +2933,7 @@ | |||
188 | 2933 | cps::WindowManager::eraseWindowFromMap (Window id) | 2933 | cps::WindowManager::eraseWindowFromMap (Window id) |
189 | 2934 | { | 2934 | { |
190 | 2935 | if (id != 1) | 2935 | if (id != 1) |
192 | 2936 | windowsMap.erase (id); | 2936 | windowsMap.erase (id); |
193 | 2937 | } | 2937 | } |
194 | 2938 | 2938 | ||
195 | 2939 | void | 2939 | void |
196 | @@ -3024,73 +3024,166 @@ | |||
197 | 3024 | #define POINTER_GRAB_MASK (ButtonReleaseMask | \ | 3024 | #define POINTER_GRAB_MASK (ButtonReleaseMask | \ |
198 | 3025 | ButtonPressMask | \ | 3025 | ButtonPressMask | \ |
199 | 3026 | PointerMotionMask) | 3026 | PointerMotionMask) |
202 | 3027 | CompScreenImpl::GrabHandle | 3027 | |
203 | 3028 | CompScreenImpl::pushGrab (Cursor cursor, const char *name) | 3028 | CompScreen::GrabHandle |
204 | 3029 | PrivateScreen::pushGrabGeneric (cps::GrabType type, | ||
205 | 3030 | Cursor cursor, | ||
206 | 3031 | const char *name) | ||
207 | 3029 | { | 3032 | { |
209 | 3030 | if (privateScreen.eventManager.grabsEmpty ()) | 3033 | int status = GrabSuccess; |
210 | 3034 | |||
211 | 3035 | if (eventManager.grabsEmpty ()) | ||
212 | 3031 | { | 3036 | { |
220 | 3032 | int status; | 3037 | if (type & cps::GrabType::POINTER) |
221 | 3033 | 3038 | { | |
222 | 3034 | status = XGrabPointer (privateScreen.dpy, privateScreen.eventManager.getGrabWindow(), true, | 3039 | status = XGrabPointer (dpy, eventManager.getGrabWindow (), true, |
223 | 3035 | POINTER_GRAB_MASK, | 3040 | POINTER_GRAB_MASK, |
224 | 3036 | GrabModeAsync, GrabModeAsync, | 3041 | GrabModeAsync, GrabModeAsync, |
225 | 3037 | privateScreen.rootWindow(), cursor, | 3042 | root, cursor, |
226 | 3038 | CurrentTime); | 3043 | CurrentTime); |
227 | 3044 | } | ||
228 | 3039 | 3045 | ||
229 | 3040 | if (status == GrabSuccess) | 3046 | if (status == GrabSuccess) |
230 | 3041 | { | 3047 | { |
233 | 3042 | status = XGrabKeyboard (privateScreen.dpy, | 3048 | if (type & cps::GrabType::KEYBOARD) |
234 | 3043 | privateScreen.eventManager.getGrabWindow(), true, | 3049 | { |
235 | 3050 | status = XGrabKeyboard (dpy, | ||
236 | 3051 | eventManager.getGrabWindow (), true, | ||
237 | 3052 | GrabModeAsync, GrabModeAsync, | ||
238 | 3053 | CurrentTime); | ||
239 | 3054 | if (status != GrabSuccess) | ||
240 | 3055 | { | ||
241 | 3056 | if (type & cps::GrabType::POINTER) | ||
242 | 3057 | XUngrabPointer (dpy, CurrentTime); | ||
243 | 3058 | |||
244 | 3059 | return NULL; | ||
245 | 3060 | } | ||
246 | 3061 | } | ||
247 | 3062 | } | ||
248 | 3063 | else | ||
249 | 3064 | return NULL; | ||
250 | 3065 | } | ||
251 | 3066 | else | ||
252 | 3067 | { | ||
253 | 3068 | if (type & cps::GrabType::POINTER) | ||
254 | 3069 | { | ||
255 | 3070 | if (eventManager.topGrab (cps::GrabType::POINTER)) | ||
256 | 3071 | { | ||
257 | 3072 | XChangeActivePointerGrab (dpy, POINTER_GRAB_MASK, | ||
258 | 3073 | cursor, CurrentTime); | ||
259 | 3074 | } | ||
260 | 3075 | else | ||
261 | 3076 | { | ||
262 | 3077 | status = XGrabPointer (dpy, eventManager.getGrabWindow (), true, | ||
263 | 3078 | POINTER_GRAB_MASK, | ||
264 | 3079 | GrabModeAsync, GrabModeAsync, | ||
265 | 3080 | root, cursor, | ||
266 | 3081 | CurrentTime); | ||
267 | 3082 | |||
268 | 3083 | if (status != GrabSuccess) | ||
269 | 3084 | return NULL; | ||
270 | 3085 | } | ||
271 | 3086 | } | ||
272 | 3087 | |||
273 | 3088 | if ((type & cps::GrabType::KEYBOARD) && | ||
274 | 3089 | !eventManager.topGrab (cps::GrabType::KEYBOARD)) | ||
275 | 3090 | { | ||
276 | 3091 | status = XGrabKeyboard (dpy, | ||
277 | 3092 | eventManager.getGrabWindow (), true, | ||
278 | 3044 | GrabModeAsync, GrabModeAsync, | 3093 | GrabModeAsync, GrabModeAsync, |
279 | 3045 | CurrentTime); | 3094 | CurrentTime); |
280 | 3095 | |||
281 | 3046 | if (status != GrabSuccess) | 3096 | if (status != GrabSuccess) |
282 | 3047 | { | 3097 | { |
284 | 3048 | XUngrabPointer (privateScreen.dpy, CurrentTime); | 3098 | if (type & cps::GrabType::POINTER) |
285 | 3099 | { | ||
286 | 3100 | if (cps::Grab *lastPtrGrab = eventManager.topGrab (cps::GrabType::POINTER)) | ||
287 | 3101 | { | ||
288 | 3102 | XChangeActivePointerGrab (dpy, POINTER_GRAB_MASK, | ||
289 | 3103 | lastPtrGrab->cursor, CurrentTime); | ||
290 | 3104 | } | ||
291 | 3105 | else | ||
292 | 3106 | { | ||
293 | 3107 | XUngrabPointer (dpy, CurrentTime); | ||
294 | 3108 | } | ||
295 | 3109 | } | ||
296 | 3110 | |||
297 | 3049 | return NULL; | 3111 | return NULL; |
298 | 3050 | } | 3112 | } |
299 | 3051 | } | 3113 | } |
300 | 3052 | else | ||
301 | 3053 | return NULL; | ||
302 | 3054 | } | 3114 | } |
304 | 3055 | else | 3115 | |
305 | 3116 | cps::Grab *grab = new cps::Grab (type, cursor, name); | ||
306 | 3117 | eventManager.grabsPush (grab); | ||
307 | 3118 | |||
308 | 3119 | return grab; | ||
309 | 3120 | } | ||
310 | 3121 | |||
311 | 3122 | CompScreenImpl::GrabHandle | ||
312 | 3123 | CompScreenImpl::pushGrab (Cursor cursor, const char *name) | ||
313 | 3124 | { | ||
314 | 3125 | return privateScreen.pushGrabGeneric(cps::GrabType::ALL, cursor, name); | ||
315 | 3126 | } | ||
316 | 3127 | |||
317 | 3128 | CompScreenImpl::GrabHandle | ||
318 | 3129 | CompScreenImpl::pushPointerGrab (Cursor cursor, const char *name) | ||
319 | 3130 | { | ||
320 | 3131 | return privateScreen.pushGrabGeneric(cps::GrabType::POINTER, cursor, name); | ||
321 | 3132 | } | ||
322 | 3133 | |||
323 | 3134 | CompScreenImpl::GrabHandle | ||
324 | 3135 | CompScreenImpl::pushKeyboardGrab (const char *name) | ||
325 | 3136 | { | ||
326 | 3137 | return privateScreen.pushGrabGeneric(cps::GrabType::KEYBOARD, XC_X_cursor, name); | ||
327 | 3138 | } | ||
328 | 3139 | |||
329 | 3140 | void | ||
330 | 3141 | CompScreenImpl::updateGrab (CompScreen::GrabHandle handle, Cursor cursor) | ||
331 | 3142 | { | ||
332 | 3143 | if (!handle || !(handle->type & cps::GrabType::POINTER)) | ||
333 | 3144 | return; | ||
334 | 3145 | |||
335 | 3146 | if (privateScreen.eventManager.topGrab (cps::GrabType::POINTER) == handle) | ||
336 | 3056 | { | 3147 | { |
337 | 3057 | XChangeActivePointerGrab (privateScreen.dpy, POINTER_GRAB_MASK, | 3148 | XChangeActivePointerGrab (privateScreen.dpy, POINTER_GRAB_MASK, |
338 | 3058 | cursor, CurrentTime); | 3149 | cursor, CurrentTime); |
339 | 3059 | } | 3150 | } |
340 | 3060 | 3151 | ||
341 | 3061 | cps::Grab *grab = new cps::Grab (cursor, name); | ||
342 | 3062 | privateScreen.eventManager.grabsPush (grab); | ||
343 | 3063 | |||
344 | 3064 | return grab; | ||
345 | 3065 | } | ||
346 | 3066 | |||
347 | 3067 | void | ||
348 | 3068 | CompScreenImpl::updateGrab (CompScreen::GrabHandle handle, Cursor cursor) | ||
349 | 3069 | { | ||
350 | 3070 | if (!handle) | ||
351 | 3071 | return; | ||
352 | 3072 | |||
353 | 3073 | XChangeActivePointerGrab (privateScreen.dpy, POINTER_GRAB_MASK, | ||
354 | 3074 | cursor, CurrentTime); | ||
355 | 3075 | |||
356 | 3076 | handle->cursor = cursor; | 3152 | handle->cursor = cursor; |
357 | 3077 | } | 3153 | } |
358 | 3078 | 3154 | ||
359 | 3079 | void | 3155 | void |
360 | 3080 | CompScreenImpl::removeGrab (CompScreen::GrabHandle handle, | 3156 | CompScreenImpl::removeGrab (CompScreen::GrabHandle handle, |
362 | 3081 | CompPoint *restorePointer) | 3157 | CompPoint *restorePointer) |
363 | 3082 | { | 3158 | { |
364 | 3083 | if (!handle) | 3159 | if (!handle) |
365 | 3084 | return; | 3160 | return; |
366 | 3085 | 3161 | ||
367 | 3162 | cps::GrabType removedType = handle->type; | ||
368 | 3086 | privateScreen.eventManager.grabsRemove(handle); | 3163 | privateScreen.eventManager.grabsRemove(handle); |
369 | 3087 | 3164 | ||
370 | 3088 | if (!privateScreen.eventManager.grabsEmpty ()) | 3165 | if (!privateScreen.eventManager.grabsEmpty ()) |
371 | 3089 | { | 3166 | { |
376 | 3090 | XChangeActivePointerGrab (privateScreen.dpy, | 3167 | if (removedType & cps::GrabType::POINTER) |
377 | 3091 | POINTER_GRAB_MASK, | 3168 | { |
378 | 3092 | privateScreen.eventManager.grabsBack ()->cursor, | 3169 | if (CompScreen::GrabHandle topPtrGrab = privateScreen.eventManager.topGrab (cps::GrabType::POINTER)) |
379 | 3093 | CurrentTime); | 3170 | { |
380 | 3171 | XChangeActivePointerGrab (privateScreen.dpy, | ||
381 | 3172 | POINTER_GRAB_MASK, | ||
382 | 3173 | topPtrGrab->cursor, | ||
383 | 3174 | CurrentTime); | ||
384 | 3175 | } | ||
385 | 3176 | else | ||
386 | 3177 | { | ||
387 | 3178 | XUngrabPointer (privateScreen.dpy, CurrentTime); | ||
388 | 3179 | } | ||
389 | 3180 | } | ||
390 | 3181 | |||
391 | 3182 | if (removedType & cps::GrabType::KEYBOARD) | ||
392 | 3183 | { | ||
393 | 3184 | if (!privateScreen.eventManager.topGrab (cps::GrabType::KEYBOARD)) | ||
394 | 3185 | XUngrabKeyboard (privateScreen.dpy, CurrentTime); | ||
395 | 3186 | } | ||
396 | 3094 | } | 3187 | } |
397 | 3095 | else | 3188 | else |
398 | 3096 | { | 3189 | { |
399 | @@ -3098,8 +3191,11 @@ | |||
400 | 3098 | warpPointer (restorePointer->x () - pointerX, | 3191 | warpPointer (restorePointer->x () - pointerX, |
401 | 3099 | restorePointer->y () - pointerY); | 3192 | restorePointer->y () - pointerY); |
402 | 3100 | 3193 | ||
405 | 3101 | XUngrabPointer (privateScreen.dpy, CurrentTime); | 3194 | if (removedType & cps::GrabType::POINTER) |
406 | 3102 | XUngrabKeyboard (privateScreen.dpy, CurrentTime); | 3195 | XUngrabPointer (privateScreen.dpy, CurrentTime); |
407 | 3196 | |||
408 | 3197 | if (removedType & cps::GrabType::KEYBOARD) | ||
409 | 3198 | XUngrabKeyboard (privateScreen.dpy, CurrentTime); | ||
410 | 3103 | } | 3199 | } |
411 | 3104 | } | 3200 | } |
412 | 3105 | 3201 | ||
413 | @@ -3265,12 +3361,12 @@ | |||
414 | 3265 | * keys, and know to cancel the tap if <modifier>+k is pressed. | 3361 | * keys, and know to cancel the tap if <modifier>+k is pressed. |
415 | 3266 | */ | 3362 | */ |
416 | 3267 | if (!(currentState & CompAction::StateIgnoreTap)) | 3363 | if (!(currentState & CompAction::StateIgnoreTap)) |
423 | 3268 | { | 3364 | { |
424 | 3269 | int minCode, maxCode; | 3365 | int minCode, maxCode; |
425 | 3270 | XDisplayKeycodes (screen->dpy(), &minCode, &maxCode); | 3366 | XDisplayKeycodes (screen->dpy(), &minCode, &maxCode); |
426 | 3271 | for (k = minCode; k <= maxCode; k++) | 3367 | for (k = minCode; k <= maxCode; k++) |
427 | 3272 | grabUngrabOneKey (modifiers | modifierForKeycode | ignore, k, grab); | 3368 | grabUngrabOneKey (modifiers | modifierForKeycode | ignore, k, grab); |
428 | 3273 | } | 3369 | } |
429 | 3274 | } | 3370 | } |
430 | 3275 | 3371 | ||
431 | 3276 | if (CompScreen::checkForError (screen->dpy())) | 3372 | if (CompScreen::checkForError (screen->dpy())) |
432 | @@ -3517,7 +3613,7 @@ | |||
433 | 3517 | CompScreenImpl::removeAction (CompAction *action) | 3613 | CompScreenImpl::removeAction (CompAction *action) |
434 | 3518 | { | 3614 | { |
435 | 3519 | if (!privateScreen.initialized || | 3615 | if (!privateScreen.initialized || |
437 | 3520 | !action->active ()) | 3616 | !action->active ()) |
438 | 3521 | return; | 3617 | return; |
439 | 3522 | 3618 | ||
440 | 3523 | grabManager.setCurrentState(action->state()); | 3619 | grabManager.setCurrentState(action->state()); |
441 | @@ -3746,7 +3842,7 @@ | |||
442 | 3746 | pos = env.find (':'); | 3842 | pos = env.find (':'); |
443 | 3747 | if (pos != std::string::npos) | 3843 | if (pos != std::string::npos) |
444 | 3748 | { | 3844 | { |
446 | 3749 | size_t pointPos = env.find ('.', pos); | 3845 | size_t pointPos = env.find ('.', pos); |
447 | 3750 | 3846 | ||
448 | 3751 | if (pointPos != std::string::npos) | 3847 | if (pointPos != std::string::npos) |
449 | 3752 | { | 3848 | { |
450 | @@ -3754,7 +3850,7 @@ | |||
451 | 3754 | } | 3850 | } |
452 | 3755 | else | 3851 | else |
453 | 3756 | { | 3852 | { |
455 | 3757 | unsigned int displayNum = atoi (env.substr (pos + 1).c_str ()); | 3853 | unsigned int displayNum = atoi (env.substr (pos + 1).c_str ()); |
456 | 3758 | env.erase (pos); | 3854 | env.erase (pos); |
457 | 3759 | env.append (compPrintf (":%i", displayNum)); | 3855 | env.append (compPrintf (":%i", displayNum)); |
458 | 3760 | } | 3856 | } |
459 | @@ -5160,7 +5256,7 @@ | |||
460 | 5160 | privateScreen.startupSequence.removeAllSequences (); | 5256 | privateScreen.startupSequence.removeAllSequences (); |
461 | 5161 | 5257 | ||
462 | 5162 | while (!windowManager.getWindows().empty ()) | 5258 | while (!windowManager.getWindows().empty ()) |
464 | 5163 | delete windowManager.getWindows().front (); | 5259 | delete windowManager.getWindows().front (); |
465 | 5164 | 5260 | ||
466 | 5165 | while (CompPlugin* p = CompPlugin::pop ()) | 5261 | while (CompPlugin* p = CompPlugin::pop ()) |
467 | 5166 | CompPlugin::unload (p); | 5262 | CompPlugin::unload (p); |
FAILED: Continuous integration, rev:3931 jenkins. qa.ubuntu. com/job/ compiz- ci/80/ jenkins. qa.ubuntu. com/job/ compiz- wily-amd64- ci/25/console jenkins. qa.ubuntu. com/job/ compiz- wily-armhf- ci/25/console jenkins. qa.ubuntu. com/job/ compiz- wily-i386- ci/25/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/80/rebuild
http://