3
* Compiz shift switcher plugin
7
* Copyright : (C) 2007 by Dennis Kasprzyk
8
* E-mail : onestone@opencompositing.org
12
* Copyright : (C) 2007 by Danny Baumann
13
* E-mail : maniac@opencompositing.org
15
* Based on scale.c and switcher.c:
16
* Copyright : (C) 2007 David Reveman
17
* E-mail : davidr@novell.com
19
* Rounded corner drawing taken from wall.c:
20
* Copyright : (C) 2007 Robert Carr
21
* E-mail : racarr@beryl-project.org
23
* This program is free software; you can redistribute it and/or
24
* modify it under the terms of the GNU General Public License
25
* as published by the Free Software Foundation; either version 2
26
* of the License, or (at your option) any later version.
28
* This program is distributed in the hope that it will be useful,
29
* but WITHOUT ANY WARRANTY; without even the implied warranty of
30
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31
* GNU General Public License for more details.
38
COMPIZ_PLUGIN_20090315 (shift, ShiftPluginVTable);
40
bool textAvailable = false;
43
setFunctions (bool enabled)
45
SHIFT_SCREEN (screen);
47
screen->handleEventSetEnabled (ss, enabled);
48
ss->cScreen->preparePaintSetEnabled (ss, enabled);
49
ss->cScreen->paintSetEnabled (ss, enabled);
50
ss->gScreen->glPaintOutputSetEnabled (ss, enabled);
51
ss->cScreen->donePaintSetEnabled (ss, enabled);
53
foreach (CompWindow *w, screen->windows ())
57
sw->gWindow->glPaintSetEnabled (sw, enabled);
58
sw->cWindow->damageRectSetEnabled (sw, enabled);
63
ShiftScreen::activateEvent (bool activating)
69
o[0] = CompOption ("root", CompOption::TypeInt);
70
o[0].value ().set ((int) screen->root ());
72
o[1] = CompOption ("active", CompOption::TypeBool);
73
o[1].value ().set (activating);
75
screen->handleCompizEvent ("shift", "activate", o);
79
ShiftWindow::isShiftable ()
81
SHIFT_SCREEN (screen);
83
if (window->overrideRedirect ())
86
if (window->wmType () & (CompWindowTypeDockMask | CompWindowTypeDesktopMask))
89
if (!window->mapNum () || !window->isViewable ())
91
if (ss->optionGetMinimized ())
93
if (!window->minimized () && !window->inShowDesktopMode () && !window->shaded ())
100
if (ss->mType == ShiftTypeNormal)
102
if (!window->mapNum () || !window->isViewable ())
104
if (window->serverGeometry ().x () + window->serverGeometry ().width () <= 0 ||
105
window->serverGeometry ().y () + window->serverGeometry ().height () <= 0 ||
106
window->serverGeometry ().x () >= screen->width () ||
107
window->serverGeometry ().y () >= screen->height ())
112
if (!window->focus ())
116
else if (ss->mType == ShiftTypeGroup &&
117
ss->mClientLeader != window->clientLeader () &&
118
ss->mClientLeader != window->id ())
123
if (window->state () & CompWindowStateSkipTaskbarMask)
126
if (ss->mCurrentMatch && !ss->mCurrentMatch->evaluate (window))
133
ShiftScreen::freeWindowTitle ()
138
ShiftScreen::renderWindowTitle ()
148
if (!optionGetWindowTitle ())
151
if (optionGetMultioutputMode () ==
152
ShiftOptions::MultioutputModeOneBigSwitcher)
154
oe.setGeometry (0, 0, screen->width (), screen->height ());
157
oe = screen->getCurrentOutputExtents ();
159
/* 75% of the output device as maximum width */
160
tA.maxWidth = oe.width () * 3 / 4;
164
tA.size = optionGetTitleFontSize ();
165
tA.color[0] = optionGetTitleFontColorRed ();
166
tA.color[1] = optionGetTitleFontColorGreen ();
167
tA.color[2] = optionGetTitleFontColorBlue ();
168
tA.color[3] = optionGetTitleFontColorAlpha ();
170
tA.flags = CompText::WithBackground | CompText::Ellipsized;
171
if (optionGetTitleFontBold ())
172
tA.flags |= CompText::StyleBold;
176
tA.bgColor[0] = optionGetTitleBackColorRed ();
177
tA.bgColor[1] = optionGetTitleBackColorGreen ();
178
tA.bgColor[2] = optionGetTitleBackColorBlue ();
179
tA.bgColor[3] = optionGetTitleBackColorAlpha ();
181
text.renderWindowTitle (mSelectedWindow ? mSelectedWindow : None,
182
mType == ShiftTypeAll, tA);
186
ShiftScreen::drawWindowTitle ()
188
float width, height, border = 10.0f;
191
width = text.getWidth ();
192
height = text.getHeight ();
194
if (optionGetMultioutputMode () == MultioutputModeOneBigSwitcher)
196
oe.setGeometry (0, 0, screen->width (), screen->height ());
200
oe = (CompRect) screen->outputDevs ()[mUsedOutput];
203
float x = oe.centerX () - width / 2;
206
/* assign y (for the lower corner!) according to the setting */
207
switch (optionGetTitleTextPlacement ())
209
case TitleTextPlacementCenteredOnScreen:
210
y = oe.centerY () + height / 2;
212
case TitleTextPlacementAbove:
213
case TitleTextPlacementBelow:
215
CompRect workArea = screen->currentOutputDev ().workArea ();
217
if (optionGetTitleTextPlacement () ==
218
TitleTextPlacementAbove)
219
y = oe.y1 () + workArea.y1 () + 2 * border + height;
221
y = oe.y1 () + workArea.y2 () - 2 * border;
228
text.draw (floor (x), floor (y), 1.0f);
232
ShiftWindow::glPaint (const GLWindowPaintAttrib &attrib,
233
const GLMatrix &transform,
234
const CompRegion ®ion,
239
SHIFT_SCREEN (screen);
240
if (ss->mState != ShiftStateNone && !ss->mPaintingAbove &&
241
!(window->wmType () & (CompWindowTypeDesktopMask |
242
CompWindowTypeDockMask)))
244
GLWindowPaintAttrib sAttrib = attrib;
247
if (window->mapNum ())
249
if (gWindow->textures ().empty ())
255
scaled = (ss->mActiveSlot != NULL);
257
if (mOpacity > 0.01 && (ss->mActiveSlot == NULL))
259
sAttrib.brightness = sAttrib.brightness * mBrightness;
260
sAttrib.opacity = sAttrib.opacity * mOpacity;
263
mask |= PAINT_WINDOW_NO_CORE_INSTANCE_MASK;
266
((unsigned int) ss->mOutput->id () == (unsigned int) ss->mUsedOutput ||
267
(unsigned int) ss->mOutput->id () == (unsigned int) ~0))
268
mask |= PAINT_WINDOW_NO_CORE_INSTANCE_MASK;
271
status = gWindow->glPaint (sAttrib, transform, region, mask);
273
if (scaled && !gWindow->textures ().empty ())
275
GLFragment::Attrib fragment (attrib);
276
GLMatrix wTransform = transform;
277
ShiftSlot *slot = ss->mActiveSlot->slot;
279
float sx = ss->mAnim * slot->tx;
280
float sy = ss->mAnim * slot->ty;
281
float sz = ss->mAnim * slot->z;
282
float srot = (ss->mAnim * slot->rotation);
283
float anim = MIN (1.0, MAX (0.0, ss->mAnim));
290
sscale = (ss->mAnim * slot->scale) + (1 - ss->mAnim);
292
sscale = ss->mAnim * slot->scale;
294
if (slot->primary && !ss->mReflectActive)
295
sopacity = (ss->mAnim * slot->opacity) + (1 - ss->mAnim);
297
sopacity = anim * anim * slot->opacity;
299
if (sopacity <= 0.05)
302
/*if (mask & PAINT_WINDOW_OCCLUSION_DETECTION_MASK)
305
fragment.setOpacity ((float)fragment.getOpacity () * sopacity);
306
fragment.setBrightness ((float)fragment.getBrightness () *
307
ss->mReflectBrightness);
309
if (window->alpha () || fragment.getOpacity () != OPAQUE)
310
mask |= PAINT_WINDOW_TRANSLUCENT_MASK;
312
wTransform.translate (sx, sy, sz);
314
wTransform.translate (window->x () + (window->width () * sscale / 2),
315
window->y () + (window->height () * sscale / 2.0),
318
wTransform.scale (ss->mOutput->width (), -ss->mOutput->height (),
321
wTransform.rotate (srot, 0.0, 1.0, 0.0);
323
wTransform.scale (1.0f / ss->mOutput->width (),
324
-1.0f / ss->mOutput->height (), 1.0f);
326
wTransform.scale (sscale, sscale, 1.0f);
327
wTransform.translate (-window->x () - (window->width () / 2),
328
-window->y () - (window->height () / 2), 0.0f);
331
glLoadMatrixf (wTransform.getMatrix ());
333
gWindow->glDraw (wTransform, fragment, region,
334
mask | PAINT_WINDOW_TRANSFORMED_MASK);
339
if (scaled && ((ss->optionGetOverlayIcon () != ShiftOptions::OverlayIconNone) ||
340
gWindow->textures ().empty ()))
344
icon = gWindow->getIcon (96, 96);
346
icon = ss->gScreen->defaultIcon ();
348
if (icon && (icon->name ()))
354
int scaledWinWidth, scaledWinHeight;
355
int iconOverlay = ss->optionGetOverlayIcon ();
356
ShiftSlot *slot = ss->mActiveSlot->slot;
357
GLTexture::MatrixList matl;
359
float sx = ss->mAnim * slot->tx;
360
float sy = ss->mAnim * slot->ty;
361
float sz = ss->mAnim * slot->z;
362
float srot = (ss->mAnim * slot->rotation);
363
float sopacity = ss->mAnim * slot->opacity;
368
sscale = (ss->mAnim * slot->scale) + (1 - ss->mAnim);
370
sscale = ss->mAnim * ss->mAnim * slot->scale;
372
scaledWinWidth = window->width () * sscale;
373
scaledWinHeight = window->height () * sscale;
375
if (gWindow->textures ().empty ())
376
iconOverlay = ShiftOptions::OverlayIconBig;
380
case ShiftOptions::OverlayIconNone:
381
case ShiftOptions::OverlayIconEmblem:
384
case ShiftOptions::OverlayIconBig:
386
/* only change opacity if not painting an
387
icon for a minimized window */
388
if (!gWindow->textures ().empty ())
389
sAttrib.opacity /= 3;
390
scale = MIN (((float) scaledWinWidth / icon->width ()),
391
((float) scaledWinHeight / icon->height ()));
395
width = icon->width () * scale;
396
height = icon->height () * scale;
400
case ShiftOptions::OverlayIconNone:
401
case ShiftOptions::OverlayIconEmblem:
402
x = scaledWinWidth - width;
403
y = scaledWinHeight - height;
405
case ShiftOptions::OverlayIconBig:
407
x = scaledWinWidth / 2 - width / 2;
408
y = scaledWinHeight / 2 - height / 2;
412
mask |= PAINT_WINDOW_BLEND_MASK;
414
/* if we paint the icon for a minimized window, we need
415
to force the usage of a good texture filter */
416
if (gWindow->textures ().empty ())
417
mask |= PAINT_WINDOW_TRANSFORMED_MASK;
419
iconReg = CompRegion (0, 0, icon->width (), icon->height ());
421
gWindow->geometry ().reset ();
423
matl.push_back (icon->matrix ());
425
gWindow->glAddGeometry (matl, iconReg, iconReg);
427
if (gWindow->geometry ().vCount)
429
GLFragment::Attrib fragment (sAttrib);
430
GLMatrix wTransform (transform);
432
if (gWindow->textures ().empty ())
433
sAttrib.opacity = gWindow->paintAttrib ().opacity;
435
fragment = GLFragment::Attrib (sAttrib);
437
fragment.setOpacity ((float)fragment.getOpacity () * sopacity);
438
fragment.setBrightness ((float)fragment.getBrightness () *
439
ss->mReflectBrightness);
441
wTransform.translate (sx, sy, sz);
443
wTransform.translate (window->x () +
444
(window->width () * sscale / 2),
446
(window->height () * sscale / 2.0), 0.0f);
448
wTransform.scale (ss->mOutput->width (),
449
-ss->mOutput->height (), 1.0f);
451
wTransform.rotate (srot, 0.0, 1.0, 0.0);
453
wTransform.scale (1.0f / ss->mOutput->width (),
454
-1.0f / ss->mOutput->height (), 1.0f);
456
wTransform.translate (x -
457
(window->width () * sscale / 2), y -
458
(window->height () * sscale / 2.0), 0.0f);
459
wTransform.scale (scale, scale, 1.0f);
462
glLoadMatrixf (wTransform.getMatrix ());
464
gWindow->glDrawTexture (icon, fragment, mask);
474
GLWindowPaintAttrib sAttrib = attrib;
476
if (ss->mPaintingAbove)
478
sAttrib.opacity = sAttrib.opacity * (1.0 - ss->mAnim);
480
if (ss->mAnim > 0.99)
481
mask |= PAINT_WINDOW_NO_CORE_INSTANCE_MASK;
484
status = gWindow->glPaint (sAttrib, transform, region, mask);
491
compareWindows (const void *elem1,
494
CompWindow *w1 = *((CompWindow **) elem1);
495
CompWindow *w2 = *((CompWindow **) elem2);
501
if (!w1->shaded () && !w1->isViewable () &&
502
(w2->shaded () || w2->isViewable ()))
507
if (!w2->shaded () && !w2->isViewable () &&
508
(w1->shaded () || w1->isViewable ()))
523
compareShiftWindowDistance (const void *elem1,
526
float a1 = ((ShiftDrawSlot *) elem1)->distance;
527
float a2 = ((ShiftDrawSlot *) elem2)->distance;
528
float ab = fabs (a1 - a2);
530
if (ab > 0.3 && a1 > a2)
532
else if (ab > 0.3 && a1 < a2)
535
return compareWindows (&((ShiftDrawSlot *) elem2)->w,
536
&((ShiftDrawSlot *) elem1)->w);
540
ShiftScreen::layoutThumbsCover ()
545
float xScale, yScale;
551
if (optionGetMultioutputMode () ==
552
ShiftScreen::MultioutputModeOneBigSwitcher)
554
oe.setGeometry (0, 0, screen->width (), screen->height ());
558
oe = screen->outputDevs ()[mUsedOutput];
561
/* the center of the ellipse is in the middle
562
of the used output device */
563
int centerX = oe.centerX ();
564
int centerY = oe.centerY ();
566
int maxThumbWidth = oe.width () * optionGetSize () / 100;
567
int maxThumbHeight = oe.height () * optionGetSize () / 100;
569
for (index = 0; index < mNWindows; index++)
574
ww = w->width () + w->border ().left + w->border ().right;
575
wh = w->height () + w->border ().top + w->border ().bottom;
577
if (ww > maxThumbWidth)
578
xScale = (float)(maxThumbWidth) / (float)ww;
582
if (wh > maxThumbHeight)
583
yScale = (float)(maxThumbHeight) / (float)wh;
588
float val1 = floor((float) MIN (mNWindows,
589
optionGetCoverMaxVisibleWindows ()) / 2.0);
592
float space = (maxThumbWidth / 2);
593
space *= cos (sin (PI / 4) * PI / 3);
595
//space += (space / sin (PI / 4)) - space;
597
for (i = 0; i < 2; i++)
599
if (mInvert ^ (i == 0))
601
distance = mMvTarget - index;
602
distance += optionGetCoverOffset ();
606
distance = mMvTarget - index + mNWindows;
607
distance += optionGetCoverOffset ();
608
if (distance > mNWindows)
609
distance -= mNWindows * 2;
613
pos = MIN (1.0, MAX (-1.0, distance));
615
sw->mSlots[i].opacity = 1.0 - MIN (1.0, MAX (0.0, fabs(distance) - val1));
616
sw->mSlots[i].scale = MIN (xScale, yScale);
618
sw->mSlots[i].y = centerY + (maxThumbHeight / 2.0) -
619
(((w->height () / 2.0) + w->border ().bottom) *
620
sw->mSlots[i].scale);
622
if (fabs(distance) < 1.0)
624
sw->mSlots[i].x = centerX + (sin(pos * PI * 0.5) * space * optionGetCoverExtraSpace ());
625
sw->mSlots[i].z = fabs (distance);
626
sw->mSlots[i].z *= -(maxThumbWidth / (2.0 * oe.width ()));
628
sw->mSlots[i].rotation = sin(pos * PI * 0.5) * -optionGetCoverAngle ();
632
float rad = (space / oe.width ()) / sin(PI / 6.0);
634
float ang = (PI / MAX(72.0, mNWindows * 2)) *
635
(distance - pos) + (pos * (PI / 6.0));
637
sw->mSlots[i].x = centerX;
638
sw->mSlots[i].x += sin(ang) * rad * oe.width () * optionGetCoverExtraSpace ();
640
sw->mSlots[i].rotation = optionGetCoverAngle () + 30;
641
sw->mSlots[i].rotation -= fabs(ang) * 180.0 / PI;
642
sw->mSlots[i].rotation *= -pos;
644
sw->mSlots[i].z = -(maxThumbWidth / (2.0 * oe.width ()));
645
sw->mSlots[i].z += -(cos(PI / 6.0) * rad);
646
sw->mSlots[i].z += (cos(ang) * rad);
649
mDrawSlots[index * 2 + i].w = w;
650
mDrawSlots[index * 2 + i].slot = &sw->mSlots[i];
651
mDrawSlots[index * 2 + i].distance = fabs(distance);
655
if (mDrawSlots[index * 2].distance >
656
mDrawSlots[index * 2 + 1].distance)
658
mDrawSlots[index * 2].slot->primary = false;
659
mDrawSlots[index * 2 + 1].slot->primary = true;
663
mDrawSlots[index * 2].slot->primary = true;
664
mDrawSlots[index * 2 + 1].slot->primary = false;
669
mNSlots = mNWindows * 2;
671
qsort (mDrawSlots, mNSlots, sizeof (ShiftDrawSlot),
672
compareShiftWindowDistance);
678
ShiftScreen::layoutThumbsFlip ()
683
float xScale, yScale;
691
if (optionGetMultioutputMode () ==
692
ShiftOptions::MultioutputModeOneBigSwitcher)
694
oe.setGeometry (0, 0, screen->width (), screen->height ());
698
oe = screen->outputDevs ()[mUsedOutput];
701
/* the center of the ellipse is in the middle
702
of the used output device */
703
int centerX = oe.centerX ();
704
int centerY = oe.centerY ();
706
int maxThumbWidth = oe.width () * optionGetSize () / 100;
707
int maxThumbHeight = oe.height () * optionGetSize () / 100;
711
for (index = 0; index < mNWindows; index++)
716
ww = w->width () + w->border ().left + w->border ().right;
717
wh = w->height () + w->border ().top + w->border ().bottom;
719
if (ww > maxThumbWidth)
720
xScale = (float)(maxThumbWidth) / (float)ww;
724
if (wh > maxThumbHeight)
725
yScale = (float)(maxThumbHeight) / (float)wh;
729
angle = optionGetFlipRotation () * PI / 180.0;
731
for (i = 0; i < 2; i++)
733
if (mInvert ^ (i == 0))
734
distance = mMvTarget - index;
737
distance = mMvTarget - index + mNWindows;
739
distance -= mNWindows * 2;
743
sw->mSlots[i].opacity = MAX (0.0, 1.0 - (distance * 1.0));
746
if (distance < -(mNWindows - 1))
747
sw->mSlots[i].opacity = MAX (0.0, mNWindows +
750
sw->mSlots[i].opacity = 1.0;
753
if (distance > 0.0 && w->id () != mSelectedWindow)
754
sw->mSlots[i].primary = false;
756
sw->mSlots[i].primary = true;
759
sw->mSlots[i].scale = MIN (xScale, yScale);
761
sw->mSlots[i].y = centerY + (maxThumbHeight / 2.0) -
762
(((w->height () / 2.0) + w->border ().bottom) *
763
sw->mSlots[i].scale);
765
sw->mSlots[i].x = sin(angle) * distance * (maxThumbWidth / 2);
766
if (distance > 0 && false)
767
sw->mSlots[i].x *= 1.5;
768
sw->mSlots[i].x += centerX;
770
sw->mSlots[i].z = cos(angle) * distance;
772
sw->mSlots[i].z *= 1.5;
773
sw->mSlots[i].z *= (maxThumbWidth / (2.0 * oe.width ()));
775
sw->mSlots[i].rotation = optionGetFlipRotation ();
777
if (sw->mSlots[i].opacity > 0.0)
779
mDrawSlots[slotNum].w = w;
780
mDrawSlots[slotNum].slot = &sw->mSlots[i];
781
mDrawSlots[slotNum].distance = -distance;
789
qsort (mDrawSlots, mNSlots, sizeof (ShiftDrawSlot),
790
compareShiftWindowDistance);
797
ShiftScreen::layoutThumbs ()
801
if (mState == ShiftStateNone)
804
switch (optionGetMode ())
806
case ShiftScreen::ModeCover:
807
result = layoutThumbsCover ();
809
case ShiftScreen::ModeFlip:
810
result = layoutThumbsFlip ();
814
if (mState == ShiftStateIn)
822
ShiftScreen::addWindowToList (CompWindow *w)
824
if (mWindowsSize <= mNWindows)
826
mWindows = (CompWindow **) realloc (mWindows,
827
sizeof (CompWindow *) * (mNWindows + 32));
831
mWindowsSize = mNWindows + 32;
834
if (mSlotsSize <= mNWindows * 2)
836
mDrawSlots = (ShiftDrawSlot *) realloc (mDrawSlots,
837
sizeof (ShiftDrawSlot) *
838
((mNWindows * 2) + 64));
846
mSlotsSize = (mNWindows * 2) + 64;
849
mWindows[mNWindows++] = w;
853
ShiftScreen::updateWindowList ()
858
qsort (mWindows, mNWindows, sizeof (CompWindow *), compareWindows);
863
for (i = 0; i < mNWindows; i++)
865
if (mWindows[i]->id () == mSelectedWindow)
870
if (mMvTarget == mNWindows)
873
/* create spetial window order to create a good animation
874
A,B,C,D,E --> A,B,D,E,C to get B,D,E,C,(A),B,D,E,C as initial state */
875
if (optionGetMode () == ShiftScreen::ModeCover)
877
wins = (CompWindow **) malloc(mNWindows * sizeof (CompWindow *));
881
memcpy(wins, mWindows, mNWindows * sizeof (CompWindow *));
882
for (i = 0; i < mNWindows; i++)
884
idx = ceil (i * 0.5);
885
idx *= (i & 1) ? 1 : -1;
888
mWindows[idx] = wins[i];
893
return layoutThumbs ();
897
ShiftScreen::createWindowList ()
901
foreach (CompWindow *w, screen->windows ())
904
if (sw->isShiftable ())
911
return updateWindowList ();
915
ShiftScreen::switchToWindow (bool toNext)
923
for (cur = 0; cur < mNWindows; cur++)
925
if (mWindows[cur]->id () == mSelectedWindow)
929
if (cur == mNWindows)
933
w = mWindows[(cur + 1) % mNWindows];
935
w = mWindows[(cur + mNWindows - 1) % mNWindows];
939
Window old = mSelectedWindow;
940
mSelectedWindow = w->id ();
950
cScreen->damageScreen ();
951
renderWindowTitle ();
957
ShiftScreen::countWindows ()
961
foreach (CompWindow *w, screen->windows ())
963
if (ShiftWindow::get (w)->isShiftable ())
971
ShiftScreen::adjustShiftMovement (float chunk)
973
float dx, adjust, amount;
979
amount = fabs(dx) * 1.5f;
982
else if (amount > 2.0f)
985
mMvVelocity = (amount * mMvVelocity + adjust) / (amount + 1.0f);
987
if (fabs (dx) < 0.002f && fabs (mMvVelocity) < 0.004f)
990
mMvTarget = mMvTarget + mMvAdjust;
996
change = mMvVelocity * chunk;
1000
change = (mMvAdjust > 0) ? 0.01 : -0.01;
1003
mMvAdjust -= change;
1004
mMvTarget += change;
1006
while (mMvTarget >= mNWindows)
1008
mMvTarget -= mNWindows;
1012
while (mMvTarget < 0)
1014
mMvTarget += mNWindows;
1018
if (!layoutThumbs ())
1025
ShiftWindow::adjustShiftAttribs (float chunk)
1027
float dp, db, adjust, amount;
1028
float opacity, brightness;
1030
SHIFT_SCREEN (screen);
1032
if ((mActive && ss->mState != ShiftStateIn &&
1033
ss->mState != ShiftStateNone) ||
1034
(ss->optionGetHideAll () && !(window->type () & CompWindowTypeDesktopMask) &&
1035
(ss->mState == ShiftStateOut || ss->mState == ShiftStateSwitching ||
1036
ss->mState == ShiftStateFinish)))
1041
if (ss->mState == ShiftStateIn || ss->mState == ShiftStateNone)
1044
brightness = ss->optionGetBackgroundIntensity ();
1046
dp = opacity - mOpacity;
1048
amount = fabs (dp) * 7.0f;
1051
else if (amount > 0.15f)
1054
mOpacityVelocity = (amount * mOpacityVelocity + adjust) /
1057
db = brightness - mBrightness;
1059
amount = fabs (db) * 7.0f;
1062
else if (amount > 0.15f)
1065
mBrightnessVelocity = (amount * mBrightnessVelocity + adjust) /
1068
/* FIXME: There is a possible floating point overflow here,
1069
* can be worked-around but not particularly nice */
1071
if ((fabs (dp) < 0.1f && fabs (mOpacityVelocity) < 0.2f &&
1072
fabs (db) < 0.1f && fabs (mBrightnessVelocity) < 0.2f) ||
1073
(fabs(db) != fabs (db) || fabs (mOpacityVelocity) != fabs (mOpacityVelocity) ||
1074
fabs (dp) != fabs (dp) || fabs (mBrightnessVelocity) != fabs (mBrightnessVelocity)))
1076
mBrightness = brightness;
1081
mBrightness += mBrightnessVelocity * chunk;
1082
mOpacity += mOpacityVelocity * chunk;
1087
ShiftScreen::adjustShiftAnimationAttribs (float chunk)
1089
float dr, adjust, amount;
1092
if (mState != ShiftStateIn && mState != ShiftStateNone)
1099
amount = fabs (dr) * 7.0f;
1100
if (amount < 0.002f)
1102
else if (amount > 0.15f)
1105
mAnimVelocity = (amount * mAnimVelocity + adjust) /
1108
if (fabs (dr) < 0.002f && fabs (mAnimVelocity) < 0.004f)
1114
mAnim += mAnimVelocity * chunk;
1119
ShiftScreen::glPaintOutput (const GLScreenPaintAttrib &attrib,
1120
const GLMatrix &transform,
1121
const CompRegion ®ion,
1127
if (mState != ShiftStateNone)
1128
mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;
1130
mPaintingAbove = false;
1134
status = gScreen->glPaintOutput (attrib, transform, region, output, mask);
1136
if (mState != ShiftStateNone &&
1137
((unsigned int) output->id () == (unsigned int) mUsedOutput ||
1138
((unsigned int) output->id () == (unsigned int) ~0)))
1141
GLMatrix sTransform (transform);
1143
int oy1 = screen->outputDevs ()[mUsedOutput].region ()->extents.y1;
1144
int oy2 = screen->outputDevs ()[mUsedOutput].region ()->extents.y2;
1145
int maxThumbHeight = (oy2 - oy1) * optionGetSize () / 100;
1146
int oldFilter = gScreen->textureFilter ();
1148
if (optionGetMultioutputMode () == ShiftOptions::MultioutputModeOneBigSwitcher)
1151
oy2 = screen->height ();
1154
sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
1156
GLdouble clip[4] = { 0.0, -1.0, 0.0, 0.0};
1158
clip[3] = ((oy1 + (oy2 - oy1) / 2)) + (maxThumbHeight / 2.0);
1160
/* Reflection drawing */
1162
if (optionGetReflection ())
1164
GLMatrix rTransform = sTransform;
1165
unsigned short color[4];
1167
glGetIntegerv (GL_CULL_FACE_MODE, &cull);
1168
cullInv = (cull == GL_BACK)? GL_FRONT : GL_BACK;
1170
rTransform.translate (0.0, oy1 + oy2 + maxThumbHeight,
1172
rTransform.scale (1.0, -1.0, 1.0);
1175
glLoadMatrixf (rTransform.getMatrix ());
1177
glCullFace (cullInv);
1179
if (optionGetMipmaps ())
1180
gScreen->setTextureFilter (GL_LINEAR_MIPMAP_LINEAR);
1185
glClipPlane (GL_CLIP_PLANE0, clip);
1186
glEnable (GL_CLIP_PLANE0);
1189
mReflectActive = true;
1190
mReflectBrightness = optionGetIntensity ();
1191
for (i = 0; i < mNSlots; i++)
1193
w = mDrawSlots[i].w;
1197
mActiveSlot = &mDrawSlots[i];
1199
sw->gWindow->glPaint (sw->gWindow->paintAttrib (), rTransform,
1204
glDisable (GL_CLIP_PLANE0);
1208
glTranslatef (0.0, 0.0, -DEFAULT_Z_CAMERA);
1211
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1214
glColor4f (0.0, 0.0, 0.0, 0.0);
1215
glVertex2f (0.5, 0.0);
1216
glVertex2f (-0.5, 0.0);
1217
glColor4f (0.0, 0.0, 0.0,
1218
MIN (1.0, 1.0 - optionGetIntensity ()) * 2.0 *
1220
glVertex2f (-0.5, -0.5);
1221
glVertex2f (0.5, -0.5);
1224
if (optionGetGroundSize () > 0.0)
1227
color[0] = optionGetGroundColor1 ()[0];
1228
color[1] = optionGetGroundColor1 ()[1];
1229
color[2] = optionGetGroundColor1 ()[2];
1230
color[3] = (float)optionGetGroundColor1 ()[3] * mAnim;
1231
glColor4usv (color);
1232
glVertex2f (-0.5, -0.5);
1233
glVertex2f (0.5, -0.5);
1234
color[0] = optionGetGroundColor2 ()[0];
1235
color[1] = optionGetGroundColor2 ()[1];
1236
color[2] = optionGetGroundColor2 ()[2];
1237
color[3] = (float)optionGetGroundColor2 ()[3] * mAnim;
1238
glColor4usv (color);
1239
glVertex2f (0.5, -0.5 + optionGetGroundSize ());
1240
glVertex2f (-0.5, -0.5 + optionGetGroundSize ());
1244
glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
1245
glDisable(GL_BLEND);
1246
glColor4f (1.0, 1.0, 1.0, 1.0);
1250
/* Drawing normal windows */
1253
glLoadMatrixf (sTransform.getMatrix ());
1255
if (optionGetReflection () && mAnim == 1.0)
1257
glClipPlane (GL_CLIP_PLANE0, clip);
1258
glEnable (GL_CLIP_PLANE0);
1261
mReflectBrightness = 1.0;
1262
mReflectActive = false;
1264
for (i = 0; i < mNSlots; i++)
1266
w = mDrawSlots[i].w;
1270
mActiveSlot = &mDrawSlots[i];
1272
sw->gWindow->glPaint (sw->gWindow->paintAttrib (), sTransform,
1277
glDisable (GL_CLIP_PLANE0);
1281
gScreen->setTextureFilter (oldFilter);
1283
if (textAvailable && (mState != ShiftStateIn))
1286
if (mState == ShiftStateIn || mState == ShiftStateOut)
1289
mPaintingAbove = true;
1291
w = screen->findWindow (mSelectedWindow);
1293
for (; w; w = w->next)
1295
if (w->destroyed ())
1300
if (!w->isViewable () || !CompositeWindow::get (w)->damaged ())
1305
for (i = 0; i < mNWindows; i++)
1306
if (mWindows[i] == w)
1313
sw->gWindow->glPaint (sw->gWindow->paintAttrib (), sTransform,
1317
mPaintingAbove = false;
1327
ShiftScreen::paint (CompOutput::ptrList &outputs,
1331
if (mState != ShiftStateNone && outputs.size () > 0 &&
1332
optionGetMultioutputMode () == ShiftOptions::MultioutputModeOneBigSwitcher)
1334
CompOutput::ptrList newOutputs;
1335
newOutputs.push_back (&screen->fullscreenOutput ());
1337
cScreen->paint (newOutputs, mask);
1341
cScreen->paint (outputs, mask);
1346
ShiftScreen::preparePaint (int msSinceLastPaint)
1348
if (mState != ShiftStateNone &&
1349
(mMoreAdjust || mMoveAdjust))
1352
float amount, chunk;
1355
amount = msSinceLastPaint * 0.05f * optionGetShiftSpeed ();
1356
steps = amount / (0.5f * optionGetTimestep ());
1360
chunk = amount / (float) steps;
1365
mMoveAdjust = adjustShiftMovement (chunk);
1370
amount = msSinceLastPaint * 0.05f * optionGetSpeed ();
1371
steps = amount / (0.5f * optionGetTimestep ());
1375
chunk = amount / (float) steps;
1379
mMoreAdjust = adjustShiftAnimationAttribs (chunk);
1381
foreach (CompWindow *w, screen->windows ())
1385
mMoreAdjust |= sw->adjustShiftAttribs (chunk);
1386
for (i = 0; i < 2; i++)
1388
ShiftSlot *slot = &sw->mSlots[i];
1389
slot->tx = slot->x - w->x () -
1390
(w->width () * slot->scale) / 2;
1391
slot->ty = slot->y - w->y () -
1392
(w->height () * slot->scale) / 2;
1401
cScreen->preparePaint (msSinceLastPaint);
1405
ShiftWindow::canStackRelativeTo ()
1407
if (window->overrideRedirect ())
1410
if (!window->shaded () && !window->pendingMaps ())
1412
if (!window->isViewable () || window->mapNum () == 0)
1420
ShiftScreen::donePaint ()
1422
if (mState != ShiftStateNone)
1426
cScreen->damageScreen ();
1430
if (mState == ShiftStateIn)
1432
mState = ShiftStateNone;
1433
activateEvent (false);
1434
foreach (CompWindow *w, screen->windows ())
1437
sw->mActive = false;
1439
setFunctions (false);
1440
cScreen->damageScreen ();
1442
else if (mState == ShiftStateOut)
1443
mState = ShiftStateSwitching;
1447
cScreen->damageScreen ();
1449
else if (mState == ShiftStateFinish)
1454
CompWindow *pw = NULL;
1457
mState = ShiftStateIn;
1459
cScreen->damageScreen ();
1461
if (!mCancelled && mMvTarget != 0)
1462
for (i = 0; i < mNSlots; i++)
1464
w = mDrawSlots[i].w;
1468
if (mDrawSlots[i].slot->primary && sw->canStackRelativeTo ())
1471
w->restackAbove (pw);
1476
if (!mCancelled && mSelectedWindow)
1478
w = screen->findWindow (mSelectedWindow);
1480
screen->sendWindowActivationRequest (mSelectedWindow);
1485
cScreen->damageScreen ();
1489
cScreen->donePaint ();
1493
ShiftScreen::term (bool cancel)
1497
screen->removeGrab (mGrabIndex, 0);
1501
if (mState != ShiftStateNone)
1503
if (cancel && mMvTarget != 0)
1505
if (mNWindows - mMvTarget > mMvTarget)
1506
mMvAdjust = -mMvTarget;
1508
mMvAdjust = mNWindows - mMvTarget;
1512
mMoreAdjust = false;
1513
mMoveAdjust = false;
1514
mState = ShiftStateFinish;
1515
mCancelled = cancel;
1516
cScreen->damageScreen ();
1521
ShiftScreen::terminate (CompAction *action,
1522
CompAction::State state,
1523
CompOption::Vector &options)
1527
xid = CompOption::getIntOptionNamed (options, "root", 0);
1529
if (!(xid && screen->root () != xid))
1531
term ((state & CompAction::StateCancel));
1533
if (action->state () & CompAction::StateTermButton)
1534
action->setState (action->state () & ~CompAction::StateTermButton);
1536
if (action->state () & CompAction::StateTermKey)
1537
action->setState (action->state () & ~CompAction::StateTermKey);
1544
ShiftScreen::initiateScreen (CompAction *action,
1545
CompAction::State state,
1546
CompOption::Vector &options)
1551
if (screen->otherGrabExist ("shift", NULL))
1554
mCurrentMatch = &(optionGetWindowMatch ());
1556
match = CompOption::getMatchOptionNamed (options, "match", CompMatch::emptyMatch);
1557
if (match != CompMatch::emptyMatch)
1561
mCurrentMatch = &mMatch;
1564
count = countWindows ();
1570
mGrabIndex = screen->pushGrab (screen->invisibleCursor (), "shift");
1575
mState = ShiftStateOut;
1576
activateEvent (true);
1578
if (!createWindowList ())
1581
mSelectedWindow = mWindows[0]->id ();
1582
renderWindowTitle ();
1588
cScreen->damageScreen ();
1591
mUsedOutput = screen->currentOutputDev ().id ();
1593
setFunctions (true);
1599
ShiftScreen::doSwitch (CompAction *action,
1600
CompAction::State state,
1601
CompOption::Vector &options,
1606
bool initial = false;
1608
if ((mState == ShiftStateNone) || (mState == ShiftStateIn))
1610
if (type == ShiftTypeGroup)
1613
w = screen->findWindow (CompOption::getIntOptionNamed (options,
1618
mType = ShiftTypeGroup;
1620
(w->clientLeader ()) ? w->clientLeader () : w->id ();
1621
ret = initiateScreen (action, state, options);
1627
ret = initiateScreen (action, state, options);
1630
if (state & CompAction::StateInitKey)
1631
action->setState (state | CompAction::StateTermKey);
1633
if (state & CompAction::StateInitButton)
1634
action->setState (state | CompAction::StateTermButton);
1636
if (state & CompAction::StateInitEdge)
1637
action->setState (state | CompAction::StateTermEdge);
1644
switchToWindow (nextWindow);
1645
if (initial && false)
1647
mMvTarget += mMvAdjust;
1657
ShiftScreen::initiate (CompAction *action,
1658
CompAction::State state,
1659
CompOption::Vector &options)
1663
mType = ShiftTypeNormal;
1665
if ((mState == ShiftStateNone) || (mState == ShiftStateIn) ||
1666
(mState == ShiftStateFinish))
1667
ret = initiateScreen (action, state, options);
1669
ret = terminate (action, state, options);
1671
if (state & CompAction::StateTermButton)
1672
action->setState (state & ~CompAction::StateTermButton);
1674
if (state & CompAction::StateTermKey)
1675
action->setState (state & ~CompAction::StateTermKey);
1681
ShiftScreen::initiateAll (CompAction *action,
1682
CompAction::State state,
1683
CompOption::Vector &options)
1687
mType = ShiftTypeAll;
1689
if ((mState == ShiftStateNone) || (mState == ShiftStateIn) ||
1690
(mState == ShiftStateFinish))
1691
ret = initiateScreen (action, state, options);
1693
ret = terminate (action, state, options);
1695
if (state & CompAction::StateTermButton)
1696
action->setState (state & ~CompAction::StateTermButton);
1698
if (state & CompAction::StateTermKey)
1699
action->setState (state & ~CompAction::StateTermKey);
1705
ShiftScreen::windowRemove (Window id)
1707
CompWindow *w = screen->findWindow (id);
1710
bool inList = false;
1716
if (mState == ShiftStateNone)
1719
if (sw->isShiftable ())
1722
selected = mSelectedWindow;
1724
while (i < mNWindows)
1726
if (w->id () == mWindows[i]->id ())
1730
if (w->id () == selected)
1732
if (i < (mNWindows - 1))
1733
selected = mWindows[i + 1]->id ();
1735
selected = mWindows[0]->id ();
1737
mSelectedWindow = selected;
1741
for (j = i; j < mNWindows; j++)
1742
mWindows[j] = mWindows[j + 1];
1756
CompOption::Vector opts;
1758
o = CompOption ("root", CompOption::TypeInt);
1759
o.value ().set ((int) screen->root ());
1763
terminate (NULL, 0, opts);
1767
// Let the window list be updated to avoid crash
1768
// when a window is closed while ending shift (ShiftStateIn).
1769
if (!mGrabIndex && mState != ShiftStateIn)
1772
if (updateWindowList ())
1775
mState = ShiftStateOut;
1776
cScreen->damageScreen ();
1782
ShiftScreen::handleEvent (XEvent *event)
1784
screen->handleEvent (event);
1786
switch (event->type) {
1787
case PropertyNotify:
1788
if (event->xproperty.atom == XA_WM_NAME)
1791
w = screen->findWindow (event->xproperty.window);
1794
if (mGrabIndex && (w->id () == mSelectedWindow))
1796
renderWindowTitle ();
1797
cScreen->damageScreen ();
1803
windowRemove (event->xunmap.window);
1806
windowRemove (event->xdestroywindow.window);
1809
if (mState == ShiftStateSwitching)
1811
if (event->xkey.keycode == mLeftKey)
1812
switchToWindow (false);
1813
else if (event->xkey.keycode == mRightKey)
1814
switchToWindow (true);
1815
else if (event->xkey.keycode == mUpKey)
1816
switchToWindow (false);
1817
else if (event->xkey.keycode == mDownKey)
1818
switchToWindow (true);
1823
if (mState == ShiftStateSwitching || mState == ShiftStateOut)
1825
if (event->xbutton.button == Button5)
1826
switchToWindow (false);
1827
else if (event->xbutton.button == Button4)
1828
switchToWindow (true);
1829
if (event->xbutton.button == Button1)
1831
mButtonPressTime = event->xbutton.time;
1832
mButtonPressed = true;
1833
mStartX = event->xbutton.x_root;
1834
mStartY = event->xbutton.y_root;
1835
mStartTarget = mMvTarget + mMvAdjust;
1841
if (mState == ShiftStateSwitching || mState == ShiftStateOut)
1843
if (event->xbutton.button == Button1 && mButtonPressed)
1846
if ((int)(event->xbutton.time - mButtonPressTime) <
1847
optionGetClickDuration ())
1850
mButtonPressTime = 0;
1851
mButtonPressed = false;
1853
if (mMvTarget - floor (mMvTarget) >= 0.5)
1855
mMvAdjust = ceil(mMvTarget) - mMvTarget;
1856
iNew = ceil(mMvTarget);
1860
mMvAdjust = floor(mMvTarget) - mMvTarget;
1861
iNew = floor(mMvTarget);
1866
iNew = iNew % mNWindows;
1868
mSelectedWindow = mWindows[iNew]->id ();
1870
renderWindowTitle ();
1872
cScreen->damageScreen ();
1878
if (mState == ShiftStateSwitching || mState == ShiftStateOut)
1882
CompRect oe = screen->outputDevs ()[mUsedOutput];
1888
switch (optionGetMode ())
1890
case ShiftOptions::ModeCover:
1891
div = event->xmotion.x_root - mStartX;
1892
div /= oe.width () / optionGetMouseSpeed ();
1894
case ShiftOptions::ModeFlip:
1895
div = event->xmotion.y_root - mStartY;
1896
div /= oe.height () / optionGetMouseSpeed ();
1900
mMvTarget = mStartTarget + div - mMvAdjust;
1902
while (mMvTarget >= mNWindows)
1904
mMvTarget -= mNWindows;
1908
while (mMvTarget < 0)
1910
mMvTarget += mNWindows;
1914
if (mMvTarget - floor (mMvTarget) >= 0.5)
1915
iNew = ceil(mMvTarget);
1917
iNew = floor(mMvTarget);
1921
iNew = iNew % mNWindows;
1923
if (mSelectedWindow != mWindows[iNew]->id ())
1925
mSelectedWindow = mWindows[iNew]->id ();
1926
renderWindowTitle ();
1929
if (event->xmotion.x_root < 50)
1931
if (screen->width () - event->xmotion.x_root < 50)
1933
if (event->xmotion.y_root < 50)
1935
if (screen->height () - event->xmotion.y_root < 50)
1937
if (wx != 0 || wy != 0)
1939
screen->warpPointer (wx, wy);
1944
cScreen->damageScreen ();
1953
ShiftWindow::damageRect (bool initial,
1954
const CompRect &rect)
1956
bool status = false;
1958
SHIFT_SCREEN (screen);
1962
if (ss->mGrabIndex && isShiftable ())
1964
ss->addWindowToList (window);
1965
if (ss->updateWindowList ())
1968
ss->mMoreAdjust = true;
1969
ss->mState = ShiftStateOut;
1970
ss->cScreen->damageScreen ();
1974
else if (ss->mState == ShiftStateSwitching)
1978
ss->cScreen->damageScreen ();
1983
status |= cWindow->damageRect (initial, rect);
1988
ShiftScreen::ShiftScreen (CompScreen *screen) :
1989
PluginClassHandler <ShiftScreen, CompScreen> (screen),
1990
cScreen (CompositeScreen::get (screen)),
1991
gScreen (GLScreen::get (screen)),
1992
mLeftKey (XKeysymToKeycode (screen->dpy (), XStringToKeysym ("Left"))),
1993
mRightKey (XKeysymToKeycode (screen->dpy (), XStringToKeysym ("Right"))),
1994
mUpKey (XKeysymToKeycode (screen->dpy (), XStringToKeysym ("Up"))),
1995
mDownKey (XKeysymToKeycode (screen->dpy (), XStringToKeysym ("Down"))),
1997
mState (ShiftStateNone),
1998
mMoreAdjust (false),
2002
mCursor (XCreateFontCursor (screen->dpy (), XC_left_ptr)),
2010
mSelectedWindow (0),
2011
mCurrentMatch (NULL),
2014
mAnimVelocity (0.0),
2015
mButtonPressTime (0),
2016
mButtonPressed (false),
2021
ScreenInterface::setHandler (screen, false);
2022
CompositeScreenInterface::setHandler (cScreen, false);
2023
GLScreenInterface::setHandler (gScreen, false);
2025
#define SHIFTINITBIND(opt, func) \
2026
optionSet##opt##Initiate (boost::bind (&ShiftScreen::func, \
2029
#define SHIFTTERMBIND(opt, func) \
2030
optionSet##opt##Terminate (boost::bind (&ShiftScreen::func, \
2033
#define SHIFTSWITCHBIND(opt, func, next, type) \
2034
optionSet##opt##Initiate (boost::bind (&ShiftScreen::func, \
2040
SHIFTINITBIND (InitiateKey, initiate);
2041
SHIFTINITBIND (InitiateAllKey, initiateAll);
2043
SHIFTSWITCHBIND (NextKey, doSwitch, true, ShiftTypeNormal);
2044
SHIFTSWITCHBIND (PrevKey, doSwitch, false, ShiftTypeNormal);
2045
SHIFTSWITCHBIND (NextAllKey, doSwitch, true, ShiftTypeAll);
2046
SHIFTSWITCHBIND (PrevAllKey, doSwitch, false, ShiftTypeAll);
2047
SHIFTSWITCHBIND (NextGroupKey, doSwitch, true, ShiftTypeGroup);
2048
SHIFTSWITCHBIND (PrevGroupKey, doSwitch, false, ShiftTypeGroup);
2050
SHIFTTERMBIND (NextKey, terminate);
2051
SHIFTTERMBIND (PrevKey, terminate);
2052
SHIFTTERMBIND (NextAllKey, terminate);
2053
SHIFTTERMBIND (PrevAllKey, terminate);
2054
SHIFTTERMBIND (NextGroupKey, terminate);
2055
SHIFTTERMBIND (PrevGroupKey, terminate);
2057
SHIFTTERMBIND (InitiateKey, terminate);
2058
SHIFTTERMBIND (InitiateAllKey, terminate);
2060
/* Button Actions */
2062
SHIFTINITBIND (InitiateButton, initiate);
2063
SHIFTINITBIND (InitiateAllButton, initiateAll);
2065
SHIFTSWITCHBIND (NextButton, doSwitch, true, ShiftTypeNormal);
2066
SHIFTSWITCHBIND (PrevButton, doSwitch, false, ShiftTypeNormal);
2067
SHIFTSWITCHBIND (NextAllButton, doSwitch, true, ShiftTypeAll);
2068
SHIFTSWITCHBIND (PrevAllButton, doSwitch, false, ShiftTypeAll);
2069
SHIFTSWITCHBIND (NextGroupButton, doSwitch, true, ShiftTypeGroup);
2070
SHIFTSWITCHBIND (PrevGroupButton, doSwitch, false, ShiftTypeGroup);
2072
SHIFTTERMBIND (NextButton, terminate);
2073
SHIFTTERMBIND (PrevButton, terminate);
2074
SHIFTTERMBIND (NextAllButton, terminate);
2075
SHIFTTERMBIND (PrevAllButton, terminate);
2076
SHIFTTERMBIND (NextGroupButton, terminate);
2077
SHIFTTERMBIND (PrevGroupButton, terminate);
2079
SHIFTTERMBIND (InitiateButton, terminate);
2080
SHIFTTERMBIND (InitiateAllButton, terminate);
2084
SHIFTINITBIND (InitiateEdge, initiate);
2085
SHIFTINITBIND (InitiateAllEdge, initiateAll);
2086
SHIFTTERMBIND (InitiateEdge, terminate);
2087
SHIFTTERMBIND (InitiateAllEdge, terminate);
2090
ShiftScreen::~ShiftScreen ()
2094
XFreeCursor (screen->dpy (), mCursor);
2104
ShiftWindow::ShiftWindow (CompWindow *window) :
2105
PluginClassHandler <ShiftWindow, CompWindow> (window),
2107
cWindow (CompositeWindow::get (window)),
2108
gWindow (GLWindow::get (window)),
2111
mOpacityVelocity (0.0f),
2112
mBrightnessVelocity (0.0f),
2115
CompositeWindowInterface::setHandler (cWindow, false);
2116
GLWindowInterface::setHandler (gWindow, false);
2118
mSlots[0].scale = 1.0;
2119
mSlots[1].scale = 1.0;
2122
ShiftWindow::~ShiftWindow ()
2127
ShiftPluginVTable::init ()
2129
if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION) ||
2130
!CompPlugin::checkPluginABI ("composite", COMPIZ_COMPOSITE_ABI) ||
2131
!CompPlugin::checkPluginABI ("opengl", COMPIZ_OPENGL_ABI))
2134
if (!CompPlugin::checkPluginABI ("text", COMPIZ_TEXT_ABI))
2136
compLogMessage ("shift", CompLogLevelWarn, "No compatible text plugin"\
2138
textAvailable = false;
2141
textAvailable = true;