effects/overview: Make the window heap cover the maximize area
Currently, window thumbnails may be placed behind the panel, which doesn't look good. With this, the window heap will cover the same area as the maximize area.
This commit is contained in:
parent
bc17d0aebd
commit
fc52531f44
5 changed files with 145 additions and 1 deletions
|
@ -86,6 +86,7 @@ set(kwin4_effect_builtins_sources
|
|||
magnifier/magnifier.cpp
|
||||
mouseclick/mouseclick.cpp
|
||||
mousemark/mousemark.cpp
|
||||
overview/expoarea.cpp
|
||||
overview/expolayout.cpp
|
||||
overview/overvieweffect.cpp
|
||||
presentwindows/presentwindows.cpp
|
||||
|
|
84
src/effects/overview/expoarea.cpp
Normal file
84
src/effects/overview/expoarea.cpp
Normal file
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "expoarea.h"
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
ExpoArea::ExpoArea(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
int ExpoArea::x() const
|
||||
{
|
||||
return m_rect.x();
|
||||
}
|
||||
|
||||
int ExpoArea::y() const
|
||||
{
|
||||
return m_rect.y();
|
||||
}
|
||||
|
||||
int ExpoArea::width() const
|
||||
{
|
||||
return m_rect.width();
|
||||
}
|
||||
|
||||
int ExpoArea::height() const
|
||||
{
|
||||
return m_rect.height();
|
||||
}
|
||||
|
||||
EffectScreen *ExpoArea::screen() const
|
||||
{
|
||||
return m_screen;
|
||||
}
|
||||
|
||||
void ExpoArea::setScreen(EffectScreen *screen)
|
||||
{
|
||||
if (m_screen != screen) {
|
||||
if (m_screen) {
|
||||
disconnect(m_screen, &EffectScreen::geometryChanged, this, &ExpoArea::update);
|
||||
}
|
||||
m_screen = screen;
|
||||
if (m_screen) {
|
||||
connect(m_screen, &EffectScreen::geometryChanged, this, &ExpoArea::update);
|
||||
}
|
||||
update();
|
||||
Q_EMIT screenChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void ExpoArea::update()
|
||||
{
|
||||
if (!m_screen) {
|
||||
return;
|
||||
}
|
||||
const QRect oldRect = m_rect;
|
||||
|
||||
const int screen = effects->screens().indexOf(m_screen);
|
||||
m_rect = effects->clientArea(MaximizeArea, screen, effects->currentDesktop());
|
||||
|
||||
// Map the area to the output local coordinates.
|
||||
m_rect.translate(-m_screen->geometry().topLeft());
|
||||
|
||||
if (oldRect.x() != m_rect.x()) {
|
||||
Q_EMIT xChanged();
|
||||
}
|
||||
if (oldRect.y() != m_rect.y()) {
|
||||
Q_EMIT yChanged();
|
||||
}
|
||||
if (oldRect.width() != m_rect.width()) {
|
||||
Q_EMIT widthChanged();
|
||||
}
|
||||
if (oldRect.height() != m_rect.height()) {
|
||||
Q_EMIT heightChanged();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace KWin
|
48
src/effects/overview/expoarea.h
Normal file
48
src/effects/overview/expoarea.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <kwineffects.h>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
class ExpoArea : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(KWin::EffectScreen *screen READ screen WRITE setScreen NOTIFY screenChanged)
|
||||
Q_PROPERTY(int x READ x NOTIFY xChanged)
|
||||
Q_PROPERTY(int y READ y NOTIFY yChanged)
|
||||
Q_PROPERTY(int width READ width NOTIFY widthChanged)
|
||||
Q_PROPERTY(int height READ height NOTIFY heightChanged)
|
||||
|
||||
public:
|
||||
explicit ExpoArea(QObject *parent = nullptr);
|
||||
|
||||
EffectScreen *screen() const;
|
||||
void setScreen(EffectScreen *screen);
|
||||
|
||||
int x() const;
|
||||
int y() const;
|
||||
int width() const;
|
||||
int height() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void screenChanged();
|
||||
void xChanged();
|
||||
void yChanged();
|
||||
void widthChanged();
|
||||
void heightChanged();
|
||||
|
||||
private:
|
||||
void update();
|
||||
|
||||
QRect m_rect;
|
||||
EffectScreen *m_screen = nullptr;
|
||||
};
|
||||
|
||||
} // namespace KWin
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include "overvieweffect.h"
|
||||
#include "expoarea.h"
|
||||
#include "expolayout.h"
|
||||
#include "overviewconfig.h"
|
||||
|
||||
|
@ -64,6 +65,7 @@ void OverviewScreenView::stop()
|
|||
OverviewEffect::OverviewEffect()
|
||||
: m_shutdownTimer(new QTimer(this))
|
||||
{
|
||||
qmlRegisterType<ExpoArea>("org.kde.kwin.private.overview", 1, 0, "ExpoArea");
|
||||
qmlRegisterType<ExpoLayout>("org.kde.kwin.private.overview", 1, 0, "ExpoLayout");
|
||||
qmlRegisterType<ExpoCell>("org.kde.kwin.private.overview", 1, 0, "ExpoCell");
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
import QtQuick 2.12
|
||||
import org.kde.kwin 3.0 as KWinComponents
|
||||
import org.kde.kwin.private.overview 1.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
|
||||
FocusScope {
|
||||
|
@ -64,8 +65,16 @@ FocusScope {
|
|||
}
|
||||
}
|
||||
|
||||
ExpoArea {
|
||||
id: heapArea
|
||||
screen: targetScreen
|
||||
}
|
||||
|
||||
WindowHeap {
|
||||
anchors.fill: parent
|
||||
x: heapArea.x
|
||||
y: heapArea.y
|
||||
width: heapArea.width
|
||||
height: heapArea.height
|
||||
focus: true
|
||||
organized: container.organized
|
||||
model: KWinComponents.ClientFilterModel {
|
||||
|
|
Loading…
Reference in a new issue