Changeset View
Changeset View
Standalone View
Standalone View
shadow.cpp
Show First 20 Lines • Show All 325 Lines • ▼ Show 20 Line(s) | 253 | { | |||
---|---|---|---|---|---|
326 | leftQuad[ 1 ] = WindowVertex(outerRect.x() + left.width(), outerRect.y() + topLeft.height(), 1.0, 0.0); | 326 | leftQuad[ 1 ] = WindowVertex(outerRect.x() + left.width(), outerRect.y() + topLeft.height(), 1.0, 0.0); | ||
327 | leftQuad[ 2 ] = WindowVertex(outerRect.x() + left.width(), outerRect.bottom() - bottomLeft.height(), 1.0, 1.0); | 327 | leftQuad[ 2 ] = WindowVertex(outerRect.x() + left.width(), outerRect.bottom() - bottomLeft.height(), 1.0, 1.0); | ||
328 | leftQuad[ 3 ] = WindowVertex(outerRect.x(), outerRect.bottom() - bottomLeft.height(), 0.0, 1.0); | 328 | leftQuad[ 3 ] = WindowVertex(outerRect.x(), outerRect.bottom() - bottomLeft.height(), 0.0, 1.0); | ||
329 | m_shadowQuads.append(leftQuad); | 329 | m_shadowQuads.append(leftQuad); | ||
330 | } | 330 | } | ||
331 | 331 | | |||
332 | bool Shadow::updateShadow() | 332 | bool Shadow::updateShadow() | ||
333 | { | 333 | { | ||
334 | auto clear = [topLevel = m_topLevel] { | | |||
335 | if (topLevel && topLevel->shadow()) { | | |||
336 | auto w = topLevel->effectWindow(); | | |||
337 | // this also deletes the shadow | | |||
338 | w->sceneWindow()->updateShadow(nullptr); | | |||
339 | emit topLevel->shadowChanged(); | | |||
340 | } | | |||
341 | }; | | |||
342 | | ||||
343 | if (!m_topLevel) { | 334 | if (!m_topLevel) { | ||
344 | return false; | 335 | return false; | ||
345 | } | 336 | } | ||
346 | 337 | | |||
347 | if (m_decorationShadow) { | 338 | if (m_decorationShadow) { | ||
348 | if (AbstractClient *c = qobject_cast<AbstractClient*>(m_topLevel)) { | 339 | if (AbstractClient *c = qobject_cast<AbstractClient*>(m_topLevel)) { | ||
349 | if (c->decoration()) { | 340 | if (c->decoration()) { | ||
350 | if (init(c->decoration())) { | 341 | if (init(c->decoration())) { | ||
351 | emit m_topLevel->shadowChanged(); | | |||
352 | return true; | 342 | return true; | ||
353 | } | 343 | } | ||
354 | } | 344 | } | ||
355 | } | 345 | } | ||
356 | clear(); | | |||
357 | return false; | 346 | return false; | ||
358 | } | 347 | } | ||
359 | 348 | | |||
360 | if (waylandServer()) { | 349 | if (waylandServer()) { | ||
361 | if (m_topLevel && m_topLevel->surface()) { | 350 | if (m_topLevel && m_topLevel->surface()) { | ||
362 | if (const auto &s = m_topLevel->surface()->shadow()) { | 351 | if (const auto &s = m_topLevel->surface()->shadow()) { | ||
363 | if (init(s)) { | 352 | if (init(s)) { | ||
364 | emit m_topLevel->shadowChanged(); | | |||
365 | return true; | 353 | return true; | ||
366 | } | 354 | } | ||
367 | } | 355 | } | ||
368 | } | 356 | } | ||
369 | } | 357 | } | ||
370 | 358 | | |||
371 | auto data = Shadow::readX11ShadowProperty(m_topLevel->window()); | 359 | auto data = Shadow::readX11ShadowProperty(m_topLevel->window()); | ||
372 | if (data.isEmpty()) { | 360 | if (data.isEmpty()) { | ||
373 | clear(); | | |||
374 | return false; | 361 | return false; | ||
375 | } | 362 | } | ||
376 | 363 | | |||
377 | init(data); | 364 | init(data); | ||
378 | emit m_topLevel->shadowChanged(); | | |||
379 | 365 | | |||
380 | return true; | 366 | return true; | ||
381 | } | 367 | } | ||
382 | 368 | | |||
383 | void Shadow::setToplevel(Toplevel *topLevel) | 369 | void Shadow::setToplevel(Toplevel *topLevel) | ||
384 | { | 370 | { | ||
385 | m_topLevel = topLevel; | 371 | m_topLevel = topLevel; | ||
386 | connect(m_topLevel, SIGNAL(geometryChanged()), SLOT(geometryChanged())); | 372 | connect(m_topLevel, SIGNAL(geometryChanged()), SLOT(geometryChanged())); | ||
▲ Show 20 Lines • Show All 53 Lines • Show Last 20 Lines |