aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop-unified
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2018-04-10 08:21:31 -0400
committerKen Moore <ken@ixsystems.com>2018-04-10 08:21:31 -0400
commite7a6c701b793a6d5d2ef083e7e52ac1501ce8b87 (patch)
treee08b17a7639c7fa55eb988a50b0d9182d158c93a /src-qt5/core/lumina-desktop-unified
parentAdd in the widgets-based version of panels. (diff)
downloadlumina-e7a6c701b793a6d5d2ef083e7e52ac1501ce8b87.tar.gz
lumina-e7a6c701b793a6d5d2ef083e7e52ac1501ce8b87.tar.bz2
lumina-e7a6c701b793a6d5d2ef083e7e52ac1501ce8b87.zip
Get a bit more work on the new window-embed routine for Lumina 2
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified')
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/DesktopManager.cpp2
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.cpp58
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.h8
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.cpp4
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.h4
5 files changed, 56 insertions, 20 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/DesktopManager.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/DesktopManager.cpp
index edde5ed7..32f84f93 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/DesktopManager.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/DesktopManager.cpp
@@ -129,6 +129,8 @@ void DesktopManager::NewWindowAvailable(NativeWindowObject* win){
#ifdef USE_WIDGETS
qDebug() << "Got New Widget Window:" << win->name();
NativeWindow *tmp = new NativeWindow(win);
+ //Lumina::NWS->RequestReparent(win->id(), win->frameId(), tmp->relativeOrigin());
+ QTimer::singleShot(10, tmp, SLOT(initProperties()) );
#endif
syncWindowList();
}
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.cpp
index 44b2d715..86dd8482 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.cpp
@@ -6,11 +6,34 @@
//===========================================
#include "NativeWindow.h"
+#include <QWidget>
+#include <QWindow>
+
// === PUBLIC ===
NativeWindow::NativeWindow( NativeWindowObject *obj ) : QFrame(0, Qt::Window | Qt::FramelessWindowHint){
WIN = obj;
createFrame();
- WIN->addFrameWinID(this->winId());
+ WIN->addFrameWinID(container->winId());
+}
+
+NativeWindow::~NativeWindow(){
+ vlayout->deleteLater();
+ toolbarL->deleteLater();
+}
+
+QPoint NativeWindow::relativeOrigin(){
+ //Update all the margins for the frame
+ /*QList<int> frame = WIN->property(NativeWindowObject::FrameExtents).value<QList<int> >();
+ //QList<int> : [Left, Right, Top, Bottom] in pixels
+ int topM = frame[2] - titleLabel->fontMetrics().height(); //figure out how much extra we have to work with
+ if(topM<0){ topM = 0; }
+ int botM = topM/2.0;
+ QPoint containerCorner(frame[0], topM-botM);
+ return containerCorner;*/
+ return QPoint(0,0);
+}
+
+void NativeWindow::initProperties(){
//Setup all the property connections
connect(WIN, SIGNAL(winImageChanged()), this, SLOT(syncWinImage()) );
connect(WIN, SIGNAL(nameChanged()), this, SLOT(syncName()) );
@@ -21,28 +44,24 @@ NativeWindow::NativeWindow( NativeWindowObject *obj ) : QFrame(0, Qt::Window | Q
connect(WIN, SIGNAL(winTypeChanged()), this, SLOT(syncWinType()) );
connect(WIN, SIGNAL(geomChanged()), this, SLOT(syncGeom()) );
connect(WIN, SIGNAL(WindowClosed(WId)), this, SLOT(deleteLater()) );
+
+ //Setup all the button connections
+ connect(minB, SIGNAL(clicked()), WIN, SLOT(toggleVisibility()) );
+ connect(maxB, SIGNAL(clicked()), WIN, SLOT(toggleMaximize()) );
+ connect(closeB, SIGNAL(clicked()), WIN, SLOT(requestClose()) );
+
//Now Perform the initial property loads
syncWinImage();
syncName();
syncTitle();
syncIcon();
syncSticky();
- syncVisibility();
syncWinType();
syncGeom();
- //Setup all the button connections
- connect(minB, SIGNAL(clicked()), WIN, SLOT(toggleVisibility()) );
- connect(maxB, SIGNAL(clicked()), WIN, SLOT(toggleMaximize()) );
- connect(closeB, SIGNAL(clicked()), WIN, SLOT(requestClose()) );
-
+ syncVisibility(true); //init visibility - force it visible to start with
}
-NativeWindow::~NativeWindow(){
- vlayout->deleteLater();
- toolbarL->deleteLater();
-}
-
// === PRIVATE ===
void NativeWindow::createFrame(){
//Initialize the widgets
@@ -62,7 +81,8 @@ void NativeWindow::createFrame(){
vlayout->setSpacing(0);
toolbarL = new QHBoxLayout();
toolbarL->setSpacing(0);
-
+ container = QWidget::createWindowContainer(QWindow::fromWinId(WIN->id()), this);
+ container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
//vlayout.align
titleLabel = new QLabel(this);
titleLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
@@ -75,7 +95,7 @@ void NativeWindow::createFrame(){
toolbarL->addWidget(maxB);
toolbarL->addWidget(closeB);
vlayout->addLayout(toolbarL);
- vlayout->addStretch();
+ vlayout->addWidget(container);
this->setLayout(vlayout);
// Load the icons for the buttons
loadIcons();
@@ -112,9 +132,13 @@ void NativeWindow::syncSticky(){
qDebug() << "Got Sticky Change:" << WIN->isSticky();
}
-void NativeWindow::syncVisibility(){
- qDebug() << "Sync Visibility:" << WIN->isVisible();
- this->setVisible(WIN->isVisible());
+void NativeWindow::syncVisibility(bool init){
+ if(init){
+ WIN->setProperty(NativeWindowObject::Visible, true, true); //force it
+ }else{
+ qDebug() << "Sync Visibility:" << WIN->isVisible();
+ this->setVisible(WIN->isVisible());
+ }
}
void NativeWindow::syncWinType(){
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.h
index 1d87ed71..f2fd822c 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.h
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.h
@@ -16,6 +16,11 @@ public:
NativeWindow(NativeWindowObject *obj);
~NativeWindow();
+ QPoint relativeOrigin(); //origin of the embedded window relative to the frame
+
+public slots:
+ void initProperties();
+
private:
//Core object
NativeWindowObject *WIN;
@@ -27,6 +32,7 @@ private:
QHBoxLayout *toolbarL;
QVBoxLayout *vlayout;
QLabel *titleLabel;
+ QWidget *container;
// Info cache variables
QRect oldgeom;
@@ -38,7 +44,7 @@ private slots:
void syncTitle();
void syncIcon();
void syncSticky();
- void syncVisibility();
+ void syncVisibility(bool init = false);
void syncWinType();
void syncGeom();
};
diff --git a/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.cpp b/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.cpp
index 65fa98a7..0d1e9c10 100644
--- a/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.cpp
@@ -631,6 +631,7 @@ void NativeWindowSystem::SetupNewWindow(NativeWindowObject *win){
win->addDamageID( (uint) dmgID); //save this for later
}else{
+ /*
//xcb_reparent_window(QX11Info::connection(), win->id(), this->winId(), 0, 0);
//Also use a partial-composite here - make sure the window pixmap is available even when the window is obscured
xcb_composite_redirect_window(QX11Info::connection(), win->id(), XCB_COMPOSITE_REDIRECT_AUTOMATIC);
@@ -639,6 +640,7 @@ void NativeWindowSystem::SetupNewWindow(NativeWindowObject *win){
Damage dmgID = XDamageCreate(QX11Info::display(), win->id(), XDamageReportRawRectangles);
win->addDamageID( (uint) dmgID); //save this for later
+ */
}
//win->addFrameWinID(this->winId());
registerClientEvents(win->id());
@@ -795,7 +797,7 @@ void NativeWindowSystem::NewWindowDetected(WId id){
if(attr == 0){ return; } //could not get attributes of window
if(attr->override_redirect){ free(attr); return; } //window has override redirect set (do not manage)
free(attr);
- xcb_reparent_window(QX11Info::connection(), id, QX11Info::appRootWindow(), 0, 0);
+ //xcb_reparent_window(QX11Info::connection(), id, QX11Info::appRootWindow(), 0, 0);
//Now go ahead and create/populate the container for this window
NativeWindowObject *win = new NativeWindowObject(id);
diff --git a/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.h b/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.h
index 0b6cd67e..f6033674 100644
--- a/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.h
+++ b/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.h
@@ -127,12 +127,14 @@ public slots:
void NewMouseRelease(int buttoncode, WId win = 0);
void CheckDamageID(WId);
+ void RequestReparent(WId, WId, QPoint); //client, parent, relative origin point in parent
+
+
private slots:
//These are the slots which are built-in and automatically connected when a new NativeWindow is created
void RequestClose(WId);
void RequestKill(WId);
void RequestPing(WId);
- void RequestReparent(WId, WId, QPoint); //client, parent, relative origin point in parent
//Window-mgmt functions (see Window-mgmt.cpp for details)
void ArrangeWindows(WId primary, QString type);
bgstack15