Commit ae1937ba authored by Marco Martin's avatar Marco Martin
Browse files

Remove completely present windows

since it has been replaced by windowview, and Desktop Grid
is ported as well, remove present windows which is effectively dead code
now

BUG:447001
BUG:362844
BUG:450487
BUG:453426
BUG:374481
BUG:185381
BUG:413342
BUG:451150
BUG:283333
BUG:315314
BUG:397500
BUG:321236
BUG:436572
BUG:335782
parent 7a4cabf3
Pipeline #172512 passed with stage
in 26 minutes and 25 seconds
......@@ -77,7 +77,6 @@ add_subdirectory(kscreen)
add_subdirectory(screentransform)
add_subdirectory(magiclamp)
add_subdirectory(overview)
add_subdirectory(presentwindows)
add_subdirectory(screenedge)
add_subdirectory(showfps)
add_subdirectory(showpaint)
......
#######################################
# Effect
install(FILES main.qml DESTINATION ${KDE_INSTALL_DATADIR}/kwin/effects/presentwindows/)
set(presentwindows_SOURCES
main.cpp
presentwindows.cpp
presentwindows_proxy.cpp
)
kconfig_add_kcfg_files(presentwindows_SOURCES
presentwindowsconfig.kcfgc
)
kwin4_add_effect_module(kwin4_effect_presentwindows ${presentwindows_SOURCES})
target_link_libraries(kwin4_effect_presentwindows PRIVATE
kwineffects
KF5::ConfigGui
KF5::GlobalAccel
KF5::I18n
Qt::DBus
Qt::Qml
Qt::Quick
)
#######################################
# Config
if (KWIN_BUILD_KCMS)
set(kwin_presentwindows_config_SRCS presentwindows_config.cpp)
ki18n_wrap_ui(kwin_presentwindows_config_SRCS presentwindows_config.ui)
kconfig_add_kcfg_files(kwin_presentwindows_config_SRCS presentwindowsconfig.kcfgc)
kwin_add_effect_config(kwin_presentwindows_config ${kwin_presentwindows_config_SRCS})
target_link_libraries(kwin_presentwindows_config
KF5::ConfigWidgets
KF5::CoreAddons
KF5::GlobalAccel
KF5::I18n
KF5::XmlGui
KWinEffectsInterface
)
endif()
/*
SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "presentwindows.h"
namespace KWin
{
KWIN_EFFECT_FACTORY(PresentWindowsEffect,
"metadata.json.stripped")
} // namespace KWin
#include "main.moc"
/*
KWin - the KDE window manager
This file is part of the KDE project.
SPDX-FileCopyrightText: 2013 Martin Gräßlin <mgraesslin@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick 2.0
import org.kde.plasma.components 3.0 as Plasma
Plasma.Button {
id: closeButton
icon.name: "window-close"
anchors.fill: parent
implicitWidth: units.iconSizes.medium
implicitHeight: implicitWidth
}
{
"KPlugin": {
"Category": "Window Management",
"Description": "Zoom out until all opened windows can be displayed side-by-side",
"Description[ar]": "بعِّد إلى أن يصير بالإمكان عرض كل النوافذ المفتوحة جبناً إلى جنب",
"Description[az]": "Bütün açıq pəncərələrin miniatürünü yan-yana göstərir",
"Description[ca@valencia]": "Redueix fins que totes les finestres obertes es poden mostrar una al costat de l'atra",
"Description[ca]": "Redueix fins que totes les finestres obertes es poden mostrar una al costat de l'altra",
"Description[cs]": "Oddálí plochu, aby byla vidět všechna okna",
"Description[de]": "Verkleinert Fenster auf der Arbeitsfläche, sodass sie alle nebeneinander sichtbar sind",
"Description[en_GB]": "Zoom out until all opened windows can be displayed side-by-side",
"Description[es]": "Reducir hasta que todas las ventanas abiertas se puedan mostrar una al lado de la otra",
"Description[fi]": "Loitontaa työpöytää kunnes avoimet ikkunat voi esittää rinnakkain",
"Description[fr]": "Faire un zoom arrière jusqu'à ce que toutes les fenêtres ouvertes puissent être affichées côte à côte",
"Description[hu]": "Kinagyítja a nézetet, hogy az összes megnyitott ablak áttekinthető legyen",
"Description[ia]": "Zoom foras usque omne fenestras aperite pote esser monstrate flanco a flanco",
"Description[id]": "Zoom keluar hingga semua window yang terbuka bisa ditampilkan sisi demi sisi",
"Description[it]": "Arretra per far vedere tutte le finestre aperte fianco a fianco",
"Description[ko]": "모든 열린 창을 축소시켜서 한 화면에 보이도록 합니다",
"Description[nl]": "Zoomt uit totdat alle geopende vensters zij-aan-zij kunnen worden getoond",
"Description[nn]": "Forminsk skjermflata heilt til alle dei opne vindauga kan visast side om side",
"Description[pl]": "Pomniejsza do chwili, aż wszystkie otwarte okna będą widoczne obok siebie",
"Description[pt]": "Reduz até que todas as janelas abertas possam aparecer lado-a-lado",
"Description[pt_BR]": "Reduz até que todas as janelas abertas possam ser apresentadas lado a lado",
"Description[ro]": "Îndepărtează până toate ferestrele deschise se pot afișa una lângă alta",
"Description[ru]": "Просмотр миниатюр всех открытых окон рядом друг с другом",
"Description[sk]": "Oddiali všetky otvorené okná a zobrazí ich vedľa seba",
"Description[sl]": "Oddaljite, dokler se ne vsa odprta okna ne prikažejo eno poleg drugega",
"Description[sv]": "Zooma ut till alla öppnade fönster kan visas sida vid sida",
"Description[ta]": "அனைத்து சாளரங்களையும் பக்கத்து பக்கத்தில் சிறிதாக்கி காட்டும்",
"Description[tr]": "Tüm açık pencereler yan yana görüntülenebilene dek uzaklaştır",
"Description[uk]": "Зменшення масштабу вікон так, щоб всі відкриті вікна можна було розташувати поряд",
"Description[vi]": "Thu nhỏ cho đến khi tất cả các cửa sổ đang mở hiển thị được cạnh nhau",
"Description[x-test]": "xxZoom out until all opened windows can be displayed side-by-sidexx",
"Description[zh_CN]": "所有窗口缩小后平铺显示在一个画面上",
"EnabledByDefault": true,
"Id": "presentwindows",
"License": "GPL",
"Name": "Present Windows",
"Name[ar]": "النوافذ الحاضرة",
"Name[az]": "Hazırkı pəncərələr",
"Name[ca@valencia]": "Presenta les finestres",
"Name[ca]": "Presenta les finestres",
"Name[cs]": "Prezentace oken",
"Name[de]": "Fenster zeigen",
"Name[en_GB]": "Present Windows",
"Name[es]": "Presentar ventanas",
"Name[fi]": "Ikkunoiden esittäminen",
"Name[fr]": "Fenêtres actuelles",
"Name[hu]": "Ablakáttekintő",
"Name[ia]": "Fenestras actual",
"Name[it]": "Presenta le finestre",
"Name[ko]": "창 진열하기",
"Name[nl]": "Vensters presenteren",
"Name[nn]": "Presenter vindauge",
"Name[pl]": "Prezentacja okien",
"Name[pt]": "Apresentar as Janelas",
"Name[pt_BR]": "Apresentar janelas",
"Name[ro]": "Prezintă ferestrele",
"Name[ru]": "Все окна",
"Name[sk]": "Súčasné okná",
"Name[sl]": "Prikaži okna",
"Name[sv]": "Befintliga fönster",
"Name[ta]": "சாளரங்களை முன்வை",
"Name[tr]": "Pencereleri Sun",
"Name[uk]": "Показ вікон",
"Name[vi]": "Các cửa sổ hiện thời",
"Name[x-test]": "xxPresent Windowsxx",
"Name[zh_CN]": "窗口平铺展示"
},
"X-KDE-ConfigModule": "kwin_presentwindows_config",
"org.kde.kwin.effect": {
"internal": true
}
}
This diff is collapsed.
/*
KWin - the KDE window manager
This file is part of the KDE project.
SPDX-FileCopyrightText: 2007 Rivo Laks <rivolaks@hot.ee>
SPDX-FileCopyrightText: 2008 Lucas Murray <lmurray@undefinedfire.com>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef KWIN_PRESENTWINDOWS_H
#define KWIN_PRESENTWINDOWS_H
#include "presentwindows_proxy.h"
#include <kwineffects.h>
#include <kwinoffscreenquickview.h>
#include <QElapsedTimer>
class QMouseEvent;
class QQuickView;
namespace KWin
{
class CloseWindowView : public OffscreenQuickScene
{
Q_OBJECT
public:
explicit CloseWindowView(QObject *parent = nullptr);
void disarm();
Q_SIGNALS:
void requestClose();
private Q_SLOTS:
void clicked();
private:
QElapsedTimer m_armTimer;
};
/**
* Expose-like effect which shows all windows on current desktop side-by-side,
* letting the user select active window.
*/
class PresentWindowsEffect
: public Effect
{
Q_OBJECT
Q_PROPERTY(int layoutMode READ layoutMode)
Q_PROPERTY(bool showCaptions READ isShowCaptions)
Q_PROPERTY(bool showIcons READ isShowIcons)
Q_PROPERTY(bool doNotCloseWindows READ isDoNotCloseWindows)
Q_PROPERTY(bool ignoreMinimized READ isIgnoreMinimized)
Q_PROPERTY(int accuracy READ accuracy)
Q_PROPERTY(bool fillGaps READ isFillGaps)
Q_PROPERTY(int fadeDuration READ fadeDuration)
Q_PROPERTY(bool showPanel READ isShowPanel)
Q_PROPERTY(int leftButtonWindow READ leftButtonWindow)
Q_PROPERTY(int rightButtonWindow READ rightButtonWindow)
Q_PROPERTY(int middleButtonWindow READ middleButtonWindow)
Q_PROPERTY(int leftButtonDesktop READ leftButtonDesktop)
Q_PROPERTY(int middleButtonDesktop READ middleButtonDesktop)
Q_PROPERTY(int rightButtonDesktop READ rightButtonDesktop)
// TODO: electric borders
private:
// Structures
struct WindowData
{
EffectWindowDeletedRef deletedRef;
EffectWindowVisibleRef visibleRef;
std::chrono::milliseconds lastPresentTime = std::chrono::milliseconds::zero();
bool visible;
bool deleted;
double opacity;
double highlight;
EffectFrame *textFrame;
EffectFrame *iconFrame;
};
typedef QHash<EffectWindow *, WindowData> DataHash;
struct GridSize
{
int columns;
int rows;
};
public:
PresentWindowsEffect();
~PresentWindowsEffect() override;
void reconfigure(ReconfigureFlags) override;
void *proxy() override;
// Screen painting
void prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime) override;
void paintScreen(int mask, const QRegion &region, ScreenPaintData &data) override;
void postPaintScreen() override;
// Window painting
void prePaintWindow(EffectWindow *w, WindowPrePaintData &data, std::chrono::milliseconds presentTime) override;
void paintWindow(EffectWindow *w, int mask, QRegion region, WindowPaintData &data) override;
// User interaction
void windowInputMouseEvent(QEvent *e) override;
void grabbedKeyboardEvent(QKeyEvent *e) override;
bool isActive() const override;
bool touchDown(qint32 id, const QPointF &pos, quint32 time) override;
bool touchMotion(qint32 id, const QPointF &pos, quint32 time) override;
bool touchUp(qint32 id, quint32 time) override;
int requestedEffectChainPosition() const override
{
return 70;
}
enum {
LayoutNatural,
LayoutRegularGrid,
LayoutFlexibleGrid,
}; // Layout modes
enum PresentWindowsMode {
ModeAllDesktops, // Shows windows of all desktops
ModeCurrentDesktop, // Shows windows on current desktop
ModeSelectedDesktop, // Shows windows of selected desktop via property (m_desktop)
ModeWindowGroup, // Shows windows selected via property
ModeWindowClass // Shows all windows of same class as selected class
};
enum WindowMouseAction {
WindowNoAction = 0, // Nothing
WindowActivateAction = 1, // Activates the window and deactivates the effect
WindowExitAction = 2, // Deactivates the effect without activating new window
WindowToCurrentDesktopAction = 3, // Brings window to current desktop
WindowToAllDesktopsAction = 4, // Brings window to all desktops
WindowMinimizeAction = 5, // Minimizes the window
WindowCloseAction = 6 // Closes the window
};
enum DesktopMouseAction {
DesktopNoAction = 0, // nothing
DesktopActivateAction = 1, // Activates the window and deactivates the effect
DesktopExitAction = 2, // Deactivates the effect without activating new window
DesktopShowDesktopAction = 3 // Minimizes all windows
};
// for properties
int layoutMode() const
{
return m_layoutMode;
}
bool isShowCaptions() const
{
return m_showCaptions;
}
bool isShowIcons() const
{
return m_showIcons;
}
bool isDoNotCloseWindows() const
{
return m_doNotCloseWindows;
}
bool isIgnoreMinimized() const
{
return m_ignoreMinimized;
}
int accuracy() const
{
return m_accuracy;
}
bool isFillGaps() const
{
return m_fillGaps;
}
int fadeDuration() const
{
return m_fadeDuration;
}
bool isShowPanel() const
{
return m_showPanel;
}
int leftButtonWindow() const
{
return m_leftButtonWindow;
}
int rightButtonWindow() const
{
return m_rightButtonWindow;
}
int middleButtonWindow() const
{
return m_middleButtonWindow;
}
int leftButtonDesktop() const
{
return m_leftButtonDesktop;
}
int middleButtonDesktop() const
{
return m_middleButtonDesktop;
}
int rightButtonDesktop() const
{
return m_rightButtonDesktop;
}
public Q_SLOTS:
Q_SCRIPTABLE void presentWindows(const QStringList &windows);
void setActive(bool active);
void toggleActive()
{
m_mode = ModeCurrentDesktop;
setActive(!m_activated);
}
void toggleActiveAllDesktops()
{
m_mode = ModeAllDesktops;
setActive(!m_activated);
}
void toggleActiveClass();
// EffectsHandler
void slotWindowAdded(KWin::EffectWindow *w);
void slotWindowClosed(KWin::EffectWindow *w);
void slotWindowDeleted(KWin::EffectWindow *w);
void slotWindowFrameGeometryChanged(KWin::EffectWindow *w, const QRect &old);
// atoms
void slotPropertyNotify(KWin::EffectWindow *w, long atom);
private Q_SLOTS:
void closeWindow();
protected:
// Window rearranging
void rearrangeWindows();
void reCreateGrids();
void maybeRecreateGrids();
void calculateWindowTransformations(EffectWindowList windowlist, EffectScreen *screen,
WindowMotionManager &motionManager, bool external = false);
void calculateWindowTransformationsClosest(EffectWindowList windowlist, EffectScreen *screen,
WindowMotionManager &motionManager);
void calculateWindowTransformationsKompose(EffectWindowList windowlist, EffectScreen *screen,
WindowMotionManager &motionManager);
void calculateWindowTransformationsNatural(EffectWindowList windowlist, EffectScreen *screen,
WindowMotionManager &motionManager);
// Helper functions for window rearranging
inline double aspectRatio(EffectWindow *w)
{
return w->width() / double(w->height());
}
inline int widthForHeight(EffectWindow *w, int height)
{
return int((height / double(w->height())) * w->width());
}
inline int heightForWidth(EffectWindow *w, int width)
{
return int((width / double(w->width())) * w->height());
}
bool isOverlappingAny(EffectWindow *w, const QHash<EffectWindow *, QRect> &targets, const QRegion &border);
// Filter box
void updateFilterFrame();
// Helper functions
bool isSelectableWindow(EffectWindow *w);
bool isVisibleWindow(EffectWindow *w);
void setHighlightedWindow(EffectWindow *w);
EffectWindow *relativeWindow(EffectWindow *w, int xdiff, int ydiff, bool wrap) const;
EffectWindow *findFirstWindow() const;
void updateCloseWindow();
// Helper functions for mouse actions
void mouseActionWindow(WindowMouseAction &action);
void mouseActionDesktop(DesktopMouseAction &action);
void inputEventUpdate(const QPoint &pos, QEvent::Type type = QEvent::None, Qt::MouseButton button = Qt::NoButton);
private:
PresentWindowsEffectProxy m_proxy;
friend class PresentWindowsEffectProxy;
// User configuration settings
int m_layoutMode;
bool m_showCaptions;
bool m_showIcons;
bool m_doNotCloseWindows;
int m_accuracy;
bool m_fillGaps;
double m_fadeDuration;
bool m_showPanel;
// Activation
bool m_activated;
bool m_ignoreMinimized;
double m_decalOpacity;
bool m_hasKeyboardGrab;
PresentWindowsMode m_mode;
int m_desktop;
EffectWindowList m_selectedWindows;
EffectWindow *m_managerWindow;
QString m_class;
bool m_needInitialSelection;
// Window data
WindowMotionManager m_motionManager;
DataHash m_windowData;
EffectWindow *m_highlightedWindow;
// Timing
std::chrono::milliseconds m_lastPresentTime;
// Grid layout info
QMap<EffectScreen *, GridSize> m_gridSizes;
// Filter box
EffectFrame *m_filterFrame;
QString m_windowFilter;
// Atoms
// Present windows for all windows of given desktop
// -1 for all desktops
long m_atomDesktop;
// Present windows for group of window ids
long m_atomWindows;
// Mouse Actions
WindowMouseAction m_leftButtonWindow;
WindowMouseAction m_middleButtonWindow;
WindowMouseAction m_rightButtonWindow;
DesktopMouseAction m_leftButtonDesktop;
DesktopMouseAction m_middleButtonDesktop;
DesktopMouseAction m_rightButtonDesktop;
CloseWindowView *m_closeView;
Qt::Corner m_closeButtonCorner;
struct
{
qint32 id = 0;
bool active = false;
} m_touch;
};
} // namespace
#endif
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile arg="true"/>
<group name="Effect-presentwindows">
<entry name="LayoutMode" type="Int">
<default>0</default>
</entry>
<entry name="DrawWindowCaptions" type="Bool">
<default>true</default>
</entry>
<entry name="DrawWindowIcons" type="Bool">
<default>true</default>
</entry>
<entry name="AllowClosingWindows" type="Bool">
<default>true</default>
</entry>
<entry name="IgnoreMinimized" type="Bool">
<default>false</default>
</entry>
<entry name="ShowPanel" type="Bool">
<default>true</default>
</entry>
<entry name="Accuracy" type="Int">
<default>1</default>
</entry>
<entry name="FillGaps" type="Bool">
<default>true</default>
</entry>
<entry name="LeftButtonWindow" type="Int">
<default>1</default>
</entry>
<entry name="MiddleButtonWindow" type="Int">
<default>0</default>
</entry>
<entry name="RightButtonWindow" type="Int">
<default>2</default>
</entry>
<entry name="LeftButtonDesktop" type="Int">
<default>2</default>
</entry>
<entry name="MiddleButtonDesktop" type="Int">
<default>0</default>
</entry>
<entry name="RightButtonDesktop" type="Int">
<default>0</default>
</entry>
</group>
</kcfg>
/*
KWin - the KDE window manager
This file is part of the KDE project.
SPDX-FileCopyrightText: 2007 Rivo Laks <rivolaks@hot.ee>
SPDX-FileCopyrightText: 2008 Lucas Murray <lmurray@undefinedfire.com>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "presentwindows_config.h"
#include <config-kwin.h>
// KConfigSkeleton
#include "presentwindowsconfig.h"
#include <QAction>
#include <kwineffects_interface.h>
#include <KActionCollection>
#include <KGlobalAccel>
#include <KLocalizedString>
#include <KPluginFactory>
#include <kconfiggroup.h>
#include <QVBoxLayout>
K_PLUGIN_CLASS(KWin::PresentWindowsEffectConfig)
namespace KWin
{
PresentWindowsEffectConfigForm::PresentWindowsEffectConfigForm(QWidget *parent)
: QWidget(parent)
{