43
43
COMPIZ_PLUGIN_20090315 (decor, DecorPluginVTable)
45
MatchedDecorClipGroup::MatchedDecorClipGroup (const CompMatch &match) :
51
MatchedDecorClipGroup::doPushClippable (DecorClippableInterface *dc)
53
if (dc->matches (mMatch))
54
return mClipGroupImpl.pushClippable (dc);
60
DecorWindow::doUpdateShadow (const CompRegion ®)
62
shadowRegion = outputRegion () - (reg - inputRegion ());
66
DecorWindow::doSetOwner (DecorClipGroupInterface *i)
72
DecorWindow::doMatches (const CompMatch &m)
74
return const_cast <CompMatch &> (m).evaluate (window) && !window->invisible ();
78
DecorWindow::getOutputRegion ()
84
DecorWindow::getInputRegion ()
90
DecorWindow::doUpdateGroupShadows ()
93
mClipGroup->updateAllShadows ();
73
* DecorWindow::computeShadowRegion
75
* This function computes the current clip region for the
76
* shadow that should be draw on glDraw.
78
* Make shadows look nice, don't paint shadows on top of
79
* things they don't make sense on top of, eg, menus
80
* need shadows but they don't need to be painted when
81
* another menu is adjacent and covering the shadow
82
* region. Also panel shadows are nice, but not
83
* when they obscure client window shadows
85
* We need to use the current clip region here
86
* and take an intersection of that to ensure
87
* that we don't unintentionally expand the clip
88
* region that core already reduced by doing
92
DecorWindow::computeShadowRegion ()
94
shadowRegion = CompRegion (window->outputRect ());
96
if (window->type () == CompWindowTypeDropdownMenuMask ||
97
window->type () == CompWindowTypePopupMenuMask)
99
/* Other transient menus should clip
100
* this menu's shadows, also the panel
101
* which is a transient parent should
104
CompWindowList::iterator it = std::find (screen->windows ().begin (),
105
screen->windows ().end (),
108
for (it--; it != screen->windows ().end (); it--)
110
if (!(*it)->isViewable ())
113
if (!((*it)->type () == CompWindowTypeDropdownMenuMask ||
114
(*it)->type () == CompWindowTypePopupMenuMask ||
115
(*it)->type () == CompWindowTypeDockMask))
118
/* window needs to be a transient parent */
119
if (!isAncestorTo (window, (*it)))
122
CompRegion inter (shadowRegion);
123
inter &= (*it)->borderRect ();
125
if (!inter.isEmpty ())
126
shadowRegion -= inter;
129
/* If the region didn't change, then it is safe to
130
* say that that this window was probably the first
131
* menu in the "chain" of dropdown menus that comes
132
* from a menu-bar - in that case there isn't any
133
* window that the shadow would necessarily occlude
134
* here so clip the shadow to the top of the input
137
* FIXME: We need a better way to detect exactly
138
* where the menubar is for the dropdown menu,
139
* that will look a lot better.
141
if (window->type () == CompWindowTypeDropdownMenuMask &&
142
shadowRegion == CompRegionRef (window->outputRect ().region ()))
144
CompRect area (window->outputRect ().x1 (),
145
window->outputRect ().y1 (),
146
window->outputRect ().width (),
147
window->inputRect ().y1 () -
148
window->outputRect ().y1 ());
150
shadowRegion -= area;
156
124
* DecorWindow::glDraw
2169
/* For non-switcher windows we need to update the decoration
2170
* anyways, since the window is unmapped. Also need to
2171
* update the shadow clip regions for panels and other windows */
2173
if (dScreen->mMenusClipGroup.pushClippable (this))
2174
updateGroupShadows ();
2199
2178
case CompWindowNotifyUnmap:
2201
2181
/* When the switcher is unmapped, it has no frame window
2202
2182
* so the frame window for it needs to unmapped manually */
2211
2191
* anyways, since the window is unmapped. Also need to
2212
2192
* update the shadow clip regions for panels and other windows */
2214
if (dScreen->cmActive)
2216
foreach (CompWindow *cw, DecorScreen::get (screen)->cScreen->getWindowPaintList ())
2218
DecorWindow::get (cw)->computeShadowRegion ();
2195
/* Preserve the group shadow update ptr */
2196
DecorClipGroupInterface *clipGroup = mClipGroup;
2198
if (dScreen->mMenusClipGroup.popClippable (this))
2200
clipGroup->updateAllShadows ();
2222
2203
case CompWindowNotifyUnreparent:
2224
2205
/* Compiz detaches the frame window from
2750
2719
updateReg = true;
2752
if (dScreen->cmActive)
2754
foreach (CompWindow *cw,
2755
DecorScreen::get (screen)->cScreen->getWindowPaintList ())
2757
DecorWindow::get (cw)->computeShadowRegion ();
2721
mInputRegion.translate (dx, dy);
2722
mOutputRegion.translate (dx, dy);
2724
if (dScreen->cmActive && mClipGroup)
2725
updateGroupShadows ();
2761
2727
window->moveNotify (dx, dy, immediate);
2809
2775
updateDecorationScale ();
2810
2776
updateReg = true;
2812
if (dScreen->cmActive)
2814
foreach (CompWindow *cw,
2815
DecorScreen::get (screen)->cScreen->getWindowPaintList ())
2817
DecorWindow::get (cw)->computeShadowRegion ();
2778
mInputRegion = CompRegion (window->inputRect ());
2779
mOutputRegion = CompRegion (window->outputRect ());
2780
if (dScreen->cmActive && mClipGroup)
2781
updateGroupShadows ();
2821
2783
window->resizeNotify (dx, dy, dwidth, dheight);