try to enable layershell exclusivezone

work/m_layershell
Michail Vourlakos 3 years ago
parent 780e203bce
commit bdefcf11d2

@ -157,7 +157,7 @@ VisibilityManager::VisibilityManager(PlasmaQuick::ContainmentView *view)
VisibilityManager::~VisibilityManager()
{
qDebug() << "VisibilityManager deleting...";
m_wm->removeViewStruts(*m_latteView);
m_wm->removeViewStruts(m_latteView);
if (m_edgeGhostWindow) {
m_edgeGhostWindow->deleteLater();
@ -234,7 +234,7 @@ void VisibilityManager::setMode(Latte::Types::Visibility mode)
if (m_mode == Types::AlwaysVisible) {
//! remove struts for old always visible mode
m_wm->removeViewStruts(*m_latteView);
m_wm->removeViewStruts(m_latteView);
}
m_timerShow.stop();
@ -419,11 +419,11 @@ void VisibilityManager::updateStrutsBasedOnLayoutsAndActivities(bool forceUpdate
//! though they should not. In such case setting struts when the windows are hidden
//! the struts do not take any effect
m_publishedStruts = computedStruts;
m_wm->setViewStruts(*m_latteView, m_publishedStruts, m_latteView->location());
m_wm->setViewStruts(m_latteView, m_publishedStruts, m_latteView->location());
}
} else {
m_publishedStruts = QRect();
m_wm->removeViewStruts(*m_latteView);
m_wm->removeViewStruts(m_latteView);
}
}

@ -69,11 +69,10 @@ public:
virtual ~AbstractWindowInterface();
virtual void setViewExtraFlags(QObject *view,bool isPanelWindow = true, Latte::Types::Visibility mode = Latte::Types::WindowsGoBelow) = 0;
virtual void setViewStruts(QWindow &view, const QRect &rect
, Plasma::Types::Location location) = 0;
virtual void setViewStruts(QWindow *view, const QRect &rect, Plasma::Types::Location location) = 0;
virtual void setWindowOnActivities(const WindowId &wid, const QStringList &activities) = 0;
virtual void removeViewStruts(QWindow &view) = 0;
virtual void removeViewStruts(QWindow *view) = 0;
virtual WindowId activeWindow() = 0;
virtual WindowInfoWrap requestInfo(WindowId wid) = 0;

@ -40,83 +40,6 @@ using namespace KWayland::Client;
namespace Latte {
class Private::GhostWindow : public QQuickView
{
Q_OBJECT
public:
WindowSystem::WindowId m_winId;
GhostWindow(WindowSystem::WaylandInterface *waylandInterface)
: m_waylandInterface(waylandInterface) {
setFlags(Qt::FramelessWindowHint
| Qt::WindowStaysOnTopHint
| Qt::NoDropShadowWindowHint
| Qt::WindowDoesNotAcceptFocus);
setColor(QColor(Qt::transparent));
setClearBeforeRendering(true);
connect(m_waylandInterface, &WindowSystem::AbstractWindowInterface::latteWindowAdded, this, &GhostWindow::identifyWinId);
setupWaylandIntegration();
show();
}
~GhostWindow() {
m_waylandInterface->unregisterIgnoredWindow(m_winId);
// delete m_shellSurface;
}
void setGeometry(const QRect &rect) {
if (geometry() == rect) {
return;
}
m_validGeometry = rect;
setMinimumSize(rect.size());
setMaximumSize(rect.size());
resize(rect.size());
// m_shellSurface->setPosition(rect.topLeft());
}
void setupWaylandIntegration() {
/* using namespace KWayland::Client;
if (m_shellSurface)
return;
Surface *s{Surface::fromWindow(this)};
if (!s)
return;
m_shellSurface = m_waylandInterface->waylandCoronaInterface()->createSurface(s, this);
qDebug() << "wayland ghost window surface was created...";
m_shellSurface->setSkipTaskbar(true);
m_shellSurface->setPanelTakesFocus(false);
m_shellSurface->setRole(PlasmaShellSurface::Role::Panel);
m_shellSurface->setPanelBehavior(PlasmaShellSurface::PanelBehavior::AlwaysVisible);*/
}
// KWayland::Client::PlasmaShellSurface *m_shellSurface{nullptr};
WindowSystem::WaylandInterface *m_waylandInterface{nullptr};
//! geometry() function under wayland does not return nice results
QRect m_validGeometry;
public slots:
void identifyWinId() {
if (m_winId.isNull()) {
m_winId = m_waylandInterface->winIdFor("latte-dock", m_validGeometry);
m_waylandInterface->registerIgnoredWindow(m_winId);
}
}
};
namespace WindowSystem {
WaylandInterface::WaylandInterface(QObject *parent)
@ -293,28 +216,20 @@ void WaylandInterface::setViewExtraFlags(QObject *view, bool isPanelWindow, Latt
}*/
}
void WaylandInterface::setViewStruts(QWindow &view, const QRect &rect, Plasma::Types::Location location)
void WaylandInterface::setViewStruts(QWindow *view, const QRect &rect, Plasma::Types::Location location)
{
/* if (!m_ghostWindows.contains(view.winId())) {
m_ghostWindows[view.winId()] = new Private::GhostWindow(this);
if (!view) {
return;
}
auto w = m_ghostWindows[view.winId()];
switch (location) {
case Plasma::Types::TopEdge:
case Plasma::Types::BottomEdge:
w->setGeometry({rect.x() + rect.width() / 2, rect.y(), 1, rect.height()});
break;
case Plasma::Types::LeftEdge:
case Plasma::Types::RightEdge:
w->setGeometry({rect.x(), rect.y() + rect.height() / 2, rect.width(), 1});
break;
auto layerWindow = LayerShellQt::Window::get(view);
default:
break;
}*/
if (location == Plasma::Types::LeftEdge
|| location == Plasma::Types::RightEdge) {
layerWindow->setExclusiveZone(rect.width());
} else {
layerWindow->setExclusiveZone(rect.height());
}
}
void WaylandInterface::switchToNextVirtualDesktop()
@ -415,9 +330,15 @@ void WaylandInterface::setWindowOnActivities(const WindowId &wid, const QStringL
#endif
}
void WaylandInterface::removeViewStruts(QWindow &view)
void WaylandInterface::removeViewStruts(QWindow *view)
{
delete m_ghostWindows.take(view.winId());
if (!view) {
return;
}
auto layerWindow = LayerShellQt::Window::get(view);
layerWindow->setExclusiveZone(0);
}
WindowId WaylandInterface::activeWindow()
@ -471,11 +392,11 @@ void WaylandInterface::enableBlurBehind(QWindow &view)
void WaylandInterface::setActiveEdge(QWindow *view, bool active)
{
ViewPart::ScreenEdgeGhostWindow *window = qobject_cast<ViewPart::ScreenEdgeGhostWindow *>(view);
//ViewPart::ScreenEdgeGhostWindow *window = qobject_cast<ViewPart::ScreenEdgeGhostWindow *>(view);
if (!window) {
return;
}
//if (!window) {
// return;
//}
/*if (window->parentView()->surface() && window->parentView()->visibility()
&& (window->parentView()->visibility()->mode() == Types::DodgeActive
@ -508,7 +429,8 @@ void WaylandInterface::setWindowPosition(QWindow *window, const Plasma::Types::L
margins.setTop(geometry.top() - window->screen()->geometry().top());
margins.setLeft(geometry.left() - window->screen()->geometry().left());
/*if (location == Plasma::Types::TopEdge || location == Plasma::Types::LeftEdge) {
/*
if (location == Plasma::Types::TopEdge || location == Plasma::Types::LeftEdge) {
anchors = LayerShellQt::Window::AnchorTop;
anchors = anchors | LayerShellQt::Window::AnchorLeft;
margins.setTop(geometry.top() - window->screen()->geometry().top());

@ -25,14 +25,6 @@
#include <KWayland/Client/plasmavirtualdesktop.h>
#endif
namespace Latte {
class Corona;
namespace Private {
//! this class is used to create the struts inside wayland
class GhostWindow;
}
}
namespace Latte {
namespace WindowSystem {
@ -45,11 +37,10 @@ public:
~WaylandInterface() override;
void setViewExtraFlags(QObject *view, bool isPanelWindow = true, Latte::Types::Visibility mode = Latte::Types::WindowsGoBelow) override;
void setViewStruts(QWindow &view, const QRect &rect
, Plasma::Types::Location location) override;
void setViewStruts(QWindow *view, const QRect &rect, Plasma::Types::Location location) override;
void setWindowOnActivities(const WindowId &wid, const QStringList &nextactivities) override;
void removeViewStruts(QWindow &view) override;
void removeViewStruts(QWindow *view) override;
WindowId activeWindow() override;
WindowInfoWrap requestInfo(WindowId wid) override;
@ -121,9 +112,6 @@ private:
#endif
private:
friend class Private::GhostWindow;
mutable QMap<WindowId, Private::GhostWindow *> m_ghostWindows;
KWayland::Client::PlasmaWindowManagement *m_windowManagement{nullptr};
#if KF5_VERSION_MINOR >= 52

@ -112,12 +112,15 @@ void XWindowInterface::setViewExtraFlags(QObject *view,bool isPanelWindow, Latte
}
}
void XWindowInterface::setViewStruts(QWindow &view, const QRect &rect
, Plasma::Types::Location location)
void XWindowInterface::setViewStruts(QWindow *view, const QRect &rect, Plasma::Types::Location location)
{
if (!view) {
return;
}
NETExtendedStrut strut;
const auto screen = view.screen();
const auto screen = view->screen();
const QRect currentScreen {screen->geometry()};
const QRect wholeScreen {{0, 0}, screen->virtualSize()};
@ -160,7 +163,7 @@ void XWindowInterface::setViewStruts(QWindow &view, const QRect &rect
return;
}
KWindowSystem::setExtendedStrut(view.winId(),
KWindowSystem::setExtendedStrut(view->winId(),
strut.left_width, strut.left_start, strut.left_end,
strut.right_width, strut.right_start, strut.right_end,
strut.top_width, strut.top_start, strut.top_end,
@ -216,9 +219,13 @@ void XWindowInterface::setWindowOnActivities(const WindowId &wid, const QStringL
KWindowSystem::setOnActivities(wid.toUInt(), activities);
}
void XWindowInterface::removeViewStruts(QWindow &view)
void XWindowInterface::removeViewStruts(QWindow *view)
{
KWindowSystem::setStrut(view.winId(), 0, 0, 0, 0);
if (!view) {
return;
}
KWindowSystem::setStrut(view->winId(), 0, 0, 0, 0);
}
WindowId XWindowInterface::activeWindow()

@ -32,10 +32,10 @@ public:
~XWindowInterface() override;
void setViewExtraFlags(QObject *view, bool isPanelWindow = true, Latte::Types::Visibility mode = Latte::Types::WindowsGoBelow) override;
void setViewStruts(QWindow &view, const QRect &rect, Plasma::Types::Location location) override;
void setViewStruts(QWindow *view, const QRect &rect, Plasma::Types::Location location) override;
void setWindowOnActivities(const WindowId &wid, const QStringList &activities) override;
void removeViewStruts(QWindow &view) override;
void removeViewStruts(QWindow *view) override;
WindowId activeWindow() override;
WindowInfoWrap requestInfo(WindowId wid) override;

Loading…
Cancel
Save