fix configuration window positioning and issues

--draw the wayland surfaces for docks and config
views earlier. That way we are certain that the
signals wont mess up the experience. This way
positioning config views and getting the focusOut
event works correctly
--disable in waylandinterface any x specific code.
In order to be ready that class to accept only
wayland centered code
pull/1/head
Michail Vourlakos 8 years ago
parent 575ff06a66
commit eb2387c581

@ -45,6 +45,8 @@ DockConfigView::DockConfigView(Plasma::Containment *containment, DockView *dockV
m_blockFocusLost(false),
m_dockView(dockView)
{
setupWaylandIntegration();
setScreen(m_dockView->screen());
if (containment) {
@ -83,6 +85,12 @@ DockConfigView::~DockConfigView()
foreach (auto var, connections) {
QObject::disconnect(var);
}
if (m_shellSurface) {
delete m_shellSurface;
m_shellSurface = nullptr;
}
}
void DockConfigView::init()
@ -274,14 +282,11 @@ void DockConfigView::focusOutEvent(QFocusEvent *ev)
}
}
bool DockConfigView::event(QEvent *e)
void DockConfigView::setupWaylandIntegration()
{
if (e->type() == QEvent::PlatformSurface) {
if (auto pe = dynamic_cast<QPlatformSurfaceEvent *>(e)) {
switch (pe->surfaceEventType()) {
case QPlatformSurfaceEvent::SurfaceCreated:
if (m_shellSurface) {
break;
// already setup
return;
}
if (DockCorona *c = qobject_cast<DockCorona *>(m_dockView->containment()->corona())) {
@ -289,23 +294,41 @@ bool DockConfigView::event(QEvent *e)
PlasmaShell *interface = c->waylandDockCoronaInterface();
if (!interface) {
break;
return;
}
Surface *s = Surface::fromWindow(this);
if (!s) {
break;
return;
}
qDebug() << "wayland dock window surface was created...";
m_shellSurface = interface->createSurface(s, this);
}
}
bool DockConfigView::event(QEvent *e)
{
if (e->type() == QEvent::PlatformSurface) {
if (auto pe = dynamic_cast<QPlatformSurfaceEvent *>(e)) {
switch (pe->surfaceEventType()) {
case QPlatformSurfaceEvent::SurfaceCreated:
if (m_shellSurface) {
break;
}
setupWaylandIntegration();
break;
case QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed:
if (m_shellSurface) {
delete m_shellSurface;
m_shellSurface = nullptr;
}
PanelShadows::self()->removeWindow(this);
break;
}

@ -82,6 +82,8 @@ signals:
void aboutApplication();
private:
void setupWaylandIntegration();
bool m_blockFocusLost;
QPointer<DockView> m_dockView;

@ -58,6 +58,8 @@ DockView::DockView(Plasma::Corona *corona, QScreen *targetScreen, bool dockWindo
: PlasmaQuick::ContainmentView(corona),
m_contextMenu(nullptr)
{
setupWaylandIntegration();
setVisible(false);
setTitle(corona->kPackage().metadata().name());
setIcon(qGuiApp->windowIcon());
@ -147,6 +149,11 @@ DockView::~DockView()
if (m_visibility)
delete m_visibility;
if (m_shellSurface) {
delete m_shellSurface;
m_shellSurface = nullptr;
}
}
void DockView::init()
@ -1164,6 +1171,8 @@ bool DockView::event(QEvent *e)
KWayland::Client::PlasmaShellSurface::PanelBehavior behavior;
behavior = KWayland::Client::PlasmaShellSurface::PanelBehavior::WindowsGoBelow;
qDebug() << "wayland dock window surface was created...";
m_shellSurface->setRole(KWayland::Client::PlasmaShellSurface::Role::Panel);
m_shellSurface->setSkipTaskbar(true);
m_shellSurface->setPanelBehavior(behavior);
@ -1179,6 +1188,7 @@ bool DockView::event(QEvent *e)
case QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed:
delete m_shellSurface;
qDebug() << "wayland dock window surface was deleted...";
m_shellSurface = nullptr;
PanelShadows::self()->removeWindow(this);
break;

@ -64,9 +64,9 @@ WaylandInterface::WaylandInterface(QObject *parent)
, this, &WaylandInterface::currentActivityChanged);
// fill windows list
foreach (const auto &wid, KWindowSystem::self()->windows()) {
/* foreach (const auto &wid, KWindowSystem::self()->windows()) {
addWindow(wid);
}
}*/
}
WaylandInterface::~WaylandInterface()
@ -75,8 +75,8 @@ WaylandInterface::~WaylandInterface()
void WaylandInterface::setDockExtraFlags(QQuickWindow &view)
{
KWindowSystem::setType(view.winId(), NET::Dock);
KWindowSystem::setState(view.winId(), NET::SkipTaskbar | NET::SkipPager);
// KWindowSystem::setType(view.winId(), NET::Dock);
// KWindowSystem::setState(view.winId(), NET::SkipTaskbar | NET::SkipPager);
KWindowSystem::setOnAllDesktops(view.winId(), true);
KWindowSystem::setOnActivities(view.winId(), {"0"});
}
@ -201,14 +201,14 @@ bool WaylandInterface::isOnCurrentDesktop(WId wid) const
WindowInfoWrap WaylandInterface::requestInfo(WId wid) const
{
const KWindowInfo winfo{wid, NET::WMFrameExtents
/* const KWindowInfo winfo{wid, NET::WMFrameExtents
| NET::WMWindowType
| NET::WMGeometry
| NET::WMState};
| NET::WMState};*/
WindowInfoWrap winfoWrap;
if (isValidWindow(winfo)) {
/* if (isValidWindow(winfo)) {
winfoWrap.setIsValid(true);
winfoWrap.setWid(wid);
winfoWrap.setIsActive(KWindowSystem::activeWindow() == wid);
@ -222,7 +222,7 @@ WindowInfoWrap WaylandInterface::requestInfo(WId wid) const
winfoWrap.setIsValid(true);
winfoWrap.setIsPlasmaDesktop(true);
winfoWrap.setWid(wid);
}
}*/
return winfoWrap;
}
@ -230,7 +230,7 @@ WindowInfoWrap WaylandInterface::requestInfo(WId wid) const
bool WaylandInterface::isValidWindow(const KWindowInfo &winfo) const
{
constexpr auto types = NET::DockMask | NET::MenuMask | NET::SplashMask | NET::NormalMask;
/* constexpr auto types = NET::DockMask | NET::MenuMask | NET::SplashMask | NET::NormalMask;
auto winType = winfo.windowType(types);
if (winType == -1) {
@ -242,15 +242,16 @@ bool WaylandInterface::isValidWindow(const KWindowInfo &winfo) const
<< "doesn't have any WindowType, assuming as NET::Normal";
return true;
}
}
}*/
return true;
return !((winType & NET::Menu) || (winType & NET::Dock) || (winType & NET::Splash));
//return !((winType & NET::Menu) || (winType & NET::Dock) || (winType & NET::Splash));
}
void WaylandInterface::windowChangedProxy(WId wid, NET::Properties prop1, NET::Properties2 prop2)
{
//! if the dock changed is ignored
if (std::find(m_docks.cbegin(), m_docks.cend(), wid) != m_docks.cend())
/* if (std::find(m_docks.cbegin(), m_docks.cend(), wid) != m_docks.cend())
return;
const auto winType = KWindowInfo(wid, NET::WMWindowType).windowType(NET::DesktopMask);
@ -269,7 +270,7 @@ void WaylandInterface::windowChangedProxy(WId wid, NET::Properties prop1, NET::P
if (prop1 && !(prop1 & NET::WMState || prop1 & NET::WMGeometry || prop1 & NET::ActiveWindow))
return;
emit windowChanged(wid);
emit windowChanged(wid);*/
}
}

Loading…
Cancel
Save