x11:improve experience for Windows Always Cover

--simplify also some parts from windows calling window
manager values
pull/11/head
Michail Vourlakos 5 years ago
parent d9e18794c8
commit c88329d278

@ -91,13 +91,7 @@ PrimaryConfigView::PrimaryConfigView(Plasma::Containment *containment, Latte::Vi
setFlags(wFlags());
if (KWindowSystem::isPlatformX11()) {
#if KF5_VERSION_MINOR >= 45
KWindowSystem::setState(winId(), NET::SkipTaskbar | NET::SkipPager | NET::SkipSwitcher);
#else
KWindowSystem::setState(winId(), NET::SkipTaskbar | NET::SkipPager);
#endif
KWindowSystem::setOnAllDesktops(winId(), true);
m_corona->wm()->setViewExtraFlags(this, false, Latte::Types::NormalWindow);
}
syncGeometry();
@ -185,7 +179,7 @@ void PrimaryConfigView::init()
inline Qt::WindowFlags PrimaryConfigView::wFlags() const
{
return (flags() | Qt::FramelessWindowHint /*| Qt::WindowStaysOnTopHint*/) & ~Qt::WindowDoesNotAcceptFocus;
return (flags() | Qt::FramelessWindowHint) & ~Qt::WindowDoesNotAcceptFocus;
}
QQuickView *PrimaryConfigView::secondaryWindow()
@ -366,8 +360,8 @@ void PrimaryConfigView::showEvent(QShowEvent *ev)
return;
}
m_corona->wm()->setViewExtraFlags(this);
setFlags(wFlags());
m_corona->wm()->setViewExtraFlags(this, false, Latte::Types::NormalWindow);
m_corona->wm()->enableBlurBehind(*this);

@ -83,13 +83,7 @@ SecondaryConfigView::SecondaryConfigView(Latte::View *view, QWindow *parent)
setFlags(wFlags());
if (KWindowSystem::isPlatformX11()) {
#if KF5_VERSION_MINOR >= 45
KWindowSystem::setState(winId(), NET::SkipTaskbar | NET::SkipPager | NET::SkipSwitcher);
#else
KWindowSystem::setState(winId(), NET::SkipTaskbar | NET::SkipPager);
#endif
KWindowSystem::setOnAllDesktops(winId(), true);
m_corona->wm()->setViewExtraFlags(this, false, Latte::Types::NormalWindow);
}
syncGeometry();
@ -295,8 +289,8 @@ void SecondaryConfigView::showEvent(QShowEvent *ev)
return;
}
m_corona->wm()->setViewExtraFlags(this);
setFlags(wFlags());
m_corona->wm()->setViewExtraFlags(this, false, Latte::Types::NormalWindow);
m_corona->wm()->enableBlurBehind(*this);

@ -82,7 +82,6 @@ View::View(Plasma::Corona *corona, QScreen *targetScreen, bool byPassWM)
setClearBeforeRendering(true);
const auto flags = Qt::FramelessWindowHint
| Qt::WindowStaysOnTopHint
| Qt::NoDropShadowWindowHint
| Qt::WindowDoesNotAcceptFocus;
@ -1235,7 +1234,9 @@ bool View::event(QEvent *e)
break;
case QEvent::Show:
m_corona->wm()->setViewExtraFlags(this);
if (m_visibility) {
m_visibility->initViewFlags();
}
break;
default:

@ -72,6 +72,8 @@ VisibilityManager::VisibilityManager(PlasmaQuick::ContainmentView *view)
updateStrutsBasedOnLayoutsAndActivities();
}
});
connect(m_latteView, &Latte::View::inEditModeChanged, this, &VisibilityManager::initViewFlags);
}
if (m_corona) {
@ -116,6 +118,15 @@ Types::Visibility VisibilityManager::mode() const
return m_mode;
}
void VisibilityManager::initViewFlags()
{
if ((m_mode == Types::WindowsCanCover || m_mode == Types::WindowsAlwaysCover) && (!m_latteView->inEditMode())) {
m_wm->setViewExtraFlags(m_latteView, false, m_mode);
} else {
m_wm->setViewExtraFlags(m_latteView, true);
}
}
void VisibilityManager::setMode(Latte::Types::Visibility mode)
{
if (m_mode == mode)
@ -141,11 +152,7 @@ void VisibilityManager::setMode(Latte::Types::Visibility mode)
m_timerHide.stop();
m_mode = mode;
if (m_mode == Types::WindowsCanCover || m_mode == Types::WindowsAlwaysCover) {
m_wm->setViewExtraFlags(m_latteView, false, mode);
} else {
m_wm->setViewExtraFlags(m_latteView, true, mode);
}
initViewFlags();
if (mode != Types::AlwaysVisible && mode != Types::WindowsGoBelow) {
m_connections[0] = connect(m_wm, &WindowSystem::AbstractWindowInterface::currentDesktopChanged, this, [&] {

@ -105,6 +105,8 @@ public slots:
Q_INVOKABLE void hide();
Q_INVOKABLE void show();
void initViewFlags();
signals:
void mustBeShown();
void mustBeHide();

@ -110,11 +110,20 @@ void XWindowInterface::setViewExtraFlags(QObject *view,bool isPanelWindow, Latte
KWindowSystem::setType(winId, NET::Normal);
}
#if KF5_VERSION_MINOR >= 45
KWindowSystem::setState(winId, NET::SkipTaskbar | NET::SkipPager | NET::SkipSwitcher);
#else
KWindowSystem::setState(winId, NET::SkipTaskbar | NET::SkipPager);
#endif
KWindowSystem::setOnAllDesktops(winId, true);
//! Layer to be applied
if (mode == Latte::Types::WindowsCanCover || mode == Latte::Types::WindowsAlwaysCover) {
setKeepBelow(winId, true);
} else if (mode == Latte::Types::NormalWindow) {
setKeepBelow(winId, false);
setKeepAbove(winId, false);
} else {
setKeepAbove(winId, true);
}

@ -53,7 +53,8 @@ public:
DodgeAllWindows,
WindowsGoBelow,
WindowsCanCover,
WindowsAlwaysCover
WindowsAlwaysCover,
NormalWindow = 20
};
Q_ENUM(Visibility);

@ -481,7 +481,9 @@ PlasmaComponents.Page {
spacing: units.smallSpacing
enabled: !(latteView.visibility.mode === Latte.Types.AlwaysVisible
|| latteView.visibility.mode === Latte.Types.WindowsGoBelow)
|| latteView.visibility.mode === Latte.Types.WindowsGoBelow
|| latteView.visibility.mode === Latte.Types.WindowsCanCover
|| latteView.visibility.mode === Latte.Types.WindowsAlwaysCover)
LatteComponents.Header {
text: i18n("Delay")
@ -755,7 +757,10 @@ PlasmaComponents.Page {
spacing: units.smallSpacing
visible: dialog.expertLevel
enabled: latteView.visibility.mode !== Latte.Types.AlwaysVisible && latteView.visibility.mode !== Latte.Types.WindowsGoBelow
enabled: !(latteView.visibility.mode === Latte.Types.AlwaysVisible
|| latteView.visibility.mode === Latte.Types.WindowsGoBelow
|| latteView.visibility.mode === Latte.Types.WindowsCanCover
|| latteView.visibility.mode === Latte.Types.WindowsAlwaysCover)
LatteComponents.Header {
text: i18n("Environment")

Loading…
Cancel
Save