~3v1n0/compiz/gtk-decorator-finalize-menu-0.9.10

« back to all changes in this revision

Viewing changes to plugins/ezoom/src/ezoom.cpp

plugins/ezoom/src/ezoom.cpp:
Also initialize xtrans and ytrans in the ctors.
Just just enable blending if it is disabled and just
disable it if it was disabled before.
Introduced the variables oWidth, oHeight, halfOWidth and
halfOHeight to speed up following calculations.
Return ASAP, do not calculate possibly redundant stuff.
Declaration and assignment of local variables in one line.
Improved readability.
Added and removed newlines.
Minor indentation fixes.

plugins/ezoom/ezoom.xml.in:
Removed redundant whitespaces from a tooltip.

(LP: #1101572). Fixes: https://bugs.launchpad.net/bugs/1101572.

Approved by Sam Spilsbury, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
133
133
        return false;
134
134
 
135
135
    if (zs->zooms.at (out).currentZoom != 1.0f  ||
136
 
        zs->zooms.at (out).newZoom != 1.0f      ||
137
 
        zs->zooms.at (out).zVelocity != 0.0f)
 
136
        zs->zooms.at (out).newZoom     != 1.0f  ||
 
137
        zs->zooms.at (out).zVelocity   != 0.0f)
138
138
        return true;
139
139
 
140
140
    return false;
142
142
 
143
143
/* Returns the distance to the defined edge in zoomed pixels.  */
144
144
int
145
 
EZoomScreen::distanceToEdge (int out, EZoomScreen::ZoomEdge edge)
 
145
EZoomScreen::distanceToEdge (int                   out,
 
146
                             EZoomScreen::ZoomEdge edge)
146
147
{
147
148
    CompOutput *o = &screen->outputDevs ().at (out);
148
149
 
157
158
                           o->region ()->extents.y1, &x1, &y1);
158
159
    switch (edge)
159
160
    {
 
161
        case WEST:  return o->region ()->extents.x1 - x1;
160
162
        case NORTH: return o->region ()->extents.y1 - y1;
 
163
        case EAST:  return x2 - o->region ()->extents.x2;
161
164
        case SOUTH: return y2 - o->region ()->extents.y2;
162
 
        case EAST: return x2 - o->region ()->extents.x2;
163
 
        case WEST: return o->region ()->extents.x1 - x1;
164
165
    }
 
166
 
165
167
    return 0; // Never reached.
166
168
}
167
169
 
170
172
EZoomScreen::ZoomArea::updateActualTranslates ()
171
173
{
172
174
    xtrans = -realXTranslate * (1.0f - currentZoom);
173
 
    ytrans = realYTranslate * (1.0f - currentZoom);
 
175
    ytrans =  realYTranslate * (1.0f - currentZoom);
174
176
}
175
177
 
176
178
/* Returns true if the head in question is currently moving.
182
184
EZoomScreen::isInMovement (int out)
183
185
{
184
186
    if (zooms.at (out).currentZoom == 1.0f  &&
185
 
        zooms.at (out).newZoom == 1.0f      &&
186
 
        zooms.at (out).zVelocity == 0.0f)
 
187
        zooms.at (out).newZoom     == 1.0f  &&
 
188
        zooms.at (out).zVelocity   == 0.0f)
187
189
        return false;
188
190
 
189
191
    if (zooms.at (out).currentZoom != zooms.at (out).newZoom        ||
210
212
    yTranslate (0.0f),
211
213
    realXTranslate (0.0f),
212
214
    realYTranslate (0.0f),
 
215
    xtrans (0.0f),
 
216
    ytrans (0.0f),
213
217
    locked (false)
214
218
{
215
219
    updateActualTranslates ();
227
231
    yTranslate (0.0f),
228
232
    realXTranslate (0.0f),
229
233
    realYTranslate (0.0f),
 
234
    xtrans (0.0f),
 
235
    ytrans (0.0f),
230
236
    locked (false)
231
237
{
232
238
}
 
239
 
233
240
/* Adjust the velocity in the z-direction. */
234
241
void
235
 
EZoomScreen::adjustZoomVelocity (int out, float chunk)
 
242
EZoomScreen::adjustZoomVelocity (int   out,
 
243
                                 float chunk)
236
244
{
237
 
    float d = (zooms.at (out).newZoom - zooms.at (out).currentZoom) * 75.0f;
238
 
 
 
245
    float d      = (zooms.at (out).newZoom - zooms.at (out).currentZoom) * 75.0f;
239
246
    float adjust = d * 0.002f;
240
247
    float amount = fabs (d);
241
248
 
244
251
    else if (amount > 5.0f)
245
252
        amount = 5.0f;
246
253
 
247
 
    zooms.at (out).zVelocity =
248
 
        (amount * zooms.at (out).zVelocity + adjust) / (amount + 1.0f);
 
254
    zooms.at (out).zVelocity = (amount * zooms.at (out).zVelocity + adjust) /
 
255
                               (amount + 1.0f);
249
256
 
250
257
    if (fabs (d) < 0.1f && fabs (zooms.at (out).zVelocity) < 0.005f)
251
258
    {
252
259
        zooms.at (out).currentZoom = zooms.at (out).newZoom;
253
 
        zooms.at (out).zVelocity = 0.0f;
 
260
        zooms.at (out).zVelocity   = 0.0f;
254
261
    }
255
262
    else
256
263
        zooms.at (out).currentZoom += (zooms.at (out).zVelocity * chunk) /
260
267
/* Adjust the X/Y velocity based on target translation and real
261
268
 * translation. */
262
269
void
263
 
EZoomScreen::adjustXYVelocity (int out, float chunk)
 
270
EZoomScreen::adjustXYVelocity (int   out,
 
271
                               float chunk)
264
272
{
265
273
    zooms.at (out).xVelocity /= 1.25f;
266
274
    zooms.at (out).yVelocity /= 1.25f;
295
303
    {
296
304
        zooms.at (out).realXTranslate = zooms.at (out).xTranslate;
297
305
        zooms.at (out).realYTranslate = zooms.at (out).yTranslate;
298
 
        zooms.at (out).xVelocity = 0.0f;
299
 
        zooms.at (out).yVelocity = 0.0f;
 
306
        zooms.at (out).xVelocity      = 0.0f;
 
307
        zooms.at (out).yVelocity      = 0.0f;
300
308
        return;
301
309
    }
302
310
 
313
321
    if (grabbed)
314
322
    {
315
323
        float amount = msSinceLastPaint * 0.05f * optionGetSpeed ();
316
 
        int steps  = amount / (0.5f * optionGetTimestep ());
 
324
        int   steps  = amount / (0.5f * optionGetTimestep ());
317
325
 
318
326
        if (!steps)
319
327
            steps = 1;
344
352
                }
345
353
            }
346
354
        }
 
355
 
347
356
        if (optionGetZoomMode () == EzoomOptions::ZoomModeSyncMouse)
348
357
            syncCenterToMouse ();
349
358
    }
384
393
    int            inx1, inx2, iny1, iny2;
385
394
    int            out = output->id ();
386
395
    GLushort       colorData[4];
387
 
    GLushort       *color;
388
396
    GLfloat        vertexData[12];
389
397
    GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
390
398
 
401
409
 
402
410
    const float MaxUShortFloat = std::numeric_limits <unsigned short>::max ();
403
411
 
404
 
    glEnable (GL_BLEND);
 
412
    GLboolean glBlendEnabled = glIsEnabled (GL_BLEND);
 
413
 
 
414
    /* just enable blending if it is disabled */
 
415
    if (!glBlendEnabled)
 
416
        glEnable (GL_BLEND);
405
417
 
406
418
    /* Draw filled rectangle */
407
 
    float alpha = optionGetZoomBoxFillColorAlpha () / MaxUShortFloat;
408
 
    color = optionGetZoomBoxFillColor ();
 
419
    float    alpha  = optionGetZoomBoxFillColorAlpha () / MaxUShortFloat;
 
420
    GLushort *color = optionGetZoomBoxFillColor ();
409
421
 
410
422
    colorData[0] = alpha * color[0];
411
423
    colorData[1] = alpha * color[1];
466
478
    streamingBuffer->end ();
467
479
    streamingBuffer->render (zTransform);
468
480
 
469
 
    glDisable (GL_BLEND);
 
481
    /* just disable blending if it was disabled before */
 
482
    if (!glBlendEnabled)
 
483
        glDisable (GL_BLEND);
470
484
 
471
485
    /* Damage the zoom selection box region during draw. */
472
486
    cScreen->damageRegion (CompRegion (x1 - 1,
490
504
 
491
505
    if (isActive (out))
492
506
    {
493
 
        GLScreenPaintAttrib sa = attrib;
 
507
        GLScreenPaintAttrib sa         = attrib;
494
508
        GLMatrix            zTransform = transform;
495
509
 
496
510
        mask &= ~PAINT_SCREEN_REGION_MASK;
508
522
        status = gScreen->glPaintOutput (sa, zTransform, region, output, mask);
509
523
 
510
524
        drawCursor (output, transform);
511
 
 
512
525
    }
513
526
    else
514
 
        status = gScreen->glPaintOutput (attrib, transform, region, output,
515
 
                                         mask);
 
527
        status = gScreen->glPaintOutput (attrib, transform, region, output, mask);
516
528
 
517
529
    if (grabIndex)
518
530
        drawBox (transform, output, box);
557
569
 * that is, it's the point that's the same regardless of zoom level.
558
570
 */
559
571
void
560
 
EZoomScreen::setCenter (int x, int y, bool instant)
 
572
EZoomScreen::setCenter (int  x,
 
573
                        int  y,
 
574
                        bool instant)
561
575
{
562
576
    int         out = screen->outputDeviceForPoint (x, y);
563
577
    CompOutput  *o  = &screen->outputDevs ().at (out);
627
641
EZoomScreen::areaToWindow (CompWindow *w)
628
642
{
629
643
    int left   = w->serverX () - w->border ().left;
630
 
    int width  = w->width () + w->border ().left + w->border ().right;
631
644
    int top    = w->serverY () - w->border ().top;
632
 
    int height = w->height ()  + w->border ().top + w->border ().bottom;
 
645
    int width  = w->width ()   + w->border ().left + w->border ().right;
 
646
    int height = w->height ()  + w->border ().top  + w->border ().bottom;
633
647
 
634
648
    setZoomArea (left, top, width, height, false);
635
649
}
637
651
/* Pans the zoomed area vertically/horizontally by * value * zs->panFactor
638
652
 * TODO: Fix output. */
639
653
void
640
 
EZoomScreen::panZoom (int xvalue, int yvalue)
 
654
EZoomScreen::panZoom (int xvalue,
 
655
                      int yvalue)
641
656
{
 
657
    float panFactor = optionGetPanFactor ();
 
658
 
642
659
    for (unsigned int out = 0; out < zooms.size (); ++out)
643
660
    {
644
 
        zooms.at (out).xTranslate +=
645
 
            optionGetPanFactor () * xvalue *
646
 
            zooms.at (out).currentZoom;
647
 
        zooms.at (out).yTranslate +=
648
 
            optionGetPanFactor () * yvalue *
649
 
            zooms.at (out).currentZoom;
 
661
        zooms.at (out).xTranslate += panFactor * xvalue * zooms.at (out).currentZoom;
 
662
        zooms.at (out).yTranslate += panFactor * yvalue * zooms.at (out).currentZoom;
650
663
    }
651
664
 
652
665
    constrainZoomTranslate ();
660
673
{
661
674
    pollHandle.start ();
662
675
    lastChange = time(NULL);
663
 
    mouse = MousePoller::getCurrentPosition ();
 
676
    mouse      = MousePoller::getCurrentPosition ();
664
677
}
665
678
 
666
679
/* Sets the zoom (or scale) level.
667
680
 * Cleans up if we are suddenly zoomed out.
668
681
 */
669
682
void
670
 
EZoomScreen::setScale (int out, float value)
 
683
EZoomScreen::setScale (int   out,
 
684
                       float value)
671
685
{
672
686
    if (zooms.at (out).locked)
673
687
        return;
758
772
        *resultY = y;
759
773
    }
760
774
 
761
 
    CompOutput *o  = &screen->outputDevs ()[out];
762
 
    ZoomArea   &za = zooms.at (out);
 
775
    CompOutput *o          = &screen->outputDevs ()[out];
 
776
    ZoomArea   &za         = zooms.at (out);
 
777
    int        oWidth      = o->width ();
 
778
    int        oHeight     = o->height ();
 
779
    int        halfOWidth  = oWidth  / 2;
 
780
    int        halfOHeight = oHeight / 2;
763
781
 
764
782
    x -= o->x1 ();
765
783
    y -= o->y1 ();
766
784
 
767
785
    *resultX = x - (za.realXTranslate *
768
 
                    (1.0f - za.currentZoom) * o->width ()) - o->width () / 2;
 
786
                    (1.0f - za.currentZoom) * oWidth) - halfOWidth;
769
787
    *resultX /= za.currentZoom;
770
 
    *resultX += o->width () / 2;
 
788
    *resultX += halfOWidth;
771
789
    *resultX += o->x1 ();
772
790
    *resultY = y - (za.realYTranslate *
773
 
                    (1.0f - za.currentZoom) * o->height ()) - o->height () / 2;
 
791
                    (1.0f - za.currentZoom) * oHeight) - halfOHeight;
774
792
    *resultY /= za.currentZoom;
775
 
    *resultY += o->height () / 2;
 
793
    *resultY += halfOHeight;
776
794
    *resultY += o->y1 ();
777
795
}
778
796
 
784
802
                                    int *resultX,
785
803
                                    int *resultY)
786
804
{
787
 
    CompOutput *o = &screen->outputDevs ().at (out);
788
 
 
789
805
    if (!outputIsZoomArea (out))
790
806
    {
791
807
        *resultX = x;
792
808
        *resultY = y;
793
809
    }
794
810
 
795
 
    ZoomArea    &za = zooms.at (out);
 
811
    CompOutput *o          = &screen->outputDevs ().at (out);
 
812
    ZoomArea   &za         = zooms.at (out);
 
813
    int        oWidth      = o->width ();
 
814
    int        oHeight     = o->height ();
 
815
    int        halfOWidth  = oWidth  / 2;
 
816
    int        halfOHeight = oHeight / 2;
796
817
 
797
818
    x -= o->x1 ();
798
819
    y -= o->y1 ();
799
820
 
800
 
    *resultX = x - (za.xTranslate *
801
 
                    (1.0f - za.newZoom) * o->width ()) - o->width () / 2;
 
821
    *resultX = x - (za.xTranslate * (1.0f - za.newZoom) * oWidth)  - halfOWidth;
802
822
    *resultX /= za.newZoom;
803
 
    *resultX += o->width () / 2;
 
823
    *resultX += halfOWidth;
804
824
    *resultX += o->x1 ();
805
 
    *resultY = y - (za.yTranslate *
806
 
                    (1.0f - za.newZoom) * o->height ()) - o->height () / 2;
 
825
    *resultY = y - (za.yTranslate * (1.0f - za.newZoom) * oHeight) - halfOHeight;
807
826
    *resultY /= za.newZoom;
808
 
    *resultY += o->height () / 2;
 
827
    *resultY += halfOHeight;
809
828
    *resultY += o->y1 ();
810
829
}
811
830
 
814
833
 * Returns false if the point isn't on a actively zoomed head
815
834
 * or the area is locked. */
816
835
bool
817
 
EZoomScreen::ensureVisibility (int x, int y, int margin)
 
836
EZoomScreen::ensureVisibility (int x,
 
837
                               int y,
 
838
                               int margin)
818
839
{
819
840
    int out = screen->outputDeviceForPoint (x, y);
820
841
 
873
894
    int        out  = screen->outputDeviceForPoint (x1 + (x2 - x1 / 2), y1 + (y2 - y1 / 2));
874
895
    CompOutput *o   = &screen->outputDevs ().at (out);
875
896
 
876
 
    bool widthOkay  = (float)(x2-x1) / (float)o->width () < zooms.at (out).newZoom;
 
897
    bool widthOkay  = (float)(x2-x1) / (float)o->width ()  < zooms.at (out).newZoom;
877
898
    bool heightOkay = (float)(y2-y1) / (float)o->height () < zooms.at (out).newZoom;
878
899
 
879
900
    if (widthOkay &&
1157
1178
        int x = -cursor.hotX;
1158
1179
        int y = -cursor.hotY;
1159
1180
 
1160
 
        glEnable (GL_BLEND);
 
1181
        GLboolean glBlendEnabled = glIsEnabled (GL_BLEND);
 
1182
 
 
1183
        if (!glBlendEnabled)
 
1184
            glEnable (GL_BLEND);
 
1185
 
1161
1186
        glBindTexture (GL_TEXTURE_2D, cursor.texture);
1162
1187
 
1163
1188
        streamingBuffer->begin (GL_TRIANGLE_STRIP);
1221
1246
    }
1222
1247
 
1223
1248
    XFixesCursorImage *ci = XFixesGetCursorImage (dpy);
1224
 
    unsigned char *pixels;
 
1249
    unsigned char     *pixels;
 
1250
    unsigned long     pix;
1225
1251
 
1226
1252
    if (ci)
1227
1253
    {
1239
1265
 
1240
1266
        for (i = 0; i < ci->width * ci->height; ++i)
1241
1267
        {
1242
 
            unsigned long pix = ci->pixels[i];
1243
 
            pixels[i * 4] = pix & 0xff;
 
1268
            pix                 = ci->pixels[i];
 
1269
            pixels[i * 4]       = pix & 0xff;
1244
1270
            pixels[(i * 4) + 1] = (pix >> 8) & 0xff;
1245
1271
            pixels[(i * 4) + 2] = (pix >> 16) & 0xff;
1246
1272
            pixels[(i * 4) + 3] = (pix >> 24) & 0xff;
1264
1290
 
1265
1291
        for (i = 0; i < cursor->width * cursor->height; ++i)
1266
1292
        {
1267
 
            unsigned long pix = 0x00ffffff;
1268
 
            pixels[i * 4] = pix & 0xff;
 
1293
            pix                 = 0x00ffffff;
 
1294
            pixels[i * 4]       = pix & 0xff;
1269
1295
            pixels[(i * 4) + 1] = (pix >> 8) & 0xff;
1270
1296
            pixels[(i * 4) + 2] = (pix >> 16) & 0xff;
1271
1297
            pixels[(i * 4) + 3] = (pix >> 24) & 0xff;
1319
1345
    /* Force cursor hiding and mouse panning if this output is locked
1320
1346
     * and cursor hiding is not enabled and we are syncing the mouse
1321
1347
     */
1322
 
    if (!optionGetScaleMouse () &&
1323
 
        (optionGetZoomMode () == EzoomOptions::ZoomModeSyncMouse &&
1324
 
         optionGetHideOriginalMouse () &&
1325
 
         !zooms.at (out).locked))
 
1348
    if (!optionGetScaleMouse ()                                 &&
 
1349
        optionGetZoomMode () == EzoomOptions::ZoomModeSyncMouse &&
 
1350
        optionGetHideOriginalMouse ()                           &&
 
1351
        !zooms.at (out).locked)
1326
1352
        return;
1327
1353
 
1328
1354
    if (!cursorInfoSelected)
1329
1355
    {
1330
1356
        cursorInfoSelected = true;
1331
 
        XFixesSelectCursorInput (screen->dpy (), screen->root (),
 
1357
        XFixesSelectCursorInput (screen->dpy (), screen->root (),
1332
1358
                                 XFixesDisplayCursorNotifyMask);
1333
1359
        updateCursor (&cursor);
1334
1360
    }
1360
1386
{
1361
1387
    int x1 = CompOption::getIntOptionNamed (options, "x1", -1);
1362
1388
    int y1 = CompOption::getIntOptionNamed (options, "y1", -1);
 
1389
 
 
1390
    if (x1 < 0 || y1 < 0)
 
1391
        return false;
 
1392
 
1363
1393
    int x2 = CompOption::getIntOptionNamed (options, "x2", -1);
1364
1394
    int y2 = CompOption::getIntOptionNamed (options, "y2", -1);
1365
1395
 
1366
 
    bool scale    = CompOption::getBoolOptionNamed (options, "scale", false);
1367
 
    bool restrain = CompOption::getBoolOptionNamed (options, "restrain", false);
1368
 
 
1369
 
    if (x1 < 0 || y1 < 0)
1370
 
        return false;
1371
 
 
1372
1396
    if (x2 < 0)
1373
1397
        x2 = x1 + 1;
1374
1398
 
1375
1399
    if (y2 < 0)
1376
1400
        y2 = y1 + 1;
1377
1401
 
1378
 
    int out = screen->outputDeviceForPoint (x1, y1);
1379
 
 
1380
 
    int width  = x2 - x1;
1381
 
    int height = y2 - y1;
 
1402
    bool scale    = CompOption::getBoolOptionNamed (options, "scale", false);
 
1403
    bool restrain = CompOption::getBoolOptionNamed (options, "restrain", false);
 
1404
    int  out      = screen->outputDeviceForPoint (x1, y1);
 
1405
    int  width    = x2 - x1;
 
1406
    int  height   = y2 - y1;
1382
1407
 
1383
1408
    setZoomArea (x1, y1, width, height, false);
1384
1409
    CompOutput *o = &screen->outputDevs (). at(out);
1385
1410
 
1386
1411
    if (scale && width && height)
1387
 
        setScaleBigger (out, width / static_cast <float> (o->width ()),
1388
 
                        height / static_cast <float> (o->height ()));
 
1412
        setScaleBigger (out, width  / static_cast <float> (o->width ()),
 
1413
                             height / static_cast <float> (o->height ()));
1389
1414
 
1390
 
        if (restrain)
1391
 
            restrainCursor (out);
 
1415
    if (restrain)
 
1416
        restrainCursor (out);
1392
1417
 
1393
1418
    toggleFunctions (true);
1394
1419
 
1437
1462
    int height = y2 - y1;
1438
1463
 
1439
1464
    if (scale && width && height)
1440
 
        setScaleBigger (out, width / static_cast <float> (o->width ()),
1441
 
                        height / static_cast <float> (o->height ()));
 
1465
        setScaleBigger (out, width  / static_cast <float> (o->width ()),
 
1466
                             height / static_cast <float> (o->height ()));
1442
1467
 
1443
1468
    if (restrain)
1444
1469
        restrainCursor (out);
1503
1528
 
1504
1529
        int        out = screen->outputDeviceForGeometry (outGeometry);
1505
1530
        CompOutput *o  = &screen->outputDevs (). at (out);
1506
 
        setScaleBigger (out, width / static_cast <float> (o->width ()),
1507
 
                        height / static_cast <float> (o->height ()));
 
1531
        setScaleBigger (out, width  / static_cast <float> (o->width ()),
 
1532
                             height / static_cast <float> (o->height ()));
1508
1533
        setZoomArea (x, y, width, height, false);
1509
1534
    }
1510
1535
 
1526
1551
        !isInMovement (out))
1527
1552
        setCenter (pointerX, pointerY, true);
1528
1553
 
1529
 
    setScale (out,
1530
 
              zooms.at (out).newZoom /
1531
 
              optionGetZoomFactor ());
 
1554
    setScale (out, zooms.at (out).newZoom / optionGetZoomFactor ());
1532
1555
 
1533
1556
    toggleFunctions (true);
1534
1557
 
1620
1643
    if (!w)
1621
1644
        return true;
1622
1645
 
1623
 
    int        width  = w->width () + w->border ().left + w->border ().right;
1624
 
    int        height = w->height () + w->border ().top + w->border ().bottom;
 
1646
    int        width  = w->width ()  + w->border ().left + w->border ().right;
 
1647
    int        height = w->height () + w->border ().top  + w->border ().bottom;
1625
1648
    int        out    = screen->outputDeviceForGeometry (w->geometry ());
1626
1649
    CompOutput *o     = &screen->outputDevs ().at (out);
1627
1650
 
1628
 
    setScaleBigger (out, width / static_cast <float> (o->width ()),
1629
 
                    height / static_cast <float> (o->height ()));
 
1651
    setScaleBigger (out, width  / static_cast <float> (o->width ()),
 
1652
                         height / static_cast <float> (o->height ()));
1630
1653
    areaToWindow (w);
1631
1654
    toggleFunctions (true);
1632
1655
 
1637
1660
EZoomScreen::zoomPan (CompAction         *action,
1638
1661
                      CompAction::State  state,
1639
1662
                      CompOption::Vector options,
1640
 
                      float              horizAmount,
1641
 
                      float              vertAmount)
 
1663
                      float              horizAmount,
 
1664
                      float              vertAmount)
1642
1665
{
1643
1666
    panZoom (horizAmount, vertAmount);
1644
1667
 
1649
1672
 */
1650
1673
bool
1651
1674
EZoomScreen::zoomCenterMouse (CompAction         *action,
1652
 
                             CompAction::State  state,
1653
 
                             CompOption::Vector options)
 
1675
                              CompAction::State  state,
 
1676
                              CompOption::Vector options)
1654
1677
{
1655
1678
    int out = screen->outputDeviceForPoint (pointerX, pointerY);
1656
1679
 
1684
1707
    XWindowChanges xwc;
1685
1708
 
1686
1709
    int out = screen->outputDeviceForGeometry (w->geometry ());
1687
 
    xwc.x = w->serverX ();
1688
 
    xwc.y = w->serverY ();
1689
 
    xwc.width = (int) (screen->outputDevs ().at (out).width () *
1690
 
                       zooms.at (out).currentZoom -
1691
 
                       (int) ((w->border ().left + w->border ().right)));
 
1710
    xwc.x   = w->serverX ();
 
1711
    xwc.y   = w->serverY ();
 
1712
 
 
1713
    xwc.width  = (int) (screen->outputDevs ().at (out).width () *
 
1714
                        zooms.at (out).currentZoom -
 
1715
                        (int) ((w->border ().left + w->border ().right)));
1692
1716
    xwc.height = (int) (screen->outputDevs ().at (out).height () *
1693
1717
                        zooms.at (out).currentZoom -
1694
1718
                        (int) ((w->border ().top + w->border ().bottom)));
1750
1774
 
1751
1775
bool
1752
1776
EZoomScreen::terminate (CompAction         *action,
1753
 
                       CompAction::State  state,
1754
 
                       CompOption::Vector options)
 
1777
                        CompAction::State  state,
 
1778
                        CompOption::Vector options)
1755
1779
{
1756
1780
    int out = screen->outputDeviceForPoint (pointerX, pointerY);
1757
1781
 
1765
1789
 
1766
1790
    action->setState (action->state () & ~(CompAction::StateTermKey |
1767
1791
                                           CompAction::StateTermButton));
 
1792
 
1768
1793
    return false;
1769
 
 
1770
1794
}
1771
1795
 
1772
1796
/* Focus-track related event handling.
1812
1836
 
1813
1837
    if (optionGetFocusFitWindow ())
1814
1838
    {
1815
 
        int width = w->width () + w->border ().left + w->border ().right;
1816
 
        int height = w->height () + w->border ().top + w->border ().bottom;
1817
 
        float scale = MAX (width / static_cast <float> (screen->outputDevs ().at(out).width ()),
 
1839
        int width  = w->width ()  + w->border ().left + w->border ().right;
 
1840
        int height = w->height () + w->border ().top  + w->border ().bottom;
 
1841
        float scale = MAX (width  / static_cast <float> (screen->outputDevs ().at (out).width ()),
1818
1842
                           height / static_cast <float> (screen->outputDevs ().at (out).height ()));
1819
1843
 
1820
1844
        if (scale > optionGetAutoscaleMin ())
1853
1877
 
1854
1878
                cScreen->damageScreen ();
1855
1879
            }
 
1880
 
1856
1881
            break;
1857
1882
 
1858
1883
        case FocusIn:
1868
1893
                if (cursor.isSet)
1869
1894
                    updateCursor (&cursor);
1870
1895
            }
 
1896
 
1871
1897
            break;
1872
1898
    }
1873
1899