support window move with the shell interface

wilder-5.14
Marco Martin 11 years ago
parent 9ac2fd0636
commit 7763a9c956
  1. 29
      shell/panelconfigview.cpp
  2. 15
      shell/panelconfigview.h

@ -20,6 +20,7 @@
#include "panelconfigview.h" #include "panelconfigview.h"
#include "panelview.h" #include "panelview.h"
#include "panelshadows_p.h" #include "panelshadows_p.h"
#include "shellcorona.h"
#include <QDebug> #include <QDebug>
#include <QDir> #include <QDir>
@ -35,9 +36,11 @@
#include <KWindowSystem> #include <KWindowSystem>
#include <Plasma/Containment> #include <Plasma/Containment>
#include <Plasma/Corona>
#include <Plasma/PluginLoader> #include <Plasma/PluginLoader>
#include <KWayland/Client/plasmashell.h>
#include <KWayland/Client/surface.h>
//////////////////////////////PanelConfigView //////////////////////////////PanelConfigView
PanelConfigView::PanelConfigView(Plasma::Containment *containment, PanelView *panelView, QWindow *parent) PanelConfigView::PanelConfigView(Plasma::Containment *containment, PanelView *panelView, QWindow *parent)
: ConfigView(containment, parent), : ConfigView(containment, parent),
@ -230,6 +233,30 @@ void PanelConfigView::focusOutEvent(QFocusEvent *ev)
close(); close();
} }
void PanelConfigView::moveEvent(QMoveEvent *ev)
{
if (!m_shellSurface) {
ShellCorona *c = qobject_cast<ShellCorona *>(m_containment->corona());
if (c) {
using namespace KWayland::Client;
PlasmaShell *interface = c->waylandPlasmaShellInterface();
if (!interface) {
return;
}
Surface *s = Surface::fromWindow(this);
if (!s) {
return;
}
m_shellSurface = interface->createSurface(s, this);
}
}
if (m_shellSurface) {
m_shellSurface->setPosition(ev->pos());
}
}
void PanelConfigView::setVisibilityMode(PanelView::VisibilityMode mode) void PanelConfigView::setVisibilityMode(PanelView::VisibilityMode mode)
{ {
if (m_visibilityMode == mode) { if (m_visibilityMode == mode) {

@ -28,6 +28,7 @@
#include <QJSValue> #include <QJSValue>
#include <QQmlListProperty> #include <QQmlListProperty>
#include <QStandardItemModel> #include <QStandardItemModel>
#include <QPointer>
#include <Plasma/Theme> #include <Plasma/Theme>
class PanelView; class PanelView;
@ -36,6 +37,14 @@ namespace Plasma {
class Containment; class Containment;
} }
namespace KWayland
{
namespace Client
{
class PlasmaShellSurface;
}
}
class PanelConfigView : public PlasmaQuick::ConfigView class PanelConfigView : public PlasmaQuick::ConfigView
{ {
Q_OBJECT Q_OBJECT
@ -53,14 +62,13 @@ public:
protected: protected:
void showEvent(QShowEvent *ev); void showEvent(QShowEvent *ev);
void hideEvent(QHideEvent *ev); void hideEvent(QHideEvent *ev);
void focusOutEvent(QFocusEvent *ev);
void moveEvent(QMoveEvent *ev);
public Q_SLOTS: public Q_SLOTS:
void showAddWidgetDialog(); void showAddWidgetDialog();
void addPanelSpacer(); void addPanelSpacer();
protected:
void focusOutEvent(QFocusEvent *ev);
protected Q_SLOTS: protected Q_SLOTS:
void syncGeometry(); void syncGeometry();
void syncSlideLocation(); void syncSlideLocation();
@ -78,6 +86,7 @@ private:
Plasma::Theme m_theme; Plasma::Theme m_theme;
QTimer m_deleteTimer; QTimer m_deleteTimer;
QTimer m_screenSyncTimer; QTimer m_screenSyncTimer;
QPointer<KWayland::Client::PlasmaShellSurface> m_shellSurface;
}; };
#endif // multiple inclusion guard #endif // multiple inclusion guard

Loading…
Cancel
Save