kdeplasma-addons: do not register the showdesktop applet icon as drag handle

the feature to minimize on drag can be implemented by sub-classing
Plasma::IconWidget but I dont need that kind of feature and it was borked

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-09-15 06:00:50 +03:00
parent 1c8b53127e
commit b812f49201
2 changed files with 7 additions and 24 deletions

View file

@ -37,8 +37,6 @@ ShowDesktop::ShowDesktop(QObject *parent, const QVariantList &args)
setAspectRatioMode(Plasma::ConstrainedSquare);
int iconSize = IconSize(KIconLoader::Desktop);
resize(iconSize * 2, iconSize * 2);
setAcceptDrops(true);
connect(&m_timer, SIGNAL(timeout()), this, SLOT(minimizeAll()));
}
void ShowDesktop::init()
@ -49,14 +47,16 @@ void ShowDesktop::init()
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
Plasma::IconWidget *icon = new Plasma::IconWidget(KIcon("user-desktop"), QString(), this);
Plasma::IconWidget *icon = new Plasma::IconWidget(this);
icon->setIcon(KIcon("user-desktop"));
layout->addItem(icon);
registerAsDragHandle(icon);
connect(icon, SIGNAL(clicked()), this, SLOT(minimizeAll()));
Plasma::ToolTipContent toolTipData(i18n("Show the Desktop"),
i18n("Minimize all open windows and show the Desktop"),
icon->icon().pixmap(IconSize(KIconLoader::Desktop)));
Plasma::ToolTipContent toolTipData(
i18n("Show the Desktop"),
i18n("Minimize all open windows and show the Desktop"),
icon->icon().pixmap(IconSize(KIconLoader::Desktop))
);
Plasma::ToolTipManager::self()->setContent(this, toolTipData);
NETRootInfo info(QX11Info::display(), NET::Supported);
@ -79,7 +79,6 @@ void ShowDesktop::init()
void ShowDesktop::minimizeAll()
{
m_timer.stop();
if (m_wm2ShowingDesktop) {
NETRootInfo info(QX11Info::display(), 0);
#ifndef MINIMIZE_ONLY
@ -94,17 +93,6 @@ void ShowDesktop::minimizeAll()
}
}
void ShowDesktop::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
{
m_timer.start(750);
event->accept();
}
void ShowDesktop::dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
{
m_timer.stop();
}
#ifndef MINIMIZE_ONLY
void ShowDesktop::delay()
{

View file

@ -21,8 +21,6 @@
//#define MINIMIZE_ONLY
#include <Plasma/Applet>
#include <QTimer>
#include <QtGui/qgraphicssceneevent.h>
class ShowDesktop : public Plasma::Applet
{
@ -40,8 +38,6 @@ public slots:
#endif
protected:
void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF()) const;
private slots:
@ -53,7 +49,6 @@ private:
bool m_down;
bool m_goingDown;
#endif
QTimer m_timer;
};
K_EXPORT_PLASMA_APPLET(showdesktop, ShowDesktop)