effects/slidingpopups: Remove slide manager global with a delay
This commit is contained in:
parent
be183cd55b
commit
337261bbf7
2 changed files with 24 additions and 4 deletions
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QFontMetrics>
|
#include <QFontMetrics>
|
||||||
|
#include <QTimer>
|
||||||
#include <QWindow>
|
#include <QWindow>
|
||||||
|
|
||||||
#include <KWaylandServer/surface_interface.h>
|
#include <KWaylandServer/surface_interface.h>
|
||||||
|
@ -25,12 +26,27 @@ Q_DECLARE_METATYPE(KWindowEffects::SlideFromLocation)
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
|
||||||
|
KWaylandServer::SlideManagerInterface *SlidingPopupsEffect::s_slideManager = nullptr;
|
||||||
|
QTimer *SlidingPopupsEffect::s_slideManagerRemoveTimer = nullptr;
|
||||||
|
|
||||||
SlidingPopupsEffect::SlidingPopupsEffect()
|
SlidingPopupsEffect::SlidingPopupsEffect()
|
||||||
{
|
{
|
||||||
initConfig<SlidingPopupsConfig>();
|
initConfig<SlidingPopupsConfig>();
|
||||||
|
|
||||||
KWaylandServer::Display *display = effects->waylandDisplay();
|
KWaylandServer::Display *display = effects->waylandDisplay();
|
||||||
if (display) {
|
if (display) {
|
||||||
m_slideManager.reset(new KWaylandServer::SlideManagerInterface(display));
|
if (!s_slideManagerRemoveTimer) {
|
||||||
|
s_slideManagerRemoveTimer = new QTimer(qApp);
|
||||||
|
s_slideManagerRemoveTimer->setSingleShot(true);
|
||||||
|
s_slideManagerRemoveTimer->callOnTimeout([]() {
|
||||||
|
s_slideManager->remove();
|
||||||
|
s_slideManager = nullptr;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
s_slideManagerRemoveTimer->stop();
|
||||||
|
if (!s_slideManager) {
|
||||||
|
s_slideManager = new KWaylandServer::SlideManagerInterface(display, s_slideManagerRemoveTimer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_slideLength = QFontMetrics(qApp->font()).height() * 8;
|
m_slideLength = QFontMetrics(qApp->font()).height() * 8;
|
||||||
|
@ -62,6 +78,10 @@ SlidingPopupsEffect::SlidingPopupsEffect()
|
||||||
|
|
||||||
SlidingPopupsEffect::~SlidingPopupsEffect()
|
SlidingPopupsEffect::~SlidingPopupsEffect()
|
||||||
{
|
{
|
||||||
|
// When compositing is restarted, avoid removing the manager immediately.
|
||||||
|
if (s_slideManager) {
|
||||||
|
s_slideManagerRemoveTimer->start(1000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SlidingPopupsEffect::supported()
|
bool SlidingPopupsEffect::supported()
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
#include <kwineffects.h>
|
#include <kwineffects.h>
|
||||||
|
|
||||||
#include <KWaylandServer/slide_interface.h>
|
#include <KWaylandServer/slide_interface.h>
|
||||||
#include <KWaylandServer/utils.h>
|
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
@ -62,8 +61,9 @@ private:
|
||||||
void setupInternalWindowSlide(EffectWindow *w);
|
void setupInternalWindowSlide(EffectWindow *w);
|
||||||
void setupSlideData(EffectWindow *w);
|
void setupSlideData(EffectWindow *w);
|
||||||
|
|
||||||
KWaylandServer::ScopedGlobalPointer<KWaylandServer::SlideManagerInterface> m_slideManager;
|
static KWaylandServer::SlideManagerInterface *s_slideManager;
|
||||||
long m_atom;
|
static QTimer *s_slideManagerRemoveTimer;
|
||||||
|
long m_atom = 0;
|
||||||
|
|
||||||
int m_slideLength;
|
int m_slideLength;
|
||||||
std::chrono::milliseconds m_slideInDuration;
|
std::chrono::milliseconds m_slideInDuration;
|
||||||
|
|
Loading…
Reference in a new issue