From f228077850b16fdd92310782aafe3f7f2b437adb Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 26 Apr 2018 17:48:37 -0400 Subject: Commit a bunch more work on the Lumina 2 screen reservations. --- .../src-events/NativeWindowSystem.cpp | 22 ++++++++++++++-------- .../src-events/NativeWindowSystem.h | 1 + .../src-events/Window-mgmt.cpp | 6 ++++++ 3 files changed, 21 insertions(+), 8 deletions(-) (limited to 'src-qt5/core/lumina-desktop-unified/src-events') 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 0d1e9c10..2afdd8c2 100644 --- a/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.cpp @@ -568,12 +568,12 @@ void NativeWindowSystem::ChangeWindowProperties(NativeWindowObject* win, QList< } if(props.contains(NativeWindowObject::Visible)){ - qDebug() << "Check Window Visibility:" << vals[ props.indexOf(NativeWindowObject::Visible) ]; + //qDebug() << "Check Window Visibility:" << vals[ props.indexOf(NativeWindowObject::Visible) ]; if( vals[ props.indexOf(NativeWindowObject::Visible) ].toBool() ){ - qDebug() << " - Map it!"; + //qDebug() << " - Map it!"; xcb_map_window(QX11Info::connection(), win->id()); }else{ - qDebug() << " - Unmap it!"; + //qDebug() << " - Unmap it!"; xcb_unmap_window(QX11Info::connection(), win->id()); } } @@ -630,6 +630,7 @@ void NativeWindowSystem::SetupNewWindow(NativeWindowObject *win){ Damage dmgID = XDamageCreate(QX11Info::display(), win->id(), XDamageReportRawRectangles); win->addDamageID( (uint) dmgID); //save this for later + registerClientEvents(win->id()); }else{ /* //xcb_reparent_window(QX11Info::connection(), win->id(), this->winId(), 0, 0); @@ -643,7 +644,7 @@ void NativeWindowSystem::SetupNewWindow(NativeWindowObject *win){ */ } //win->addFrameWinID(this->winId()); - registerClientEvents(win->id()); + //registerClientEvents(win->id()); } QImage NativeWindowSystem::GetWindowImage(NativeWindowObject* win){ @@ -802,7 +803,7 @@ void NativeWindowSystem::NewWindowDetected(WId id){ NativeWindowObject *win = new NativeWindowObject(id); //Register for events from this window - registerClientEvents(win->id()); + //registerClientEvents(win->id()); NWindows << win; UpdateWindowProperties(win, NativeWindowObject::allProperties()); if(win->showWindowFrame()){ @@ -815,11 +816,16 @@ void NativeWindowSystem::NewWindowDetected(WId id){ connect(win, SIGNAL(RequestPing(WId)), this, SLOT(RequestPing(WId)) ); connect(win, SIGNAL(RequestReparent(WId, WId, QPoint)), this, SLOT(RequestReparent(WId, WId, QPoint)) ); connect(win, SIGNAL(RequestPropertiesChange(WId, QList, QList)), this, SLOT(RequestPropertiesChange(WId, QList, QList)) ); - connect(win, SIGNAL(VerifyNewGeometry(WId)), this, SLOT(CheckWindowPosition(WId)) ); + connect(win, SIGNAL(WindowClosed(WId)), this, SLOT(WindowCloseDetected(WId)) ); + //connect(win, SIGNAL(VerifyNewGeometry(WId)), this, SLOT(CheckWindowPosition(WId)) ); + qDebug() << " - Setup New Window"; SetupNewWindow(win); - CheckWindowPosition(id, true); //first time placement - xcb_map_window(QX11Info::connection(), win->id()); + qDebug() << " - Setup window position"; + CheckWindowPosition(win, true); //first time placement + //xcb_map_window(QX11Info::connection(), win->id()); + qDebug() << " - Emit new window signal"; emit NewWindowAvailable(win); + connect(win, SIGNAL(VerifyNewGeometry(WId)), this, SLOT(CheckWindowPosition(WId)) ); } void NativeWindowSystem::NewTrayWindowDetected(WId 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 f6033674..405d3bc3 100644 --- a/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.h +++ b/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.h @@ -140,6 +140,7 @@ private slots: void ArrangeWindows(WId primary, QString type); void TileWindows(WId primary, QString type); void CheckWindowPosition(WId id, bool newwindow = false); + void CheckWindowPosition(NativeWindowObject *win, bool newwindow = false); void arrangeWindows(NativeWindowObject *primary, QString type, bool primaryonly = false); signals: diff --git a/src-qt5/core/lumina-desktop-unified/src-events/Window-mgmt.cpp b/src-qt5/core/lumina-desktop-unified/src-events/Window-mgmt.cpp index 0b45c208..23bd3e40 100644 --- a/src-qt5/core/lumina-desktop-unified/src-events/Window-mgmt.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-events/Window-mgmt.cpp @@ -91,8 +91,13 @@ void NativeWindowSystem::CheckWindowPosition(WId id, bool newwindow){ //used after a "drop" to validate/snap/re-arrange window(s) as needed // if "newwindow" is true, then this is the first-placement routine for a window before it initially appears NativeWindowObject* win = findWindow(id); + CheckWindowPosition(win, newwindow); +} + +void NativeWindowSystem::CheckWindowPosition(NativeWindowObject *win, bool newwindow){ if(win==0){ return; } //invalid window QRect geom = win->geometry(); + qDebug() << "Got Window Geometry:" << geom; bool changed = false; //Make sure it is on the screen (quick check) if(geom.x() < 0){ changed = true; geom.moveLeft(0); } @@ -101,5 +106,6 @@ void NativeWindowSystem::CheckWindowPosition(WId id, bool newwindow){ if(geom.height() < 20){ changed = true; geom.setHeight(100); } if(changed){ win->setGeometryNow(geom); } //Now run it through the window arrangement routine + qDebug() << "ArrangeWindows"; arrangeWindows(win, newwindow ?"center" : "snap", true); } -- cgit