diff options
author | Ken Moore <ken@ixsystems.com> | 2018-06-06 11:27:51 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2018-06-06 11:27:51 -0400 |
commit | 2f04b6230720e61533ce3527bf26e94ed3d93467 (patch) | |
tree | bdc5fe0239b1a5786a3a5054c885986a1dad82ab /src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets | |
parent | Fix up the crash on resize. (diff) | |
download | lumina-2f04b6230720e61533ce3527bf26e94ed3d93467.tar.gz lumina-2f04b6230720e61533ce3527bf26e94ed3d93467.tar.bz2 lumina-2f04b6230720e61533ce3527bf26e94ed3d93467.zip |
Get more of the tray icon reading put together.
Cleanup some whitespace and turn off some debugging
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets')
-rw-r--r-- | src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeEmbedWidget.h | 78 |
1 files changed, 57 insertions, 21 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeEmbedWidget.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeEmbedWidget.h index 24579308..0cce4fdb 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeEmbedWidget.h +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeEmbedWidget.h @@ -6,37 +6,72 @@ //=========================================== #ifndef _DESKTOP_WINDOW_EMBED_WIDGET_H #define _DESKTOP_WINDOW_EMBED_WIDGET_H + #include <global-includes.h> -class NativeEmbedWidget : public QObject{ +#define USE_QWINDOW_EMBED 1 + +class EmbedWidget : public QWidget { Q_OBJECT private: - QWidget *embedW; - QWindow *_window; NativeWindowObject *WIN; -private slots: - void visibleChanged(bool show){ WIN->setProperty(NativeWindowObject::Visible, show); } - void windowTitleChanged(QString title){ WIN->setProperty(NativeWindowObject::Title, title); } - void heightChanged(int val){ qDebug() << "Got Wndow Height change:" << val; } //WIN->setProperty(NativeWindowObject::Size, QSize(WIN->property(NativeWindowObject::Size).toSize().width(),val) ); } - void widthChanged(int val){ qDebug() << "Got Wndow Width change:" << val; } // WIN->setProperty(NativeWindowObject::Size, QSize(val, WIN->property(NativeWindowObject::Size).toSize().height()) ); } - void xChanged(int val){ qDebug() << "Got Window X changed:" << val; } - void yChanged(int val){ qDebug() << "Got Window Y changed:" << val; } +public: + EmbedWidget(NativeWindowObject *win, QWidget* parent) : QWidget(parent){ + WIN = win; + } + ~EmbedWidget(){} + +public slots: + void submitNewGeom(){ + QRect global_geom = QRect( this->mapToGlobal(QPoint(0,0)), this->size() ); + WIN->setGeometryNow(global_geom); + } + +protected: + void resizeEvent(QResizeEvent *ev){ + QWidget::resizeEvent(ev); + submitNewGeom(); + } + /*void moveEvent(QMoveEvent *ev){ + QWidget::moveEvent(ev); + submitNewGeom(); + }*/ + void hideEvent(QHideEvent *ev){ + QWidget::hideEvent(ev); + qDebug() << "Hide Event"; + WIN->requestProperty(NativeWindowObject::Visible, false); + } + void showEvent(QShowEvent *ev){ + QWidget::showEvent(ev); + qDebug() << "ShowEvent"; + WIN->requestProperty(NativeWindowObject::Visible, true); + } + void enterEvent(QEvent *ev){ + QWidget::enterEvent(ev); + qDebug() << "enter event"; + } + void paintEvent(QPaintEvent *){ + //Never paint anything with this widget + } + +}; +class NativeEmbedWidget : public QObject { + Q_OBJECT +private: + QWidget *embedW; + NativeWindowObject *WIN; public: NativeEmbedWidget(QWidget *parent, NativeWindowObject *obj) : QObject(parent){ WIN = obj; - _window = QWindow::fromWinId(WIN->id()); - //embedW = new QWidget(parent); - embedW = QWidget::createWindowContainer(_window, parent); - //Setup all the internal connections - connect(_window, SIGNAL(visibleChanged(bool)), this, SLOT(visibleChanged(bool)) ); - connect(_window, SIGNAL(windowTitleChanged(const QString&)), this, SLOT(windowTitleChanged(const QString&)) ); - connect(_window, SIGNAL(widthChanged(int)), this, SLOT(widthChanged(int)) ); - connect(_window, SIGNAL(heightChanged(int)), this, SLOT(heightChanged(int)) ); - connect(_window, SIGNAL(xChanged(int)), this, SLOT(xChanged(int)) ); - connect(_window, SIGNAL(yChanged(int)), this, SLOT(yChanged(int)) ); + if(USE_QWINDOW_EMBED){ + QWindow* _window = QWindow::fromWinId(WIN->id()); + embedW = QWidget::createWindowContainer(_window, parent); + }else{ + embedW = new EmbedWidget(WIN, parent); + } } ~NativeEmbedWidget(){} @@ -44,7 +79,8 @@ public: QRect geometry(){ return embedW->geometry(); } public slots: - void activateWindow(){ QTimer::singleShot(0, _window, SLOT(requestActivate())); } + void activateWindow(){ WIN->requestActivate(); } //QTimer::singleShot(0, WIN, SLOT(requestActivate())); } + void windowFrameMoved(){} }; |