129
132
if (!outputIsZoomArea (out))
132
if (zs->zooms.at (out).currentZoom != 1.0f
133
|| zs->zooms.at (out).newZoom != 1.0f)
136
if (zs->zooms.at (out).zVelocity != 0.0f)
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)
142
143
/* Returns the distance to the defined edge in zoomed pixels. */
144
EZoomScreen::distanceToEdge (int out, EZoomScreen::ZoomEdge edge)
145
EZoomScreen::distanceToEdge (int out,
146
EZoomScreen::ZoomEdge edge)
147
148
CompOutput *o = &screen->outputDevs ().at (out);
149
150
if (!isActive (out))
151
155
convertToZoomedTarget (out, o->region ()->extents.x2,
152
156
o->region ()->extents.y2, &x2, &y2);
153
157
convertToZoomedTarget (out, o->region ()->extents.x1,
154
158
o->region ()->extents.y1, &x1, &y1);
161
case WEST: return o->region ()->extents.x1 - x1;
157
162
case NORTH: return o->region ()->extents.y1 - y1;
163
case EAST: return x2 - o->region ()->extents.x2;
158
164
case SOUTH: return y2 - o->region ()->extents.y2;
159
case EAST: return x2 - o->region ()->extents.x2;
160
case WEST: return o->region ()->extents.x1 - x1;
162
167
return 0; // Never reached.
165
/* Update/set translations based on zoom level and real translate. */
170
/* Update/set translations based on zoom level and real translate. */
167
172
EZoomScreen::ZoomArea::updateActualTranslates ()
169
174
xtrans = -realXTranslate * (1.0f - currentZoom);
170
ytrans = realYTranslate * (1.0f - currentZoom);
175
ytrans = realYTranslate * (1.0f - currentZoom);
173
178
/* Returns true if the head in question is currently moving.
179
184
EZoomScreen::isInMovement (int out)
181
if (zooms.at (out).currentZoom == 1.0f &&
182
zooms.at (out).newZoom == 1.0f &&
183
zooms.at (out).zVelocity == 0.0f)
186
if (zooms.at (out).currentZoom == 1.0f &&
187
zooms.at (out).newZoom == 1.0f &&
188
zooms.at (out).zVelocity == 0.0f)
185
if (zooms.at (out).currentZoom != zooms.at (out).newZoom ||
186
zooms.at (out).xVelocity || zooms.at (out).yVelocity ||
187
zooms.at (out).zVelocity)
189
if (zooms.at (out).xTranslate != zooms.at (out).realXTranslate ||
191
if (zooms.at (out).currentZoom != zooms.at (out).newZoom ||
192
zooms.at (out).xVelocity ||
193
zooms.at (out).yVelocity ||
194
zooms.at (out).zVelocity ||
195
zooms.at (out).xTranslate != zooms.at (out).realXTranslate ||
190
196
zooms.at (out).yTranslate != zooms.at (out).realYTranslate)
222
231
yTranslate (0.0f),
223
232
realXTranslate (0.0f),
224
233
realYTranslate (0.0f),
228
/* Adjust the velocity in the z-direction. */
240
/* Adjust the velocity in the z-direction. */
230
EZoomScreen::adjustZoomVelocity (int out, float chunk)
242
EZoomScreen::adjustZoomVelocity (int out,
232
float d, adjust, amount;
234
d = (zooms.at (out).newZoom - zooms.at (out).currentZoom) * 75.0f;
245
float d = (zooms.at (out).newZoom - zooms.at (out).currentZoom) * 75.0f;
246
float adjust = d * 0.002f;
247
float amount = fabs (d);
238
249
if (amount < 1.0f)
240
251
else if (amount > 5.0f)
243
zooms.at (out).zVelocity =
244
(amount * zooms.at (out).zVelocity + adjust) / (amount + 1.0f);
254
zooms.at (out).zVelocity = (amount * zooms.at (out).zVelocity + adjust) /
246
257
if (fabs (d) < 0.1f && fabs (zooms.at (out).zVelocity) < 0.005f)
248
259
zooms.at (out).currentZoom = zooms.at (out).newZoom;
249
zooms.at (out).zVelocity = 0.0f;
260
zooms.at (out).zVelocity = 0.0f;
253
263
zooms.at (out).currentZoom += (zooms.at (out).zVelocity * chunk) /
254
cScreen->redrawTime ();
264
cScreen->redrawTime ();
258
267
/* Adjust the X/Y velocity based on target translation and real
259
268
* translation. */
261
EZoomScreen::adjustXYVelocity (int out, float chunk)
270
EZoomScreen::adjustXYVelocity (int out,
264
float xadjust, yadjust;
265
float xamount, yamount;
267
273
zooms.at (out).xVelocity /= 1.25f;
268
274
zooms.at (out).yVelocity /= 1.25f;
270
(zooms.at (out).xTranslate - zooms.at (out).realXTranslate) *
273
(zooms.at (out).yTranslate - zooms.at (out).realYTranslate) *
275
xadjust = xdiff * 0.002f;
276
yadjust = ydiff * 0.002f;
277
xamount = fabs (xdiff);
278
yamount = fabs (ydiff);
277
(zooms.at (out).xTranslate - zooms.at (out).realXTranslate) * 75.0f;
279
(zooms.at (out).yTranslate - zooms.at (out).realYTranslate) * 75.0f;
281
float xadjust = xdiff * 0.002f;
282
float yadjust = ydiff * 0.002f;
283
float xamount = fabs (xdiff);
284
float yamount = fabs (ydiff);
280
286
if (xamount < 1.0f)
282
288
else if (xamount > 5.0)
285
291
if (yamount < 1.0f)
287
293
else if (yamount > 5.0)
290
296
zooms.at (out).xVelocity =
291
297
(xamount * zooms.at (out).xVelocity + xadjust) / (xamount + 1.0f);
308
314
(zooms.at (out).yVelocity * chunk) / cScreen->redrawTime ();
311
/* Animate the movement (if any) in preparation of a paint screen. */
317
/* Animate the movement (if any) in preparation of a paint screen. */
313
EZoomScreen::preparePaint (int msSinceLastPaint)
319
EZoomScreen::preparePaint (int msSinceLastPaint)
323
float amount = msSinceLastPaint * 0.05f * optionGetSpeed ();
324
int steps = amount / (0.5f * optionGetTimestep ());
320
amount = msSinceLastPaint * 0.05f * optionGetSpeed ();
321
steps = amount / (0.5f * optionGetTimestep ());
324
chunk = amount / (float) steps;
329
float chunk = amount / (float) steps;
328
for (out = 0; out < zooms.size (); out++)
333
for (unsigned int out = 0; out < zooms.size (); ++out)
330
335
if (!isInMovement (out) || !isActive (out))
333
338
adjustXYVelocity (out, chunk);
334
339
adjustZoomVelocity (out, chunk);
335
340
zooms.at (out).updateActualTranslates ();
336
342
if (!isZoomed (out))
338
zooms.at (out).xVelocity = zooms.at (out).yVelocity =
344
zooms.at (out).xVelocity = zooms.at (out).yVelocity = 0.0f;
340
345
grabbed &= ~(1 << zooms.at (out).output);
343
349
cScreen->damageScreen ();
353
360
cScreen->preparePaint (msSinceLastPaint);
356
/* Damage screen if we're still moving. */
363
/* Damage screen if we're still moving. */
358
365
EZoomScreen::donePaint ()
363
for (out = 0; out < zooms.size (); out++)
369
for (unsigned int out = 0; out < zooms.size (); ++out)
365
371
if (isInMovement (out) && isActive (out))
372
378
else if (grabIndex)
373
379
cScreen->damageScreen ();
375
toggleFunctions (false);
381
toggleFunctions (false);
377
383
cScreen->donePaint ();
379
/* Draws a box from the screen coordinates inx1,iny1 to inx2,iny2 */
386
/* Draws a box from the screen coordinates inx1, iny1 to inx2, iny2. */
381
388
EZoomScreen::drawBox (const GLMatrix &transform,
385
GLMatrix zTransform (transform);
387
int inx1, inx2, iny1, iny2;
388
int out = output->id ();
389
GLushort colorData[4];
390
GLfloat vertexData[12];
392
GLMatrix zTransform (transform);
393
int inx1, inx2, iny1, iny2;
394
int out = output->id ();
395
GLushort colorData[4];
396
GLfloat vertexData[12];
391
397
GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
393
399
zTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
394
400
convertToZoomed (out, box.x1 (), box.y1 (), &inx1, &iny1);
395
401
convertToZoomed (out, box.x2 (), box.y2 (), &inx2, &iny2);
397
x1 = MIN (inx1, inx2);
398
y1 = MIN (iny1, iny2);
399
x2 = MAX (inx1, inx2);
400
y2 = MAX (iny1, iny2);
402
streamingBuffer->begin (GL_TRIANGLE_STRIP);
404
colorData[0] = 0x2fff;
405
colorData[1] = 0x2fff;
406
colorData[2] = 0x2fff;
407
colorData[3] = 0x4fff;
409
streamingBuffer->addColors (1, colorData);
403
/* We can move in both directions from our starting point
404
* so we need to calculate the right coordinates first. */
405
int x1 = MIN (inx1, inx2);
406
int y1 = MIN (iny1, iny2);
407
int x2 = MAX (inx1, inx2);
408
int y2 = MAX (iny1, iny2);
410
const float MaxUShortFloat = std::numeric_limits <unsigned short>::max ();
412
GLboolean glBlendEnabled = glIsEnabled (GL_BLEND);
414
/* just enable blending if it is disabled */
418
/* Draw filled rectangle */
419
float alpha = optionGetZoomBoxFillColorAlpha () / MaxUShortFloat;
420
GLushort *color = optionGetZoomBoxFillColor ();
422
colorData[0] = alpha * color[0];
423
colorData[1] = alpha * color[1];
424
colorData[2] = alpha * color[2];
425
colorData[3] = alpha * MaxUShortFloat;
411
427
vertexData[0] = x1;
412
428
vertexData[1] = y1;
421
437
vertexData[10] = y2;
422
438
vertexData[11] = 0.0f;
441
streamingBuffer->begin (GL_TRIANGLE_STRIP);
443
streamingBuffer->addColors (1, colorData);
424
444
streamingBuffer->addVertices (4, vertexData);
426
446
streamingBuffer->end ();
427
447
streamingBuffer->render (zTransform);
430
streamingBuffer->begin (GL_LINE_LOOP);
432
colorData[0] = 0x2fff;
433
colorData[1] = 0x2fff;
434
colorData[2] = 0x4fff;
435
colorData[3] = 0x9fff;
437
streamingBuffer->addColors (1, colorData);
449
/* draw rectangle outline */
450
alpha = optionGetZoomBoxOutlineColorAlpha () / MaxUShortFloat;
451
color = optionGetZoomBoxOutlineColor ();
453
colorData[0] = alpha * color[0];
454
colorData[1] = alpha * color[1];
455
colorData[2] = alpha * color[2];
456
colorData[3] = alpha * MaxUShortFloat;
439
458
vertexData[0] = x1;
440
459
vertexData[1] = y1;
449
468
vertexData[10] = y2;
450
469
vertexData[11] = 0.0f;
473
streamingBuffer->begin (GL_LINE_LOOP);
475
streamingBuffer->addColors (1, colorData);
452
476
streamingBuffer->addVertices (4, vertexData);
454
478
streamingBuffer->end ();
455
479
streamingBuffer->render (zTransform);
481
/* just disable blending if it was disabled before */
483
glDisable (GL_BLEND);
485
/* Damage the zoom selection box region during draw. */
486
cScreen->damageRegion (CompRegion (x1 - 1,
457
492
/* Apply the zoom if we are grabbed.
458
493
* Make sure to use the correct filter.
461
496
EZoomScreen::glPaintOutput (const GLScreenPaintAttrib &attrib,
462
const GLMatrix &transform,
463
const CompRegion ®ion,
497
const GLMatrix &transform,
498
const CompRegion ®ion,
468
int out = output->id ();
503
int out = output->id ();
470
505
if (isActive (out))
472
GLScreenPaintAttrib sa = attrib;
507
GLScreenPaintAttrib sa = attrib;
473
508
GLMatrix zTransform = transform;
475
510
mask &= ~PAINT_SCREEN_REGION_MASK;
476
511
mask |= PAINT_SCREEN_CLEAR_MASK;
478
513
zTransform.scale (1.0f / zooms.at (out).currentZoom,
479
1.0f / zooms.at (out).currentZoom,
514
1.0f / zooms.at (out).currentZoom,
481
516
zTransform.translate (zooms.at (out).xtrans,
482
517
zooms.at (out).ytrans,
487
522
status = gScreen->glPaintOutput (sa, zTransform, region, output, mask);
489
524
drawCursor (output, transform);
527
status = gScreen->glPaintOutput (attrib, transform, region, output, mask);
494
status = gScreen->glPaintOutput (attrib, transform, region, output,
498
530
drawBox (transform, output, box);
503
535
/* Makes sure we're not attempting to translate too far.
504
536
* We are restricted to 0.5 to not go beyond the end
505
* of the screen/head. */
537
* of the screen/head. */
506
538
static inline void
507
539
constrainZoomTranslate ()
510
541
ZOOM_SCREEN (screen);
512
for (out = 0; out < zs->zooms.size (); out++)
543
for (unsigned int out = 0; out < zs->zooms.size (); ++out)
514
545
if (zs->zooms.at (out).xTranslate > 0.5f)
515
546
zs->zooms.at (out).xTranslate = 0.5f;
526
557
/* Functions for adjusting the zoomed area.
527
558
* These are the core of the zoom plug-in; Anything wanting
528
559
* to adjust the zoomed area must use setCenter or setZoomArea
529
* and setScale or front ends to them. */
560
* and setScale or front ends to them. */
531
562
/* Sets the center of the zoom area to X,Y.
532
563
* We have to be able to warp the pointer here: If we are moved by
538
569
* that is, it's the point that's the same regardless of zoom level.
541
EZoomScreen::setCenter (int x, int y, bool instant)
572
EZoomScreen::setCenter (int x,
543
576
int out = screen->outputDeviceForPoint (x, y);
544
CompOutput *o = &screen->outputDevs ().at (out);
577
CompOutput *o = &screen->outputDevs ().at (out);
546
579
if (zooms.at (out).locked)
567
600
/* Zooms the area described.
568
601
* The math could probably be cleaned up, but should be correct now. */
570
EZoomScreen::setZoomArea (int x,
603
EZoomScreen::setZoomArea (int x,
576
609
CompWindow::Geometry outGeometry (x, y, width, height, 0);
577
int out = screen->outputDeviceForGeometry (outGeometry);
578
CompOutput *o = &screen->outputDevs ().at (out);
580
if (zooms.at (out).newZoom == 1.0f)
583
if (zooms.at (out).locked)
610
int out = screen->outputDeviceForGeometry (outGeometry);
612
if (zooms.at (out).newZoom == 1.0f ||
613
zooms.at (out).locked)
616
CompOutput *o = &screen->outputDevs ().at (out);
585
618
zooms.at (out).xTranslate =
586
619
(float) -((o->width () / 2) - (x + (width / 2) - o->x1 ()))
608
641
EZoomScreen::areaToWindow (CompWindow *w)
610
int left = w->serverX () - w->border ().left;
611
int width = w->width () + w->border ().left + w->border ().right;
612
int top = w->serverY () - w->border ().top;
613
int height = w->height () + w->border ().top + w->border ().bottom;
643
int left = w->serverX () - w->border ().left;
644
int top = w->serverY () - w->border ().top;
645
int width = w->width () + w->border ().left + w->border ().right;
646
int height = w->height () + w->border ().top + w->border ().bottom;
615
648
setZoomArea (left, top, width, height, false);
618
651
/* Pans the zoomed area vertically/horizontally by * value * zs->panFactor
619
652
* TODO: Fix output. */
621
EZoomScreen::panZoom (int xvalue, int yvalue)
654
EZoomScreen::panZoom (int xvalue,
657
float panFactor = optionGetPanFactor ();
625
for (out = 0; out < zooms.size (); out++)
659
for (unsigned int out = 0; out < zooms.size (); ++out)
627
zooms.at (out).xTranslate +=
628
optionGetPanFactor () * xvalue *
629
zooms.at (out).currentZoom;
630
zooms.at (out).yTranslate +=
631
optionGetPanFactor () * yvalue *
632
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;
635
665
constrainZoomTranslate ();
644
674
pollHandle.start ();
645
675
lastChange = time(NULL);
646
mouse = MousePoller::getCurrentPosition ();
676
mouse = MousePoller::getCurrentPosition ();
649
679
/* Sets the zoom (or scale) level.
650
680
* Cleans up if we are suddenly zoomed out.
653
EZoomScreen::setScale (int out, float value)
683
EZoomScreen::setScale (int out,
655
686
if (zooms.at (out).locked)
703
737
EZoomScreen::syncCenterToMouse ()
709
out = screen->outputDeviceForPoint (mouse.x (), mouse.y ());
710
o = &screen->outputDevs ().at (out);
739
int out = screen->outputDeviceForPoint (mouse.x (), mouse.y ());
712
741
if (!isInMovement (out))
715
x = (int) ((zooms.at (out).realXTranslate * o->width ()) +
716
(o->width () / 2) + o->x1 ());
717
y = (int) ((zooms.at (out).realYTranslate * o->height ()) +
718
(o->height () / 2) + o->y1 ());
720
if ((x != mouse.x () || y != mouse.y ())
721
&& grabbed && zooms.at (out).newZoom != 1.0f)
744
CompOutput *o = &screen->outputDevs ().at (out);
746
int x = (int) ((zooms.at (out).realXTranslate * o->width ()) +
747
(o->width () / 2) + o->x1 ());
748
int y = (int) ((zooms.at (out).realYTranslate * o->height ()) +
749
(o->height () / 2) + o->y1 ());
751
if ((x != mouse.x () || y != mouse.y ()) &&
753
zooms.at (out).newZoom != 1.0f)
723
755
screen->warpPointer (x - pointerX , y - pointerY );
729
/* Convert the point X,Y to where it would be when zoomed. */
761
/* Convert the point X, Y to where it would be when zoomed. */
731
EZoomScreen::convertToZoomed (int out,
763
EZoomScreen::convertToZoomed (int out,
739
769
if (!outputIsZoomArea (out))
745
o = &screen->outputDevs ()[out];
746
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;
750
785
*resultX = x - (za.realXTranslate *
751
(1.0f - za.currentZoom) * o->width ()) - o->width () / 2;
786
(1.0f - za.currentZoom) * oWidth) - halfOWidth;
752
787
*resultX /= za.currentZoom;
753
*resultX += o->width () / 2;
788
*resultX += halfOWidth;
754
789
*resultX += o->x1 ();
755
790
*resultY = y - (za.realYTranslate *
756
(1.0f - za.currentZoom) * o->height ()) - o->height ()/ 2;
791
(1.0f - za.currentZoom) * oHeight) - halfOHeight;
757
792
*resultY /= za.currentZoom;
758
*resultY += o->height ()/ 2;
793
*resultY += halfOHeight;
759
794
*resultY += o->y1 ();
762
/* Same but use targeted translation, not real */
797
/* Same but use targeted translation, not real one. */
764
EZoomScreen::convertToZoomedTarget (int out,
799
EZoomScreen::convertToZoomedTarget (int out,
770
CompOutput *o = &screen->outputDevs ().at (out);
772
805
if (!outputIsZoomArea (out))
778
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;
782
*resultX = x - (za.xTranslate *
783
(1.0f - za.newZoom) * o->width ()) - o->width () / 2;
821
*resultX = x - (za.xTranslate * (1.0f - za.newZoom) * oWidth) - halfOWidth;
784
822
*resultX /= za.newZoom;
785
*resultX += o->width () / 2;
823
*resultX += halfOWidth;
786
824
*resultX += o->x1 ();
787
*resultY = y - (za.yTranslate *
788
(1.0f - za.newZoom) * o->height ()) - o->height ()/2;
825
*resultY = y - (za.yTranslate * (1.0f - za.newZoom) * oHeight) - halfOHeight;
789
826
*resultY /= za.newZoom;
790
*resultY += o->height () / 2;
827
*resultY += halfOHeight;
791
828
*resultY += o->y1 ();
796
833
* Returns false if the point isn't on a actively zoomed head
797
834
* or the area is locked. */
799
EZoomScreen::ensureVisibility (int x, int y, int margin)
836
EZoomScreen::ensureVisibility (int x,
840
int out = screen->outputDeviceForPoint (x, y);
805
out = screen->outputDeviceForPoint (x, y);
806
842
if (!isActive (out))
809
o = &screen->outputDevs ().at (out);
810
846
convertToZoomedTarget (out, x, y, &zoomX, &zoomY);
811
847
ZoomArea &za = zooms.at (out);
852
CompOutput *o = &screen->outputDevs ().at (out);
815
854
#define FACTOR (za.newZoom / (1.0f - za.newZoom))
816
855
if (zoomX + margin > o->x2 ())
848
887
EZoomScreen::ensureVisibilityArea (int x1,
855
int targetX, targetY, targetW, targetH;
859
out = screen->outputDeviceForPoint (x1 + (x2-x1/2), y1 + (y2-y1/2));
860
o = &screen->outputDevs ().at (out);
862
#define WIDTHOK (float)(x2-x1) / (float)o->width () < zooms.at (out).newZoom
863
#define HEIGHTOK (float)(y2-y1) / (float)o->height () < zooms.at (out).newZoom
894
int out = screen->outputDeviceForPoint (x1 + (x2 - x1 / 2), y1 + (y2 - y1 / 2));
895
CompOutput *o = &screen->outputDevs ().at (out);
897
bool widthOkay = (float)(x2-x1) / (float)o->width () < zooms.at (out).newZoom;
898
bool heightOkay = (float)(y2-y1) / (float)o->height () < zooms.at (out).newZoom;
867
903
ensureVisibility (x1, y1, margin);
868
904
ensureVisibility (x2, y2, margin);
908
int targetX, targetY, targetW, targetH;
878
917
targetW = x2 - x1;
880
919
targetW = o->width () * zooms.at (out).newZoom;
882
922
targetH = y2 - y1;
884
924
targetH = o->height () * zooms.at (out).newZoom;
961
1014
EZoomScreen::restrainCursor (int out)
963
int x1, y1, x2, y2, margin;
964
1017
int diffX = 0, diffY = 0;
965
int north, south, east, west;
967
1018
CompOutput *o = &screen->outputDevs ().at (out);
969
z = zooms.at (out).newZoom;
970
margin = optionGetRestrainMargin ();
971
north = distanceToEdge (out, NORTH);
972
south = distanceToEdge (out, SOUTH);
973
east = distanceToEdge (out, EAST);
974
west = distanceToEdge (out, WEST);
1020
float z = zooms.at (out).newZoom;
1021
int margin = optionGetRestrainMargin ();
1022
int north = distanceToEdge (out, NORTH);
1023
int south = distanceToEdge (out, SOUTH);
1024
int east = distanceToEdge (out, EAST);
1025
int west = distanceToEdge (out, WEST);
976
1027
if (zooms.at (out).currentZoom == 1.0f)
1003
1055
if (abs(diffX)*z > 0 || abs(diffY)*z > 0)
1004
1056
screen->warpPointer ((int) (mouse.x () - pointerX) -
1005
(int) ((float)diffX * z),
1006
(int) (mouse.y () - pointerY) -
1007
(int) ((float)diffY * z));
1057
(int) ((float)diffX * z),
1058
(int) (mouse.y () - pointerY) -
1059
(int) ((float)diffY * z));
1010
1062
/* Check if the cursor is still visible.
1017
1069
EZoomScreen::cursorMoved ()
1071
int out = screen->outputDeviceForPoint (mouse.x (), mouse.y ());
1021
out = screen->outputDeviceForPoint (mouse.x (), mouse.y ());
1022
1073
if (isActive (out))
1024
1075
if (optionGetRestrainMouse ())
1025
1076
restrainCursor (out);
1027
1078
if (optionGetZoomMode () == EzoomOptions::ZoomModePanArea)
1029
1079
ensureVisibilityArea (mouse.x () - cursor.hotX,
1030
1080
mouse.y () - cursor.hotY,
1031
1081
mouse.x () + cursor.width -
1052
1098
EZoomScreen::updateMousePosition (const CompPoint &p)
1055
1100
mouse.setX (p.x ());
1056
1101
mouse.setY (p.y ());
1057
out = screen->outputDeviceForPoint (mouse.x (), mouse.y ());
1103
int out = screen->outputDeviceForPoint (mouse.x (), mouse.y ());
1058
1104
lastChange = time(NULL);
1059
1106
if (optionGetZoomMode () == EzoomOptions::ZoomModeSyncMouse &&
1060
!isInMovement (out))
1107
!isInMovement (out))
1061
1108
setCenter (mouse.x (), mouse.y (), true);
1062
1110
cursorMoved ();
1063
1111
cScreen->damageScreen ();
1093
1142
/* Translate into place and draw the scaled cursor. */
1095
EZoomScreen::drawCursor (CompOutput *output,
1096
const GLMatrix &transform)
1144
EZoomScreen::drawCursor (CompOutput *output,
1145
const GLMatrix &transform)
1098
int out = output->id ();
1147
int out = output->id ();
1100
1149
if (cursor.isSet)
1102
GLMatrix sTransform = transform;
1105
GLfloat textureData[8];
1106
GLfloat vertexData[12];
1107
GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
1110
1152
* XXX: expo knows how to handle mouse when zoomed, so we back off
1111
1153
* when expo is active.
1113
if (screen->grabExist ( "expo"))
1155
if (screen->grabExist ("expo"))
1115
1157
cursorZoomInactive ();
1161
GLMatrix sTransform = transform;
1164
GLfloat textureData[8];
1165
GLfloat vertexData[12];
1166
GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
1119
1168
sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
1120
1169
convertToZoomed (out, mouse.x (), mouse.y (), &ax, &ay);
1121
1170
sTransform.translate ((float) ax, (float) ay, 0.0f);
1126
1175
scaleFactor = 1.0f / optionGetScaleMouseStatic ();
1128
1177
sTransform.scale (scaleFactor, scaleFactor, 1.0f);
1132
glEnable (GL_BLEND);
1133
glEnable (GL_TEXTURE_2D);
1178
int x = -cursor.hotX;
1179
int y = -cursor.hotY;
1181
GLboolean glBlendEnabled = glIsEnabled (GL_BLEND);
1183
if (!glBlendEnabled)
1184
glEnable (GL_BLEND);
1134
1186
glBindTexture (GL_TEXTURE_2D, cursor.texture);
1136
1188
streamingBuffer->begin (GL_TRIANGLE_STRIP);
1165
1217
streamingBuffer->render (sTransform);
1167
1219
glBindTexture (GL_TEXTURE_2D, 0);
1168
glDisable (GL_TEXTURE_2D);
1169
1220
glDisable (GL_BLEND);
1173
1224
/* Create (if necessary) a texture to store the cursor,
1174
* fetch the cursor with XFixes. Store it. */
1225
* fetch the cursor with XFixes. Store it. */
1176
1227
EZoomScreen::updateCursor (CursorTexture * cursor)
1178
unsigned char *pixels;
1180
Display *dpy = screen->dpy ();
1230
Display *dpy = screen->dpy ();
1182
1232
if (!cursor->isSet)
1184
1234
cursor->isSet = true;
1185
1235
cursor->screen = screen;
1187
glEnable (GL_TEXTURE_2D);
1188
1237
glGenTextures (1, &cursor->texture);
1189
1238
glBindTexture (GL_TEXTURE_2D, cursor->texture);
1191
1240
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
1192
1241
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
1193
1242
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
1194
gScreen->textureFilter ());
1195
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
1196
gScreen->textureFilter ());
1199
glEnable (GL_TEXTURE_2D);
1243
gScreen->textureFilter ());
1244
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
1245
gScreen->textureFilter ());
1202
1248
XFixesCursorImage *ci = XFixesGetCursorImage (dpy);
1249
unsigned char *pixels;
1206
cursor->width = ci->width;
1254
cursor->width = ci->width;
1207
1255
cursor->height = ci->height;
1208
1256
cursor->hotX = ci->xhot;
1209
1257
cursor->hotY = ci->yhot;
1218
for (i = 0; i < ci->width * ci->height; i++)
1266
for (i = 0; i < ci->width * ci->height; ++i)
1220
unsigned long pix = ci->pixels[i];
1221
pixels[i * 4] = pix & 0xff;
1268
pix = ci->pixels[i];
1269
pixels[i * 4] = pix & 0xff;
1222
1270
pixels[(i * 4) + 1] = (pix >> 8) & 0xff;
1223
1271
pixels[(i * 4) + 2] = (pix >> 16) & 0xff;
1224
1272
pixels[(i * 4) + 3] = (pix >> 24) & 0xff;
1231
1279
/* Fallback R: 255 G: 255 B: 255 A: 255
1232
1280
* FIXME: Draw a cairo mouse cursor */
1235
1283
cursor->height = 1;
1238
1286
pixels = (unsigned char *) malloc (cursor->width * cursor->height * 4);
1243
for (i = 0; i < cursor->width * cursor->height; i++)
1291
for (i = 0; i < cursor->width * cursor->height; ++i)
1245
unsigned long pix = 0x00ffffff;
1246
pixels[i * 4] = pix & 0xff;
1294
pixels[i * 4] = pix & 0xff;
1247
1295
pixels[(i * 4) + 1] = (pix >> 8) & 0xff;
1248
1296
pixels[(i * 4) + 2] = (pix >> 16) & 0xff;
1249
1297
pixels[(i * 4) + 3] = (pix >> 24) & 0xff;
1256
1304
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, cursor->width,
1257
1305
cursor->height, 0, GL_BGRA, GL_UNSIGNED_BYTE, pixels);
1258
1306
glBindTexture (GL_TEXTURE_2D, 0);
1259
glDisable (GL_TEXTURE_2D);
1300
1345
/* Force cursor hiding and mouse panning if this output is locked
1301
1346
* and cursor hiding is not enabled and we are syncing the mouse
1304
if (!optionGetScaleMouse () &&
1305
(optionGetZoomMode () == EzoomOptions::ZoomModeSyncMouse &&
1306
optionGetHideOriginalMouse () &&
1307
!zooms.at (out).locked))
1348
if (!optionGetScaleMouse () &&
1349
optionGetZoomMode () == EzoomOptions::ZoomModeSyncMouse &&
1350
optionGetHideOriginalMouse () &&
1351
!zooms.at (out).locked)
1310
1354
if (!cursorInfoSelected)
1312
1356
cursorInfoSelected = true;
1313
XFixesSelectCursorInput (screen->dpy (), screen->root (),
1357
XFixesSelectCursorInput (screen->dpy (), screen->root (),
1314
1358
XFixesDisplayCursorNotifyMask);
1315
1359
updateCursor (&cursor);
1317
if (canHideCursor && !cursorHidden &&
1318
(optionGetHideOriginalMouse () ||
1319
zooms.at (out).locked))
1362
if (canHideCursor &&
1364
(optionGetHideOriginalMouse () || zooms.at (out).locked))
1321
1366
cursorHidden = true;
1322
1367
XFixesHideCursor (screen->dpy (), screen->root ());
1338
1383
EZoomScreen::setZoomAreaAction (CompAction *action,
1339
CompAction::State state,
1340
CompOption::Vector options)
1384
CompAction::State state,
1385
CompOption::Vector options)
1342
int x1, y1, x2, y2, out;
1343
bool scale, restrain;
1346
x1 = CompOption::getIntOptionNamed (options, "x1", -1);
1347
y1 = CompOption::getIntOptionNamed (options, "y1", -1);
1348
x2 = CompOption::getIntOptionNamed (options, "x2", -1);
1349
y2 = CompOption::getIntOptionNamed (options, "y2", -1);
1350
scale = CompOption::getBoolOptionNamed (options, "scale", false);
1351
restrain = CompOption::getBoolOptionNamed (options, "restrain", false);
1387
int x1 = CompOption::getIntOptionNamed (options, "x1", -1);
1388
int y1 = CompOption::getIntOptionNamed (options, "y1", -1);
1353
1390
if (x1 < 0 || y1 < 0)
1393
int x2 = CompOption::getIntOptionNamed (options, "x2", -1);
1394
int y2 = CompOption::getIntOptionNamed (options, "y2", -1);
1362
out = screen->outputDeviceForPoint (x1, y1);
1363
#define WIDTH (x2 - x1)
1364
#define HEIGHT (y2 - y1)
1365
setZoomArea (x1, y1, WIDTH, HEIGHT, false);
1366
o = &screen->outputDevs (). at(out);
1367
if (scale && WIDTH && HEIGHT)
1368
setScaleBigger (out, (float) WIDTH / o->width (),
1369
(float) HEIGHT / o->height ());
1373
restrainCursor (out);
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;
1408
setZoomArea (x1, y1, width, height, false);
1409
CompOutput *o = &screen->outputDevs (). at(out);
1411
if (scale && width && height)
1412
setScaleBigger (out, width / static_cast <float> (o->width ()),
1413
height / static_cast <float> (o->height ()));
1416
restrainCursor (out);
1375
1418
toggleFunctions (true);
1391
1434
EZoomScreen::ensureVisibilityAction (CompAction *action,
1392
CompAction::State state,
1393
CompOption::Vector options)
1435
CompAction::State state,
1436
CompOption::Vector options)
1395
int x1, y1, x2, y2, margin, out;
1396
bool scale, restrain;
1438
int x1 = CompOption::getIntOptionNamed (options, "x1", -1);
1439
int y1 = CompOption::getIntOptionNamed (options, "y1", -1);
1399
x1 = CompOption::getIntOptionNamed (options, "x1", -1);
1400
y1 = CompOption::getIntOptionNamed (options, "y1", -1);
1401
x2 = CompOption::getIntOptionNamed (options, "x2", -1);
1402
y2 = CompOption::getIntOptionNamed (options, "y2", -1);
1403
margin = CompOption::getBoolOptionNamed (options, "margin", 0);
1404
scale = CompOption::getBoolOptionNamed (options, "scale", false);
1405
restrain = CompOption::getBoolOptionNamed (options, "restrain", false);
1406
1441
if (x1 < 0 || y1 < 0)
1444
int x2 = CompOption::getIntOptionNamed (options, "x2", -1);
1445
int y2 = CompOption::getIntOptionNamed (options, "y2", -1);
1446
int margin = CompOption::getBoolOptionNamed (options, "margin", 0);
1447
bool scale = CompOption::getBoolOptionNamed (options, "scale", false);
1448
bool restrain = CompOption::getBoolOptionNamed (options, "restrain", false);
1410
out = screen->outputDeviceForPoint (x1, y1);
1453
int out = screen->outputDeviceForPoint (x1, y1);
1411
1454
ensureVisibility (x1, y1, margin);
1412
1456
if (x2 >= 0 && y2 >= 0)
1413
ensureVisibility (x2, y2, margin);
1414
o = &screen->outputDevs (). at(out);
1415
#define WIDTH (x2 - x1)
1416
#define HEIGHT (y2 - y1)
1417
if (scale && WIDTH && HEIGHT)
1418
setScaleBigger (out, (float) WIDTH / o->width (),
1419
(float) HEIGHT / o->height ());
1457
ensureVisibility (x2, y2, margin);
1459
CompOutput *o = &screen->outputDevs (). at(out);
1461
int width = x2 - x1;
1462
int height = y2 - y1;
1464
if (scale && width && height)
1465
setScaleBigger (out, width / static_cast <float> (o->width ()),
1466
height / static_cast <float> (o->height ()));
1423
1469
restrainCursor (out);
1433
1479
EZoomScreen::zoomBoxActivate (CompAction *action,
1434
CompAction::State state,
1435
CompOption::Vector options)
1480
CompAction::State state,
1481
CompOption::Vector options)
1437
1483
grabIndex = screen->pushGrab (None, "ezoom");
1438
1484
clickPos.setX (pointerX);
1439
1485
clickPos.setY (pointerY);
1440
1486
box.setGeometry (pointerX, pointerY, 0, 0);
1441
1488
if (state & CompAction::StateInitButton)
1442
action->setState (action->state () | CompAction::StateTermButton);
1489
action->setState (action->state () | CompAction::StateTermButton);
1444
1491
toggleFunctions (true);
1450
1497
EZoomScreen::zoomBoxDeactivate (CompAction *action,
1451
CompAction::State state,
1452
CompOption::Vector options)
1498
CompAction::State state,
1499
CompOption::Vector options)
1457
int x, y, width, height;
1460
screen->removeGrab (grabIndex, NULL);
1463
if (pointerX < clickPos.x ())
1503
screen->removeGrab (grabIndex, NULL);
1506
if (pointerX < clickPos.x ())
1465
1508
box.setX (pointerX);
1466
1509
box.setWidth (clickPos.x () - pointerX);
1470
1512
box.setWidth (pointerX - clickPos.x ());
1473
if (pointerY < clickPos.y ())
1514
if (pointerY < clickPos.y ())
1475
1516
box.setY (pointerY);
1476
1517
box.setHeight (clickPos.y () - pointerY);
1480
1520
box.setHeight (pointerY - clickPos.y ());
1483
x = MIN (box.x1 (), box.x2 ());
1484
y = MIN (box.y1 (), box.y2 ());
1485
width = MAX (box.x1 (), box.x2 ()) - x;
1486
height = MAX (box.y1 (), box.y2 ()) - y;
1488
CompWindow::Geometry outGeometry (x, y, width, height, 0);
1490
out = screen->outputDeviceForGeometry (outGeometry);
1491
o = &screen->outputDevs (). at (out);
1492
setScaleBigger (out, (float) width/o->width (), (float)
1493
height/o->height ());
1494
setZoomArea (x,y,width,height,false);
1522
int x = MIN (box.x1 (), box.x2 ());
1523
int y = MIN (box.y1 (), box.y2 ());
1524
int width = MAX (box.x1 (), box.x2 ()) - x;
1525
int height = MAX (box.y1 (), box.y2 ()) - y;
1527
CompWindow::Geometry outGeometry (x, y, width, height, 0);
1529
int out = screen->outputDeviceForGeometry (outGeometry);
1530
CompOutput *o = &screen->outputDevs (). at (out);
1531
setScaleBigger (out, width / static_cast <float> (o->width ()),
1532
height / static_cast <float> (o->height ()));
1533
setZoomArea (x, y, width, height, false);
1497
1536
toggleFunctions (true);
1505
1544
EZoomScreen::zoomIn (CompAction *action,
1506
CompAction::State state,
1507
CompOption::Vector options)
1545
CompAction::State state,
1546
CompOption::Vector options)
1509
1548
int out = screen->outputDeviceForPoint (pointerX, pointerY);
1511
1550
if (optionGetZoomMode () == EzoomOptions::ZoomModeSyncMouse &&
1512
1551
!isInMovement (out))
1513
setCenter (pointerX, pointerY, true);
1552
setCenter (pointerX, pointerY, true);
1516
zooms.at (out).newZoom /
1517
optionGetZoomFactor ());
1554
setScale (out, zooms.at (out).newZoom / optionGetZoomFactor ());
1519
1556
toggleFunctions (true);
1545
1582
EZoomScreen::zoomSpecific (CompAction *action,
1546
CompAction::State state,
1547
CompOption::Vector options,
1548
SpecificZoomTarget target)
1583
CompAction::State state,
1584
CompOption::Vector options,
1585
SpecificZoomTarget target)
1550
int out = screen->outputDeviceForPoint (pointerX, pointerY);
1587
int out = screen->outputDeviceForPoint (pointerX, pointerY);
1554
1590
switch (target)
1556
1592
case ZoomTargetFirst:
1557
1593
zoom_level = optionGetZoomSpec1 ();
1559
1596
case ZoomTargetSecond:
1560
1597
zoom_level = optionGetZoomSpec2 ();
1562
1600
case ZoomTargetThird:
1563
1601
zoom_level = optionGetZoomSpec3 ();
1569
if (zoom_level == 1.0f && zooms.at (out).newZoom == 1.0f)
1571
if (screen->otherGrabExist (NULL))
1608
if ((zoom_level == zooms.at (out).newZoom) ||
1609
screen->otherGrabExist (NULL))
1574
1612
setScale (out, zoom_level);
1576
w = screen->findWindow (screen->activeWindow ());
1577
if (optionGetSpecTargetFocus ()
1614
CompWindow *w = screen->findWindow (screen->activeWindow ());
1616
if (optionGetSpecTargetFocus () && w)
1584
int x = CompOption::getIntOptionNamed (options, "x", 0);
1585
int y = CompOption::getIntOptionNamed (options, "y", 0);
1586
setCenter (x, y, false);
1620
int x = CompOption::getIntOptionNamed (options, "x", 0);
1621
int y = CompOption::getIntOptionNamed (options, "y", 0);
1622
setCenter (x, y, false);
1589
1625
toggleFunctions (true);
1600
1636
EZoomScreen::zoomToWindow (CompAction *action,
1601
CompAction::State state,
1602
CompOption::Vector options)
1637
CompAction::State state,
1638
CompOption::Vector options)
1604
int width, height, out;
1640
Window xid = CompOption::getIntOptionNamed (options, "window", 0);
1641
CompWindow *w = screen->findWindow (xid);
1609
xid = CompOption::getIntOptionNamed (options, "window", 0);
1610
w = screen->findWindow (xid);
1613
width = w->width () + w->border ().left + w->border ().right;
1614
height = w->height () + w->border ().top + w->border ().bottom;
1615
out = screen->outputDeviceForGeometry (w->geometry ());
1616
o = &screen->outputDevs ().at (out);
1617
setScaleBigger (out, (float) width/o->width (),
1618
(float) height/o->height ());
1646
int width = w->width () + w->border ().left + w->border ().right;
1647
int height = w->height () + w->border ().top + w->border ().bottom;
1648
int out = screen->outputDeviceForGeometry (w->geometry ());
1649
CompOutput *o = &screen->outputDevs ().at (out);
1651
setScaleBigger (out, width / static_cast <float> (o->width ()),
1652
height / static_cast <float> (o->height ()));
1619
1653
areaToWindow (w);
1620
1654
toggleFunctions (true);
1640
1674
EZoomScreen::zoomCenterMouse (CompAction *action,
1641
CompAction::State state,
1642
CompOption::Vector options)
1675
CompAction::State state,
1676
CompOption::Vector options)
1647
out = screen->outputDeviceForPoint (pointerX, pointerY);
1648
screen->warpPointer ((int) (screen->outputDevs ().at (out).width ()/2 +
1649
screen->outputDevs ().at (out).x1 () - pointerX)
1678
int out = screen->outputDeviceForPoint (pointerX, pointerY);
1680
screen->warpPointer ((int) (screen->outputDevs ().at (out).width () / 2 +
1681
screen->outputDevs ().at (out).x1 () - pointerX)
1650
1682
+ ((float) screen->outputDevs ().at (out).width () *
1651
-zooms.at (out).xtrans),
1652
(int) (screen->outputDevs ().at (out).height ()/2 +
1683
-zooms.at (out).xtrans),
1684
(int) (screen->outputDevs ().at (out).height () / 2 +
1653
1685
screen->outputDevs ().at (out).y1 () - pointerY)
1654
1686
+ ((float) screen->outputDevs ().at (out).height () *
1655
zooms.at (out).ytrans));
1687
zooms.at (out).ytrans));
1665
1697
EZoomScreen::zoomFitWindowToZoom (CompAction *action,
1666
CompAction::State state,
1667
CompOption::Vector options)
1698
CompAction::State state,
1699
CompOption::Vector options)
1701
CompWindow *w = screen->findWindow (CompOption::getIntOptionNamed (options,
1670
1706
unsigned int mask = CWWidth | CWHeight;
1671
1707
XWindowChanges xwc;
1674
w = screen->findWindow (CompOption::getIntOptionNamed (
1675
options, "window", 0));
1679
out = screen->outputDeviceForGeometry (w->geometry ());
1680
xwc.x = w->serverX ();
1681
xwc.y = w->serverY ();
1682
xwc.width = (int) (screen->outputDevs ().at (out).width () *
1683
zooms.at (out).currentZoom -
1684
(int) ((w->border ().left + w->border ().right)));
1709
int out = screen->outputDeviceForGeometry (w->geometry ());
1710
xwc.x = w->serverX ();
1711
xwc.y = w->serverY ();
1713
xwc.width = (int) (screen->outputDevs ().at (out).width () *
1714
zooms.at (out).currentZoom -
1715
(int) ((w->border ().left + w->border ().right)));
1685
1716
xwc.height = (int) (screen->outputDevs ().at (out).height () *
1686
1717
zooms.at (out).currentZoom -
1687
1718
(int) ((w->border ().top + w->border ().bottom)));
1746
1776
EZoomScreen::terminate (CompAction *action,
1747
CompAction::State state,
1748
CompOption::Vector options)
1777
CompAction::State state,
1778
CompOption::Vector options)
1752
out = screen->outputDeviceForPoint (pointerX, pointerY);
1780
int out = screen->outputDeviceForPoint (pointerX, pointerY);
1756
zooms.at (out).newZoom = 1.0f;
1757
cScreen->damageScreen ();
1784
zooms.at (out).newZoom = 1.0f;
1785
cScreen->damageScreen ();
1760
1788
toggleFunctions (true);
1762
1790
action->setState (action->state () & ~(CompAction::StateTermKey |
1763
1791
CompAction::StateTermButton));
1768
1796
/* Focus-track related event handling.
1790
1815
else if (event->type != FocusIn)
1793
if ((event->xfocus.mode != NotifyNormal)
1794
&& (lastMapped != event->xfocus.window))
1818
if ((event->xfocus.mode != NotifyNormal) &&
1819
(lastMapped != event->xfocus.window))
1797
1822
lastMapped = 0;
1798
w = screen->findWindow (event->xfocus.window);
1799
if (w == NULL || w->id () == screen->activeWindow ())
1823
CompWindow *w = screen->findWindow (event->xfocus.window);
1802
if (time(NULL) - lastChange < optionGetFollowFocusDelay () ||
1826
w->id () == screen->activeWindow () ||
1827
time(NULL) - lastChange < optionGetFollowFocusDelay () ||
1803
1828
!optionGetFollowFocus ())
1806
out = screen->outputDeviceForGeometry (w->geometry ());
1831
int out = screen->outputDeviceForGeometry (w->geometry ());
1807
1833
if (!isActive (out) &&
1808
1834
!optionGetAlwaysFocusFitWindow ())
1810
1837
if (optionGetFocusFitWindow ())
1812
int width = w->width () + w->border ().left + w->border ().right;
1813
int height = w->height () + w->border ().top + w->border ().bottom;
1814
float scale = MAX ((float) width/screen->outputDevs ().at(out).width (),
1815
(float) height/screen->outputDevs ().at (out).height ());
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 ()),
1842
height / static_cast <float> (screen->outputDevs ().at (out).height ()));
1816
1844
if (scale > optionGetAutoscaleMin ())
1817
setScale (out, scale);
1845
setScale (out, scale);
1820
1848
areaToWindow (w);
1822
1850
toggleFunctions (true);
1826
1853
/* Event handler. Pass focus-related events on and handle XFixes events. */
1828
1855
EZoomScreen::handleEvent (XEvent *event)
1830
switch (event->type) {
1857
switch (event->type)
1831
1859
case MotionNotify:
1834
if (pointerX < clickPos.x ())
1862
if (pointerX < clickPos.x ())
1836
1864
box.setX (pointerX);
1837
1865
box.setWidth (clickPos.x () - pointerX);
1841
1868
box.setWidth (pointerX - clickPos.x ());
1844
if (pointerY < clickPos.y ())
1870
if (pointerY < clickPos.y ())
1846
1872
box.setY (pointerY);
1847
1873
box.setHeight (clickPos.y () - pointerY);
1851
1876
box.setHeight (pointerY - clickPos.y ());
1853
cScreen->damageScreen ();
1878
cScreen->damageScreen ();
1858
1884
case MapNotify:
1859
1885
focusTrack (event);
1862
1889
if (event->type == fixesEventBase + XFixesCursorNotify)
1864
1891
//XFixesCursorNotifyEvent *cev = (XFixesCursorNotifyEvent *)
1867
updateCursor (&cursor);
1894
updateCursor (&cursor);
1995
2022
ZoomPluginVTable::init ()
1997
if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION) ||
1998
!CompPlugin::checkPluginABI ("composite", COMPIZ_COMPOSITE_ABI) ||
1999
!CompPlugin::checkPluginABI ("opengl", COMPIZ_OPENGL_ABI) ||
2000
!CompPlugin::checkPluginABI ("mousepoll", COMPIZ_MOUSEPOLL_ABI))
2024
if (CompPlugin::checkPluginABI ("core", CORE_ABIVERSION) &&
2025
CompPlugin::checkPluginABI ("composite", COMPIZ_COMPOSITE_ABI) &&
2026
CompPlugin::checkPluginABI ("opengl", COMPIZ_OPENGL_ABI) &&
2027
CompPlugin::checkPluginABI ("mousepoll", COMPIZ_MOUSEPOLL_ABI))