Merge lp:~samuel-thibault/compiz/clone into lp:compiz/0.9.13

Proposed by Samuel thibault
Status: Needs review
Proposed branch: lp:~samuel-thibault/compiz/clone
Merge into: lp:compiz/0.9.13
Diff against target: 696 lines (+148/-124)
4 files modified
include/core/screen.h (+1/-0)
plugins/ezoom/src/ezoom.cpp (+137/-124)
src/privatescreen.h (+1/-0)
src/screen.cpp (+9/-0)
To merge this branch: bzr merge lp:~samuel-thibault/compiz/clone
Reviewer Review Type Date Requested Status
Andrea Azzarone Needs Fixing
Review via email: mp+348992@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Andrea Azzarone (azzar1) wrote :

Please take a looks to the inline comments. What do you think?

review: Needs Fixing
lp:~samuel-thibault/compiz/clone updated
4145. By Samuel thibault

Move zoomareas at redirection into a helper, update callers

Unmerged revisions

4145. By Samuel thibault

Move zoomareas at redirection into a helper, update callers

4144. By Samuel thibault

Fix ezooom when randr is in clone mode

- This adds CompScreenImpl::outputDev which returns the CompOutput corresponding
to a CompOutput id, but special-case id ~0 and return the fullscreen CompOutput
in that case.
- This makes ezoom use it instead of indexing within screen->outputDevs.
- This makes out < 0 a valid output
- This redirect zooms.at () to use ZoomArea 0 when out < 0 (fullscreen output case).

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/core/screen.h'
2--- include/core/screen.h 2017-06-29 17:19:00 +0000
3+++ include/core/screen.h 2018-07-06 09:09:42 +0000
4@@ -310,6 +310,7 @@
5 virtual bool grabsEmpty() const = 0;
6 virtual void sizePluginClasses(unsigned int size) = 0;
7 virtual CompOutput::vector & outputDevs () = 0;
8+ virtual CompOutput & outputDev (unsigned int id) = 0;
9 virtual void setWindowState (unsigned int state, Window id) = 0;
10 virtual bool XShape () = 0;
11 virtual std::vector<XineramaScreenInfo> & screenInfo () = 0;
12
13=== modified file 'plugins/ezoom/src/ezoom.cpp'
14--- plugins/ezoom/src/ezoom.cpp 2017-12-05 14:45:06 +0000
15+++ plugins/ezoom/src/ezoom.cpp 2018-07-06 09:09:42 +0000
16@@ -99,13 +99,24 @@
17 ZOOM_SCREEN (screen);
18
19 if (out < 0)
20- return false;
21+ /* This is the fullscreen output */
22+ return true;
23 else if ((unsigned int) out >= zs->zooms.size ())
24 zs->zooms.resize (screen->outputDevs ().size ());
25
26 return true;
27 }
28
29+static inline EZoomScreen::ZoomArea&
30+getZoomArea (std::vector <EZoomScreen::ZoomArea>& zooms, int out)
31+{
32+ if (out < 0)
33+ /* Use ZoomArea 0 for fullscreen output */
34+ return zooms.at (0);
35+ else
36+ return zooms.at (out);
37+};
38+
39 /* Check if zoom is active on the output specified */
40 static inline bool
41 isActive (int out)
42@@ -115,7 +126,7 @@
43 if (!outputIsZoomArea (out))
44 return false;
45
46- if (zs->grabbed & (1 << zs->zooms.at (out).output))
47+ if (zs->grabbed & (1 << getZoomArea(zs->zooms, out).output))
48 return true;
49
50 return false;
51@@ -132,9 +143,9 @@
52 if (!outputIsZoomArea (out))
53 return false;
54
55- if (zs->zooms.at (out).currentZoom != 1.0f ||
56- zs->zooms.at (out).newZoom != 1.0f ||
57- zs->zooms.at (out).zVelocity != 0.0f)
58+ if (getZoomArea(zs->zooms, out).currentZoom != 1.0f ||
59+ getZoomArea(zs->zooms, out).newZoom != 1.0f ||
60+ getZoomArea(zs->zooms, out).zVelocity != 0.0f)
61 return true;
62
63 return false;
64@@ -173,7 +184,7 @@
65 EZoomScreen::distanceToEdge (int out,
66 EZoomScreen::ZoomEdge edge)
67 {
68- CompOutput *o = &screen->outputDevs ().at (out);
69+ CompOutput *o = &screen->outputDev (out);
70
71 if (!isActive (out))
72 return 0;
73@@ -211,17 +222,17 @@
74 bool
75 EZoomScreen::isInMovement (int out)
76 {
77- if (zooms.at (out).currentZoom == 1.0f &&
78- zooms.at (out).newZoom == 1.0f &&
79- zooms.at (out).zVelocity == 0.0f)
80+ if (getZoomArea(zooms, out).currentZoom == 1.0f &&
81+ getZoomArea(zooms, out).newZoom == 1.0f &&
82+ getZoomArea(zooms, out).zVelocity == 0.0f)
83 return false;
84
85- if (zooms.at (out).currentZoom != zooms.at (out).newZoom ||
86- zooms.at (out).xVelocity ||
87- zooms.at (out).yVelocity ||
88- zooms.at (out).zVelocity ||
89- zooms.at (out).xTranslate != zooms.at (out).realXTranslate ||
90- zooms.at (out).yTranslate != zooms.at (out).realYTranslate)
91+ if (getZoomArea(zooms, out).currentZoom != getZoomArea(zooms, out).newZoom ||
92+ getZoomArea(zooms, out).xVelocity ||
93+ getZoomArea(zooms, out).yVelocity ||
94+ getZoomArea(zooms, out).zVelocity ||
95+ getZoomArea(zooms, out).xTranslate != getZoomArea(zooms, out).realXTranslate ||
96+ getZoomArea(zooms, out).yTranslate != getZoomArea(zooms, out).realYTranslate)
97 return true;
98
99 return false;
100@@ -270,7 +281,7 @@
101 EZoomScreen::adjustZoomVelocity (int out,
102 float chunk)
103 {
104- float d = (zooms.at (out).newZoom - zooms.at (out).currentZoom) * 75.0f;
105+ float d = (getZoomArea(zooms, out).newZoom - getZoomArea(zooms, out).currentZoom) * 75.0f;
106 float adjust = d * 0.002f;
107 float amount = fabs (d);
108
109@@ -279,17 +290,19 @@
110 else if (amount > 5.0f)
111 amount = 5.0f;
112
113- zooms.at (out).zVelocity = (amount * zooms.at (out).zVelocity + adjust) /
114- (amount + 1.0f);
115+ getZoomArea(zooms, out).zVelocity =
116+ (amount * getZoomArea(zooms, out).zVelocity + adjust) /
117+ (amount + 1.0f);
118
119- if (fabs (d) < 0.1f && fabs (zooms.at (out).zVelocity) < 0.005f)
120+ if (fabs (d) < 0.1f && fabs (getZoomArea(zooms, out).zVelocity) < 0.005f)
121 {
122- zooms.at (out).currentZoom = zooms.at (out).newZoom;
123- zooms.at (out).zVelocity = 0.0f;
124+ getZoomArea(zooms, out).currentZoom = getZoomArea(zooms, out).newZoom;
125+ getZoomArea(zooms, out).zVelocity = 0.0f;
126 }
127 else
128- zooms.at (out).currentZoom += (zooms.at (out).zVelocity * chunk) /
129- cScreen->redrawTime ();
130+ getZoomArea(zooms, out).currentZoom +=
131+ (getZoomArea(zooms, out).zVelocity * chunk) /
132+ cScreen->redrawTime ();
133 }
134
135 /* Adjust the X/Y velocity based on target translation and real
136@@ -298,13 +311,13 @@
137 EZoomScreen::adjustXYVelocity (int out,
138 float chunk)
139 {
140- zooms.at (out).xVelocity /= 1.25f;
141- zooms.at (out).yVelocity /= 1.25f;
142+ getZoomArea(zooms, out).xVelocity /= 1.25f;
143+ getZoomArea(zooms, out).yVelocity /= 1.25f;
144
145 float xdiff =
146- (zooms.at (out).xTranslate - zooms.at (out).realXTranslate) * 75.0f;
147+ (getZoomArea(zooms, out).xTranslate - getZoomArea(zooms, out).realXTranslate) * 75.0f;
148 float ydiff =
149- (zooms.at (out).yTranslate - zooms.at (out).realYTranslate) * 75.0f;
150+ (getZoomArea(zooms, out).yTranslate - getZoomArea(zooms, out).realYTranslate) * 75.0f;
151
152 float xadjust = xdiff * 0.002f;
153 float yadjust = ydiff * 0.002f;
154@@ -321,25 +334,25 @@
155 else if (yamount > 5.0)
156 yamount = 5.0f;
157
158- zooms.at (out).xVelocity =
159- (xamount * zooms.at (out).xVelocity + xadjust) / (xamount + 1.0f);
160- zooms.at (out).yVelocity =
161- (yamount * zooms.at (out).yVelocity + yadjust) / (yamount + 1.0f);
162+ getZoomArea(zooms, out).xVelocity =
163+ (xamount * getZoomArea(zooms, out).xVelocity + xadjust) / (xamount + 1.0f);
164+ getZoomArea(zooms, out).yVelocity =
165+ (yamount * getZoomArea(zooms, out).yVelocity + yadjust) / (yamount + 1.0f);
166
167- if ((fabs(xdiff) < 0.1f && fabs (zooms.at (out).xVelocity) < 0.005f) &&
168- (fabs(ydiff) < 0.1f && fabs (zooms.at (out).yVelocity) < 0.005f))
169+ if ((fabs(xdiff) < 0.1f && fabs (getZoomArea(zooms, out).xVelocity) < 0.005f) &&
170+ (fabs(ydiff) < 0.1f && fabs (getZoomArea(zooms, out).yVelocity) < 0.005f))
171 {
172- zooms.at (out).realXTranslate = zooms.at (out).xTranslate;
173- zooms.at (out).realYTranslate = zooms.at (out).yTranslate;
174- zooms.at (out).xVelocity = 0.0f;
175- zooms.at (out).yVelocity = 0.0f;
176+ getZoomArea(zooms, out).realXTranslate = getZoomArea(zooms, out).xTranslate;
177+ getZoomArea(zooms, out).realYTranslate = getZoomArea(zooms, out).yTranslate;
178+ getZoomArea(zooms, out).xVelocity = 0.0f;
179+ getZoomArea(zooms, out).yVelocity = 0.0f;
180 return;
181 }
182
183- zooms.at (out).realXTranslate +=
184- (zooms.at (out).xVelocity * chunk) / cScreen->redrawTime ();
185- zooms.at (out).realYTranslate +=
186- (zooms.at (out).yVelocity * chunk) / cScreen->redrawTime ();
187+ getZoomArea(zooms, out).realXTranslate +=
188+ (getZoomArea(zooms, out).xVelocity * chunk) / cScreen->redrawTime ();
189+ getZoomArea(zooms, out).realYTranslate +=
190+ (getZoomArea(zooms, out).yVelocity * chunk) / cScreen->redrawTime ();
191 }
192
193 /* Animate the movement (if any) in preparation of a paint screen. */
194@@ -365,12 +378,12 @@
195
196 adjustXYVelocity (out, chunk);
197 adjustZoomVelocity (out, chunk);
198- zooms.at (out).updateActualTranslates ();
199+ getZoomArea(zooms, out).updateActualTranslates ();
200
201 if (!isZoomed (out))
202 {
203- zooms.at (out).xVelocity = zooms.at (out).yVelocity = 0.0f;
204- grabbed &= ~(1 << zooms.at (out).output);
205+ getZoomArea(zooms, out).xVelocity = getZoomArea(zooms, out).yVelocity = 0.0f;
206+ grabbed &= ~(1 << getZoomArea(zooms, out).output);
207
208 if (!grabbed)
209 {
210@@ -540,11 +553,11 @@
211 mask &= ~PAINT_SCREEN_REGION_MASK;
212 mask |= PAINT_SCREEN_CLEAR_MASK;
213
214- zTransform.scale (1.0f / zooms.at (out).currentZoom,
215- 1.0f / zooms.at (out).currentZoom,
216+ zTransform.scale (1.0f / getZoomArea(zooms, out).currentZoom,
217+ 1.0f / getZoomArea(zooms, out).currentZoom,
218 1.0f);
219- zTransform.translate (zooms.at (out).xtrans,
220- zooms.at (out).ytrans,
221+ zTransform.translate (getZoomArea(zooms, out).xtrans,
222+ getZoomArea(zooms, out).ytrans,
223 0);
224
225 mask |= PAINT_SCREEN_TRANSFORMED_MASK;
226@@ -574,15 +587,15 @@
227
228 for (unsigned int out = 0; out < zs->zooms.size (); ++out)
229 {
230- if (zs->zooms.at (out).xTranslate > 0.5f)
231- zs->zooms.at (out).xTranslate = 0.5f;
232- else if (zs->zooms.at (out).xTranslate < -0.5f)
233- zs->zooms.at (out).xTranslate = -0.5f;
234+ if (getZoomArea(zs->zooms, out).xTranslate > 0.5f)
235+ getZoomArea(zs->zooms, out).xTranslate = 0.5f;
236+ else if (getZoomArea(zs->zooms, out).xTranslate < -0.5f)
237+ getZoomArea(zs->zooms, out).xTranslate = -0.5f;
238
239- if (zs->zooms.at (out).yTranslate > 0.5f)
240- zs->zooms.at (out).yTranslate = 0.5f;
241- else if (zs->zooms.at (out).yTranslate < -0.5f)
242- zs->zooms.at (out).yTranslate = -0.5f;
243+ if (getZoomArea(zs->zooms, out).yTranslate > 0.5f)
244+ getZoomArea(zs->zooms, out).yTranslate = 0.5f;
245+ else if (getZoomArea(zs->zooms, out).yTranslate < -0.5f)
246+ getZoomArea(zs->zooms, out).yTranslate = -0.5f;
247 }
248 }
249
250@@ -606,23 +619,23 @@
251 bool instant)
252 {
253 int out = screen->outputDeviceForPoint (x, y);
254- CompOutput *o = &screen->outputDevs ().at (out);
255+ CompOutput *o = &screen->outputDev (out);
256
257- if (zooms.at (out).locked)
258+ if (getZoomArea(zooms, out).locked)
259 return;
260
261- zooms.at (out).xTranslate = (float)
262+ getZoomArea(zooms, out).xTranslate = (float)
263 ((x - o->x1 ()) - o->width () / 2) / (o->width ());
264- zooms.at (out).yTranslate = (float)
265+ getZoomArea(zooms, out).yTranslate = (float)
266 ((y - o->y1 ()) - o->height () / 2) / (o->height ());
267
268 if (instant)
269 {
270- zooms.at (out).realXTranslate = zooms.at (out).xTranslate;
271- zooms.at (out).realYTranslate = zooms.at (out).yTranslate;
272- zooms.at (out).yVelocity = 0.0f;
273- zooms.at (out).xVelocity = 0.0f;
274- zooms.at (out).updateActualTranslates ();
275+ getZoomArea(zooms, out).realXTranslate = getZoomArea(zooms, out).xTranslate;
276+ getZoomArea(zooms, out).realYTranslate = getZoomArea(zooms, out).yTranslate;
277+ getZoomArea(zooms, out).yVelocity = 0.0f;
278+ getZoomArea(zooms, out).xVelocity = 0.0f;
279+ getZoomArea(zooms, out).updateActualTranslates ();
280 }
281
282 if (optionGetZoomMode () == EzoomOptions::ZoomModePanArea)
283@@ -641,27 +654,27 @@
284 CompWindow::Geometry outGeometry (x, y, width, height, 0);
285 int out = screen->outputDeviceForGeometry (outGeometry);
286
287- if (zooms.at (out).newZoom == 1.0f ||
288- zooms.at (out).locked)
289+ if (getZoomArea(zooms, out).newZoom == 1.0f ||
290+ getZoomArea(zooms, out).locked)
291 return;
292
293- CompOutput *o = &screen->outputDevs ().at (out);
294+ CompOutput *o = &screen->outputDev (out);
295
296- zooms.at (out).xTranslate =
297+ getZoomArea(zooms, out).xTranslate =
298 (float) -((o->width () / 2) - (x + (width / 2) - o->x1 ()))
299 / (o->width ());
300- zooms.at (out).xTranslate /= (1.0f - zooms.at (out).newZoom);
301- zooms.at (out).yTranslate =
302+ getZoomArea(zooms, out).xTranslate /= (1.0f - getZoomArea(zooms, out).newZoom);
303+ getZoomArea(zooms, out).yTranslate =
304 (float) -((o->height () / 2) - (y + (height / 2) - o->y1 ()))
305 / (o->height ());
306- zooms.at (out).yTranslate /= (1.0f - zooms.at (out).newZoom);
307+ getZoomArea(zooms, out).yTranslate /= (1.0f - getZoomArea(zooms, out).newZoom);
308 constrainZoomTranslate ();
309
310 if (instant)
311 {
312- zooms.at (out).realXTranslate = zooms.at (out).xTranslate;
313- zooms.at (out).realYTranslate = zooms.at (out).yTranslate;
314- zooms.at (out).updateActualTranslates ();
315+ getZoomArea(zooms, out).realXTranslate = getZoomArea(zooms, out).xTranslate;
316+ getZoomArea(zooms, out).realYTranslate = getZoomArea(zooms, out).yTranslate;
317+ getZoomArea(zooms, out).updateActualTranslates ();
318 }
319
320 if (optionGetZoomMode () == EzoomOptions::ZoomModePanArea)
321@@ -690,8 +703,8 @@
322
323 for (unsigned int out = 0; out < zooms.size (); ++out)
324 {
325- zooms.at (out).xTranslate += panFactor * xvalue * zooms.at (out).currentZoom;
326- zooms.at (out).yTranslate += panFactor * yvalue * zooms.at (out).currentZoom;
327+ getZoomArea(zooms, out).xTranslate += panFactor * xvalue * getZoomArea(zooms, out).currentZoom;
328+ getZoomArea(zooms, out).yTranslate += panFactor * yvalue * getZoomArea(zooms, out).currentZoom;
329 }
330
331 constrainZoomTranslate ();
332@@ -715,7 +728,7 @@
333 EZoomScreen::setScale (int out,
334 float value)
335 {
336- if (zooms.at (out).locked)
337+ if (getZoomArea(zooms, out).locked)
338 return;
339
340 if (value >= 1.0f)
341@@ -725,21 +738,21 @@
342 if (!pollHandle.active ())
343 enableMousePolling ();
344
345- grabbed |= (1 << zooms.at (out).output);
346+ grabbed |= (1 << getZoomArea(zooms, out).output);
347 cursorZoomActive (out);
348 }
349
350 if (value == 1.0f)
351 {
352- zooms.at (out).xTranslate = 0.0f;
353- zooms.at (out).yTranslate = 0.0f;
354+ getZoomArea(zooms, out).xTranslate = 0.0f;
355+ getZoomArea(zooms, out).yTranslate = 0.0f;
356 cursorZoomInactive ();
357 }
358
359 if (value < optionGetMinimumZoom ())
360 value = optionGetMinimumZoom ();
361
362- zooms.at (out).newZoom = value;
363+ getZoomArea(zooms, out).newZoom = value;
364 cScreen->damageScreen();
365 }
366
367@@ -773,16 +786,16 @@
368 if (!isInMovement (out))
369 return;
370
371- CompOutput *o = &screen->outputDevs ().at (out);
372+ CompOutput *o = &screen->outputDev (out);
373
374- int x = (int) ((zooms.at (out).realXTranslate * o->width ()) +
375+ int x = (int) ((getZoomArea(zooms, out).realXTranslate * o->width ()) +
376 (o->width () / 2) + o->x1 ());
377- int y = (int) ((zooms.at (out).realYTranslate * o->height ()) +
378+ int y = (int) ((getZoomArea(zooms, out).realYTranslate * o->height ()) +
379 (o->height () / 2) + o->y1 ());
380
381 if ((x != mouse.x () || y != mouse.y ()) &&
382 grabbed &&
383- zooms.at (out).newZoom != 1.0f)
384+ getZoomArea(zooms, out).newZoom != 1.0f)
385 {
386 screen->warpPointer (x - pointerX , y - pointerY );
387 mouse.setX (x);
388@@ -804,8 +817,8 @@
389 *resultY = y;
390 }
391
392- CompOutput *o = &screen->outputDevs ()[out];
393- ZoomArea &za = zooms.at (out);
394+ CompOutput *o = &screen->outputDev (out);
395+ ZoomArea &za = getZoomArea(zooms, out);
396 int oWidth = o->width ();
397 int oHeight = o->height ();
398 int halfOWidth = oWidth / 2;
399@@ -840,8 +853,8 @@
400 *resultY = y;
401 }
402
403- CompOutput *o = &screen->outputDevs ().at (out);
404- ZoomArea &za = zooms.at (out);
405+ CompOutput *o = &screen->outputDev (out);
406+ ZoomArea &za = getZoomArea(zooms, out);
407 int oWidth = o->width ();
408 int oHeight = o->height ();
409 int halfOWidth = oWidth / 2;
410@@ -876,12 +889,12 @@
411
412 int zoomX, zoomY;
413 convertToZoomedTarget (out, x, y, &zoomX, &zoomY);
414- ZoomArea &za = zooms.at (out);
415+ ZoomArea &za = getZoomArea(zooms, out);
416
417 if (za.locked)
418 return false;
419
420- CompOutput *o = &screen->outputDevs ().at (out);
421+ CompOutput *o = &screen->outputDev (out);
422
423 #define FACTOR (za.newZoom / (1.0f - za.newZoom))
424 if (zoomX + margin > o->x2 ())
425@@ -924,10 +937,10 @@
426 ZoomGravity gravity)
427 {
428 int out = screen->outputDeviceForPoint (x1 + (x2 - x1 / 2), y1 + (y2 - y1 / 2));
429- CompOutput *o = &screen->outputDevs ().at (out);
430+ CompOutput *o = &screen->outputDev (out);
431
432- bool widthOkay = (float)(x2-x1) / (float)o->width () < zooms.at (out).newZoom;
433- bool heightOkay = (float)(y2-y1) / (float)o->height () < zooms.at (out).newZoom;
434+ bool widthOkay = (float)(x2-x1) / (float)o->width () < getZoomArea(zooms, out).newZoom;
435+ bool heightOkay = (float)(y2-y1) / (float)o->height () < getZoomArea(zooms, out).newZoom;
436
437 if (widthOkay &&
438 heightOkay)
439@@ -948,12 +961,12 @@
440 if (widthOkay)
441 targetW = x2 - x1;
442 else
443- targetW = o->width () * zooms.at (out).newZoom;
444+ targetW = o->width () * getZoomArea(zooms, out).newZoom;
445
446 if (heightOkay)
447 targetH = y2 - y1;
448 else
449- targetH = o->height () * zooms.at (out).newZoom;
450+ targetH = o->height () * getZoomArea(zooms, out).newZoom;
451
452 break;
453
454@@ -967,14 +980,14 @@
455 }
456 else
457 {
458- targetX = x2 - o->width () * zooms.at (out).newZoom;
459- targetW = o->width () * zooms.at (out).newZoom;
460+ targetX = x2 - o->width () * getZoomArea(zooms, out).newZoom;
461+ targetW = o->width () * getZoomArea(zooms, out).newZoom;
462 }
463
464 if (heightOkay)
465 targetH = y2-y1;
466 else
467- targetH = o->height () * zooms.at (out).newZoom;
468+ targetH = o->height () * getZoomArea(zooms, out).newZoom;
469
470 break;
471
472@@ -984,7 +997,7 @@
473 if (widthOkay)
474 targetW = x2-x1;
475 else
476- targetW = o->width () * zooms.at (out).newZoom;
477+ targetW = o->width () * getZoomArea(zooms, out).newZoom;
478
479 if (heightOkay)
480 {
481@@ -993,8 +1006,8 @@
482 }
483 else
484 {
485- targetY = y2 - (o->width () * zooms.at (out).newZoom);
486- targetH = o->width () * zooms.at (out).newZoom;
487+ targetY = y2 - (o->width () * getZoomArea(zooms, out).newZoom);
488+ targetH = o->width () * getZoomArea(zooms, out).newZoom;
489 }
490
491 break;
492@@ -1007,7 +1020,7 @@
493 }
494 else
495 {
496- targetW = o->width () * zooms.at (out).newZoom;
497+ targetW = o->width () * getZoomArea(zooms, out).newZoom;
498 targetX = x2 - targetW;
499 }
500
501@@ -1018,7 +1031,7 @@
502 }
503 else
504 {
505- targetH = o->height () * zooms.at (out).newZoom;
506+ targetH = o->height () * getZoomArea(zooms, out).newZoom;
507 targetY = y2 - targetH;
508 }
509
510@@ -1047,16 +1060,16 @@
511 {
512 int x1, y1, x2, y2;
513 int diffX = 0, diffY = 0;
514- CompOutput *o = &screen->outputDevs ().at (out);
515+ CompOutput *o = &screen->outputDev (out);
516
517- float z = zooms.at (out).newZoom;
518+ float z = getZoomArea(zooms, out).newZoom;
519 int margin = optionGetRestrainMargin ();
520 int north = distanceToEdge (out, NORTH);
521 int south = distanceToEdge (out, SOUTH);
522 int east = distanceToEdge (out, EAST);
523 int west = distanceToEdge (out, WEST);
524
525- if (zooms.at (out).currentZoom == 1.0f)
526+ if (getZoomArea(zooms, out).currentZoom == 1.0f)
527 {
528 lastChange = time(NULL);
529 mouse = MousePoller::getCurrentPosition ();
530@@ -1205,7 +1218,7 @@
531 sTransform.translate ((float) ax, (float) ay, 0.0f);
532
533 if (optionGetScaleMouseDynamic ())
534- scaleFactor = 1.0f / zooms.at (out).currentZoom;
535+ scaleFactor = 1.0f / getZoomArea(zooms, out).currentZoom;
536 else
537 scaleFactor = 1.0f / optionGetScaleMouseStatic ();
538
539@@ -1386,7 +1399,7 @@
540 if (!optionGetScaleMouse () &&
541 optionGetZoomMode () == EzoomOptions::ZoomModeSyncMouse &&
542 optionGetHideOriginalMouse () &&
543- !zooms.at (out).locked)
544+ !getZoomArea(zooms, out).locked)
545 return;
546
547 if (!cursorInfoSelected)
548@@ -1399,7 +1412,7 @@
549
550 if (canHideCursor &&
551 !cursorHidden &&
552- (optionGetHideOriginalMouse () || zooms.at (out).locked))
553+ (optionGetHideOriginalMouse () || getZoomArea(zooms, out).locked))
554 {
555 cursorHidden = true;
556 XFixesHideCursor (screen->dpy (), screen->root ());
557@@ -1444,7 +1457,7 @@
558 int height = y2 - y1;
559
560 setZoomArea (x1, y1, width, height, false);
561- CompOutput *o = &screen->outputDevs (). at(out);
562+ CompOutput *o = &screen->outputDev (out);
563
564 if (scale && width && height)
565 setScaleBigger (out, width / static_cast <float> (o->width ()),
566@@ -1494,7 +1507,7 @@
567 if (x2 >= 0 && y2 >= 0)
568 ensureVisibility (x2, y2, margin);
569
570- CompOutput *o = &screen->outputDevs (). at(out);
571+ CompOutput *o = &screen->outputDev (out);
572
573 int width = x2 - x1;
574 int height = y2 - y1;
575@@ -1565,7 +1578,7 @@
576 CompWindow::Geometry outGeometry (x, y, width, height, 0);
577
578 int out = screen->outputDeviceForGeometry (outGeometry);
579- CompOutput *o = &screen->outputDevs (). at (out);
580+ CompOutput *o = &screen->outputDev (out);
581 setScaleBigger (out, width / static_cast <float> (o->width ()),
582 height / static_cast <float> (o->height ()));
583 setZoomArea (x, y, width, height, false);
584@@ -1589,7 +1602,7 @@
585 !isInMovement (out))
586 setCenter (pointerX, pointerY, true);
587
588- setScale (out, zooms.at (out).newZoom / optionGetZoomFactor ());
589+ setScale (out, getZoomArea(zooms, out).newZoom / optionGetZoomFactor ());
590
591 toggleFunctions (true);
592
593@@ -1604,7 +1617,7 @@
594 CompOption::Vector options)
595 {
596 int out = screen->outputDeviceForPoint (pointerX, pointerY);
597- zooms.at (out).locked = !zooms.at (out).locked;
598+ getZoomArea(zooms, out).locked = !getZoomArea(zooms, out).locked;
599
600 return true;
601 }
602@@ -1695,7 +1708,7 @@
603 return false;
604 }
605
606- if ((zoom_level == zooms.at (out).newZoom) ||
607+ if ((zoom_level == getZoomArea(zooms, out).newZoom) ||
608 screen->otherGrabExist (NULL))
609 return false;
610
611@@ -1736,7 +1749,7 @@
612 int width = w->width () + w->border ().left + w->border ().right;
613 int height = w->height () + w->border ().top + w->border ().bottom;
614 int out = screen->outputDeviceForGeometry (w->geometry ());
615- CompOutput *o = &screen->outputDevs ().at (out);
616+ CompOutput *o = &screen->outputDev (out);
617
618 setScaleBigger (out, width / static_cast <float> (o->width ()),
619 height / static_cast <float> (o->height ()));
620@@ -1770,11 +1783,11 @@
621 screen->warpPointer ((int) (screen->outputDevs ().at (out).width () / 2 +
622 screen->outputDevs ().at (out).x1 () - pointerX)
623 + ((float) screen->outputDevs ().at (out).width () *
624- -zooms.at (out).xtrans),
625+ -getZoomArea(zooms, out).xtrans),
626 (int) (screen->outputDevs ().at (out).height () / 2 +
627 screen->outputDevs ().at (out).y1 () - pointerY)
628 + ((float) screen->outputDevs ().at (out).height () *
629- zooms.at (out).ytrans));
630+ getZoomArea(zooms, out).ytrans));
631 return true;
632 }
633
634@@ -1801,10 +1814,10 @@
635 xwc.y = w->serverY ();
636
637 xwc.width = (int) (screen->outputDevs ().at (out).width () *
638- zooms.at (out).currentZoom -
639+ getZoomArea(zooms, out).currentZoom -
640 (int) ((w->border ().left + w->border ().right)));
641 xwc.height = (int) (screen->outputDevs ().at (out).height () *
642- zooms.at (out).currentZoom -
643+ getZoomArea(zooms, out).currentZoom -
644 (int) ((w->border ().top + w->border ().bottom)));
645
646 w->constrainNewWindowSize (xwc.width,
647@@ -1854,7 +1867,7 @@
648 int out = screen->outputDeviceForPoint (pointerX, pointerY);
649
650 setScale (out,
651- zooms.at (out).newZoom *
652+ getZoomArea(zooms, out).newZoom *
653 optionGetZoomFactor ());
654
655 toggleFunctions (true);
656@@ -1871,7 +1884,7 @@
657
658 if (grabbed)
659 {
660- zooms.at (out).newZoom = 1.0f;
661+ getZoomArea(zooms, out).newZoom = 1.0f;
662 cScreen->damageScreen ();
663 }
664
665
666=== modified file 'src/privatescreen.h'
667--- src/privatescreen.h 2017-06-29 17:19:00 +0000
668+++ src/privatescreen.h 2018-07-06 09:09:42 +0000
669@@ -1053,6 +1053,7 @@
670
671 CompOutput::vector & outputDevs ();
672 CompOutput & currentOutputDev () const;
673+ CompOutput & outputDev (unsigned int id);
674
675 const CompRect & workArea () const;
676
677
678=== modified file 'src/screen.cpp'
679--- src/screen.cpp 2017-10-26 17:02:38 +0000
680+++ src/screen.cpp 2018-07-06 09:09:42 +0000
681@@ -4703,6 +4703,15 @@
682 return const_cast<PrivateScreen&>(privateScreen).outputDevices.getCurrentOutputDev ();
683 }
684
685+CompOutput &
686+CompScreenImpl::outputDev (unsigned int id)
687+{
688+ if (id == ~0u)
689+ return fullscreenOutput ();
690+ else
691+ return outputDevs ().at (id);
692+}
693+
694 const CompRect &
695 CompScreenImpl::workArea () const
696 {

Subscribers

People subscribed via source and target branches