diff options
author | Ken Moore <ken@ixsystems.com> | 2017-08-14 12:19:47 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-08-14 12:19:47 -0400 |
commit | 0302f69edae597b872fa75d364272b74f500c58b (patch) | |
tree | 0995a9cd7ad862215ee3a62c60f038838b66f5be /src-qt5 | |
parent | Add a wm failure counter to start-lumina-desktop, and restart the process up ... (diff) | |
download | lumina-0302f69edae597b872fa75d364272b74f500c58b.tar.gz lumina-0302f69edae597b872fa75d364272b74f500c58b.tar.bz2 lumina-0302f69edae597b872fa75d364272b74f500c58b.zip |
Some work on Lumina 2.x
Disable compositing for now with a simple define - can re-enable later when more time to fix
Start work on the client message detection/handling
Diffstat (limited to 'src-qt5')
-rw-r--r-- | src-qt5/core/libLumina/NativeEmbedWidget.cpp | 41 | ||||
-rw-r--r-- | src-qt5/core/libLumina/NativeEventFilter.cpp | 8 | ||||
-rw-r--r-- | src-qt5/core/libLumina/NativeWindowSystem.cpp | 4 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootSubWindow.cpp | 4 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootSubWindow.h | 1 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootWindow-mgmt.cpp | 27 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootWindow.cpp | 13 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootWindow.h | 5 |
8 files changed, 72 insertions, 31 deletions
diff --git a/src-qt5/core/libLumina/NativeEmbedWidget.cpp b/src-qt5/core/libLumina/NativeEmbedWidget.cpp index ed0fd89c..7d2dec0d 100644 --- a/src-qt5/core/libLumina/NativeEmbedWidget.cpp +++ b/src-qt5/core/libLumina/NativeEmbedWidget.cpp @@ -16,6 +16,8 @@ #include <xcb/composite.h> #include <X11/extensions/Xdamage.h> +#define DISABLE_COMPOSITING true + #define NORMAL_WIN_EVENT_MASK (XCB_EVENT_MASK_BUTTON_PRESS | \ XCB_EVENT_MASK_BUTTON_RELEASE | \ XCB_EVENT_MASK_POINTER_MOTION | \ @@ -27,6 +29,7 @@ XCB_EVENT_MASK_ENTER_WINDOW| \ XCB_EVENT_MASK_PROPERTY_CHANGE) + inline void registerClientEvents(WId id){ uint32_t value_list[1] = {NORMAL_WIN_EVENT_MASK}; xcb_change_window_attributes(QX11Info::connection(), id, XCB_CW_EVENT_MASK, value_list); @@ -62,15 +65,14 @@ void NativeEmbedWidget::showWindow(){ } QImage NativeEmbedWidget::windowImage(QRect geom){ - //if(paused){ return QImage(); } //Pull the XCB pixmap out of the compositing layer xcb_pixmap_t pix = xcb_generate_id(QX11Info::connection()); xcb_composite_name_window_pixmap(QX11Info::connection(), WIN->id(), pix); - if(pix==0){ return QImage(); } + if(pix==0){ qDebug() << "Got blank pixmap!"; return QImage(); } //Convert this pixmap into a QImage xcb_image_t *ximg = xcb_image_get(QX11Info::connection(), pix, geom.x(), geom.y(), geom.width(), geom.height(), ~0, XCB_IMAGE_FORMAT_Z_PIXMAP); - if(ximg == 0){ return QImage(); } + if(ximg == 0){ qDebug() << "Got blank image!"; return QImage(); } QImage img(ximg->data, ximg->width, ximg->height, ximg->stride, QImage::Format_ARGB32_Premultiplied); img = img.copy(); //detach this image from the XCB data structures xcb_image_destroy(ximg); @@ -111,18 +113,20 @@ bool NativeEmbedWidget::embedWindow(NativeWindow *window){ xcb_send_event(QX11Info::connection(), 0, WIN->id(), XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (const char *) &event); */ //Now setup any redirects and return - xcb_composite_redirect_window(QX11Info::connection(), WIN->id(), XCB_COMPOSITE_REDIRECT_MANUAL); //XCB_COMPOSITE_REDIRECT_[MANUAL/AUTOMATIC]); - xcb_composite_redirect_subwindows(QX11Info::connection(), WIN->id(), XCB_COMPOSITE_REDIRECT_MANUAL); //XCB_COMPOSITE_REDIRECT_[MANUAL/AUTOMATIC]); - - //Now create/register the damage handler - // -- XCB (Note: The XCB damage registration is completely broken at the moment - 9/15/15, Ken Moore) - // -- Retested 6/29/17 (no change) Ken Moore - //xcb_damage_damage_t dmgID = xcb_generate_id(QX11Info::connection()); //This is a typedef for a 32-bit unsigned integer - //xcb_damage_create(QX11Info::connection(), dmgID, WIN->id(), XCB_DAMAGE_REPORT_LEVEL_RAW_RECTANGLES); - // -- XLib (Note: This is only used because the XCB routine above does not work - needs to be fixed upstream in XCB itself). - Damage dmgID = XDamageCreate(QX11Info::display(), WIN->id(), XDamageReportRawRectangles); - - WIN->addDamageID( (uint) dmgID); //save this for later + if(!DISABLE_COMPOSITING){ + xcb_composite_redirect_window(QX11Info::connection(), WIN->id(), XCB_COMPOSITE_REDIRECT_MANUAL); //XCB_COMPOSITE_REDIRECT_[MANUAL/AUTOMATIC]); + xcb_composite_redirect_subwindows(QX11Info::connection(), WIN->id(), XCB_COMPOSITE_REDIRECT_MANUAL); //XCB_COMPOSITE_REDIRECT_[MANUAL/AUTOMATIC]); + + //Now create/register the damage handler + // -- XCB (Note: The XCB damage registration is completely broken at the moment - 9/15/15, Ken Moore) + // -- Retested 6/29/17 (no change) Ken Moore + //xcb_damage_damage_t dmgID = xcb_generate_id(QX11Info::connection()); //This is a typedef for a 32-bit unsigned integer + //xcb_damage_create(QX11Info::connection(), dmgID, WIN->id(), XCB_DAMAGE_REPORT_LEVEL_RAW_RECTANGLES); + // -- XLib (Note: This is only used because the XCB routine above does not work - needs to be fixed upstream in XCB itself). + Damage dmgID = XDamageCreate(QX11Info::display(), WIN->id(), XDamageReportRawRectangles); + + WIN->addDamageID( (uint) dmgID); //save this for later + } WIN->addFrameWinID(this->winId()); connect(WIN, SIGNAL(VisualChanged()), this, SLOT(repaintWindow()) ); //make sure we repaint the widget on visual change @@ -185,16 +189,17 @@ void NativeEmbedWidget::resyncWindow(){ xcb_configure_window(QX11Info::connection(), WIN->id(), mask, valList); xcb_flush(QX11Info::connection()); syncWinSize(); - QTimer::singleShot(0, this, SLOT(repaintWindow()) ); + QTimer::singleShot(10, this, SLOT(repaintWindow()) ); } void NativeEmbedWidget::repaintWindow(){ + if(DISABLE_COMPOSITING){ return; } //qDebug() << "Update Window Image:" << !paused; if(paused){ return; } QImage tmp = windowImage( QRect(QPoint(0,0), this->size()) ); if(!tmp.isNull()){ winImage = tmp; - }//else{ qDebug() << "Got Null Image!!"; } + }else{ qDebug() << "Got Null Image!!"; } this->parentWidget()->update(); } // ============== @@ -218,7 +223,7 @@ void NativeEmbedWidget::hideEvent(QHideEvent *ev){ } void NativeEmbedWidget::paintEvent(QPaintEvent *ev){ - if(WIN==0){ QWidget::paintEvent(ev); return; } + if(WIN==0 || DISABLE_COMPOSITING){ QWidget::paintEvent(ev); return; } else if( winImage.isNull() ){ /*QTimer::singleShot(0, this, SLOT(repaintWindow()) );*/ return; } else if(paused){ return; } //else if(this->size()!=winSize){ QTimer::singleShot(0,this, SLOT(syncWinSize())); return; } //do not paint here - waiting to re-sync the sizes diff --git a/src-qt5/core/libLumina/NativeEventFilter.cpp b/src-qt5/core/libLumina/NativeEventFilter.cpp index d6c2da50..a6b2f3b5 100644 --- a/src-qt5/core/libLumina/NativeEventFilter.cpp +++ b/src-qt5/core/libLumina/NativeEventFilter.cpp @@ -83,6 +83,10 @@ inline void ParsePropertyEvent(xcb_property_notify_event_t *ev, NativeEventFilte } } +inline void ParseClientMessageEvent(xcb_client_message_event *ev, NativeEventFilter *obj){ + +} + //Constructor for the Event Filter wrapper NativeEventFilter::NativeEventFilter() : QObject(){ @@ -222,7 +226,9 @@ bool EventFilter::nativeEventFilter(const QByteArray &eventType, void *message, //addTrayApp( ((xcb_client_message_event_t*)ev)->data.data32[2] ); } //Ignore the System Tray messages at the moment - } + }else if(((xcb_client_message_event_t*)ev)->window == QX11Info::appRootWindow()){ + ParseClientMessageEvent((xcb_client_message_event_t*)ev, obj); + } break; //============================== case XCB_CONFIGURE_NOTIFY: diff --git a/src-qt5/core/libLumina/NativeWindowSystem.cpp b/src-qt5/core/libLumina/NativeWindowSystem.cpp index e0f3fe91..74eef2b9 100644 --- a/src-qt5/core/libLumina/NativeWindowSystem.cpp +++ b/src-qt5/core/libLumina/NativeWindowSystem.cpp @@ -707,13 +707,13 @@ void NativeWindowSystem::NewTrayWindowDetected(WId id){ void NativeWindowSystem::WindowCloseDetected(WId id){ NativeWindow *win = findWindow(id, false); - qDebug() << "Got Window Closed" << id << win; + //qDebug() << "Got Window Closed" << id << win; //qDebug() << "Old Window List:" << NWindows.length(); if(win!=0){ NWindows.removeAll(win); //RequestReparent(id, QX11Info::appRootWindow(), QPoint(0,0)); win->emit WindowClosed(id); - qDebug() << "Visible Window Closed!!!"; + //qDebug() << "Visible Window Closed!!!"; //win->deleteLater(); }else{ win = findTrayWindow(id); diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index 322e524f..6341f923 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -41,6 +41,10 @@ WId RootSubWindow::id(){ return WIN->id(); } +NativeWindow* RootSubWindow::nativeWindow(){ + return WIN; +} + // === PRIVATE === RootSubWindow::ModState RootSubWindow::getStateAtPoint(QPoint pt, bool setoffset){ //Note: pt should be in widget-relative coordinates, not global diff --git a/src-qt5/core/libLumina/RootSubWindow.h b/src-qt5/core/libLumina/RootSubWindow.h index 079a6201..0af77009 100644 --- a/src-qt5/core/libLumina/RootSubWindow.h +++ b/src-qt5/core/libLumina/RootSubWindow.h @@ -29,6 +29,7 @@ public: ~RootSubWindow(); WId id(); + NativeWindow* nativeWindow(); private: //Window status diff --git a/src-qt5/core/libLumina/RootWindow-mgmt.cpp b/src-qt5/core/libLumina/RootWindow-mgmt.cpp index e00ce9ce..00b3e336 100644 --- a/src-qt5/core/libLumina/RootWindow-mgmt.cpp +++ b/src-qt5/core/libLumina/RootWindow-mgmt.cpp @@ -19,16 +19,31 @@ void RootWindow::arrangeWindows(RootSubWindow *primary, QString type){ // ================ // Public slots for starting the arrangement routine(s) above // ================ -void RootWindow::ArrangeWindows(WId *primary, QString type){ - +void RootWindow::ArrangeWindows(WId primary, QString type){ + RootSubWindow* win = windowForId(primary); + if(type.isEmpty()){ type = ""; } //grab the default arrangement format + arrangeWindows(win, type); } -void RootWindow::TileWindows(WId *primary, QString type){ - +void RootWindow::TileWindows(WId primary, QString type){ + RootSubWindow* win = windowForId(primary); + if(type.isEmpty()){ type = ""; } //grab the default arrangement format for tiling + arrangeWindows(win, type); } -void RootWindow::CheckWindowPosition(WId, bool newwindow){ +void RootWindow::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 - + RootSubWindow* win = windowForId(id); + if(win==0){ return; } //invalid window + QRect geom = win->nativeWindow()->geometry(); + bool changed = false; + //Make sure it is on the screen (quick check) + if(geom.x() < 0){ changed = true; geom.moveLeft(0); } + if(geom.y() < 0){ changed = true; geom.moveTop(0); } + if(geom.width() < 20){ changed = true; geom.setWidth(100); } + if(geom.height() < 20){ changed = true; geom.setHeight(100); } + if(changed){ win->setGeometry(geom); } + //Now run it through the window arrangement routine + ArrangeWindows(id); } diff --git a/src-qt5/core/libLumina/RootWindow.cpp b/src-qt5/core/libLumina/RootWindow.cpp index 596755df..48c37c86 100644 --- a/src-qt5/core/libLumina/RootWindow.cpp +++ b/src-qt5/core/libLumina/RootWindow.cpp @@ -100,6 +100,14 @@ void RootWindow::updateScreenPixmap(screeninfo *info){ info->wallpaper = pix; } +RootSubWindow* RootWindow::windowForId(WId id){ + RootSubWindow *tmp = 0; + for(int i=0; i<WINDOWS.length() && tmp==0; i++){ + if(WINDOWS[i]->id() == id){ tmp = WINDOWS[i]; } + } + return tmp; +} + // === PUBLIC SLOTS === void RootWindow::ResizeRoot(){ if(DEBUG){ qDebug() << "Resize Root..."; } @@ -202,6 +210,7 @@ void RootWindow::CloseWindow(WId win){ // === PROTECTED === void RootWindow::paintEvent(QPaintEvent *ev){ //qDebug() << "RootWindow: PaintEvent:" << ev->rect(); //<< QDateTime::currentDateTime()->toString(QDateTime::ShortDate); + QWidget::paintEvent(ev); bool found = false; QPainter painter(this); QRect geom = ev->rect(); @@ -214,7 +223,7 @@ void RootWindow::paintEvent(QPaintEvent *ev){ } } painter.end(); - if(!found){ + /*if(!found){ QWidget::paintEvent(ev); - } + }*/ } diff --git a/src-qt5/core/libLumina/RootWindow.h b/src-qt5/core/libLumina/RootWindow.h index 2fd76cea..9b1334dc 100644 --- a/src-qt5/core/libLumina/RootWindow.h +++ b/src-qt5/core/libLumina/RootWindow.h @@ -50,6 +50,7 @@ private: //Window Management QList<RootSubWindow*> WINDOWS; + RootSubWindow* windowForId(WId id); void arrangeWindows(RootSubWindow *primary = 0, QString type = ""); public slots: @@ -61,8 +62,8 @@ public slots: void CloseWindow(WId); //automatically connected for any new native window //Window arrangement functions - defined in "RootWindow-mgmt.cpp" - void ArrangeWindows(WId *primary = 0, QString type = ""); - void TileWindows(WId *primary = 0, QString type = ""); + void ArrangeWindows(WId primary = 0, QString type = ""); + void TileWindows(WId primary = 0, QString type = ""); void CheckWindowPosition(WId, bool newwindow = false); //used after a "drop" to validate/snap/re-arrange window(s) as needed private slots: |