aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop-unified/src-desktop
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2018-06-06 11:27:51 -0400
committerKen Moore <ken@ixsystems.com>2018-06-06 11:27:51 -0400
commit2f04b6230720e61533ce3527bf26e94ed3d93467 (patch)
treebdc5fe0239b1a5786a3a5054c885986a1dad82ab /src-qt5/core/lumina-desktop-unified/src-desktop
parentFix up the crash on resize. (diff)
downloadlumina-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')
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/NativeWindowObject.cpp4
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/NativeWindowObject.h5
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeEmbedWidget.h78
3 files changed, 64 insertions, 23 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/NativeWindowObject.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/NativeWindowObject.cpp
index 45aa1101..6c3c7adf 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/NativeWindowObject.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/NativeWindowObject.cpp
@@ -327,6 +327,10 @@ void NativeWindowObject::requestPing(){
emit RequestPing(winid);
}
+void NativeWindowObject::requestActivate(){
+ requestProperty(NativeWindowObject::Active, true);
+}
+
// ==== PRIVATE ====
void NativeWindowObject::emitSinglePropChanged(NativeWindowObject::Property prop){
//Simple switch to emit the QML-usable signals as properties are changed
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/NativeWindowObject.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/NativeWindowObject.h
index c1851d0e..e4efeef7 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/NativeWindowObject.h
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/NativeWindowObject.h
@@ -39,8 +39,8 @@ public:
enum State{ S_MODAL, S_STICKY, S_MAX_VERT, S_MAX_HORZ, S_SHADED, S_SKIP_TASKBAR, S_SKIP_PAGER, S_HIDDEN, S_FULLSCREEN, S_ABOVE, S_BELOW, S_ATTENTION };
enum Type{T_DESKTOP, T_DOCK, T_TOOLBAR, T_MENU, T_UTILITY, T_SPLASH, T_DIALOG, T_DROPDOWN_MENU, T_POPUP_MENU, T_TOOLTIP, T_NOTIFICATION, T_COMBO, T_DND, T_NORMAL };
enum Action {A_MOVE, A_RESIZE, A_MINIMIZE, A_SHADE, A_STICK, A_MAX_VERT, A_MAX_HORZ, A_FULLSCREEN, A_CHANGE_DESKTOP, A_CLOSE, A_ABOVE, A_BELOW};
- enum Location { TOP_LEFT, TOP, TOP_RIGHT, RIGHT, BOTTOM_RIGHT, BOTTOM, BOTTOM_LEFT, LEFT };
- Q_ENUM(Location)
+ enum Location { TOP_LEFT, TOP, TOP_RIGHT, RIGHT, BOTTOM_RIGHT, BOTTOM, BOTTOM_LEFT, LEFT };
+ Q_ENUM(Location)
enum Property{ /*QVariant Type*/
None=0, /*null*/
@@ -124,6 +124,7 @@ public slots:
Q_INVOKABLE void requestClose(); //ask the app to close the window (may/not depending on activity)
Q_INVOKABLE void requestKill(); //ask the WM to kill the app associated with this window (harsh - only use if not responding)
Q_INVOKABLE void requestPing(); //ask the app if it is still active (a WindowNotResponding signal will get sent out if there is no reply);
+ Q_INVOKABLE void requestActivate();
private:
QHash <NativeWindowObject::Property, QVariant> hash;
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(){}
};
bgstack15