Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 30 additions & 9 deletions panels/dock/pluginmanagerextension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
#include <QtWaylandCompositor/QWaylandQuickItem>

#include <QGuiApplication>
#include <QInputMethod>

Check warning on line 30 in panels/dock/pluginmanagerextension.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QInputMethod> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QClipboard>

Check warning on line 31 in panels/dock/pluginmanagerextension.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QClipboard> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QMimeData>

Check warning on line 32 in panels/dock/pluginmanagerextension.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QMimeData> not found. Please note: Cppcheck does not need standard library headers to get proper results.

#include <QTimer>

Check warning on line 33 in panels/dock/pluginmanagerextension.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QTimer> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QJsonObject>

Check warning on line 34 in panels/dock/pluginmanagerextension.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QJsonObject> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QJsonParseError>

Check warning on line 35 in panels/dock/pluginmanagerextension.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QJsonParseError> not found. Please note: Cppcheck does not need standard library headers to get proper results.

#define protected public
#include <private/qwaylandcompositor_p.h>
Expand Down Expand Up @@ -345,12 +345,20 @@
, m_popupType(popupType)
, m_height(1)
, m_width(1)
, m_sizeChangeTimer(new QTimer(this))
, m_hasPendingChanged(false)
, m_pendingHeight(1)
, m_pendingWidth(1)
{
Q_UNUSED(x)
Q_UNUSED(y)
init(resource.resource());
setExtensionContainer(surface);
QWaylandCompositorExtension::initialize();

m_sizeChangeTimer->setInterval(50);
m_sizeChangeTimer->setSingleShot(true);
connect(m_sizeChangeTimer, &QTimer::timeout, this, &PluginPopup::onProcessPendingSizeChanges);
}

QWaylandSurface* PluginPopup::surface() const
Expand Down Expand Up @@ -446,14 +454,11 @@
if (width == 0 || height == 0)
return;

if (height != m_height) {
m_height = height;
Q_EMIT heightChanged();
}

if (width != m_width) {
m_width = width;
Q_EMIT widthChanged();
m_pendingWidth = width;
m_pendingHeight = height;
m_hasPendingChanged = true;
if (!m_sizeChangeTimer->isActive()) {
m_sizeChangeTimer->start();
}
}

Expand All @@ -463,6 +468,22 @@
Q_EMIT cursorShapeRequested(cursor_shape);
}

void PluginPopup::onProcessPendingSizeChanges()
{
if (!m_hasPendingChanged)
return;

if (m_pendingHeight != m_height) {
m_height = m_pendingHeight;
Q_EMIT heightChanged();
}
if (m_pendingWidth != m_width) {
m_width = m_pendingWidth;
Q_EMIT widthChanged();
}
m_hasPendingChanged = false;
}

PluginManager::PluginManager(QWaylandCompositor *compositor)
: QWaylandCompositorExtensionTemplate(compositor)
{
Expand Down
7 changes: 7 additions & 0 deletions panels/dock/pluginmanagerextension_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,9 @@ class PluginPopup : public QWaylandShellSurfaceTemplate<PluginPopup>, public QtW
void widthChanged();
void cursorShapeRequested(int cursorShape);

private slots:
void onProcessPendingSizeChanges();

private:
PluginManager* m_manager;
QPointer<QWaylandSurface> m_surface;
Expand All @@ -280,6 +283,10 @@ class PluginPopup : public QWaylandShellSurfaceTemplate<PluginPopup>, public QtW
int32_t m_y;
int m_height;
int m_width;
QTimer* m_sizeChangeTimer;
bool m_hasPendingChanged;
int m_pendingHeight;
int m_pendingWidth;
};

Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(PluginManager)
Expand Down
Loading