This is an automated email from the git hooks/post-receive script. x2go pushed a change to branch feature/rootless-mode in repository x2gokdriveclient. from 27ab44d Improved display image updates. new 1437664 Repaint windows after changing number of windows or stack order. The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: client.cpp | 47 +++++++++++++++++++++++++---------------------- client.h | 4 ++-- displayarea.cpp | 8 +++++--- extwin.cpp | 13 ++++++++++++- extwin.h | 4 ++-- menuframe.cpp | 1 - 6 files changed, 46 insertions(+), 31 deletions(-) -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gokdriveclient.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch feature/rootless-mode in repository x2gokdriveclient. commit 1437664961e8d2dd33e440616ce7d3fc707c8173 Author: Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> Date: Tue Feb 15 12:05:09 2022 -0600 Repaint windows after changing number of windows or stack order. --- client.cpp | 47 +++++++++++++++++++++++++---------------------- client.h | 4 ++-- displayarea.cpp | 8 +++++--- extwin.cpp | 13 ++++++++++++- extwin.h | 4 ++-- menuframe.cpp | 1 - 6 files changed, 46 insertions(+), 31 deletions(-) diff --git a/client.cpp b/client.cpp index 34041bc..874eb4b 100644 --- a/client.cpp +++ b/client.cpp @@ -714,11 +714,6 @@ QPixmap Client::getPixmapFromCache(uint32_t crc) return frameCache[crc]; } -void Client::saveDispImage(QString path) -{ - displayImage.save(path); -} - void Client::renderFrame() { QPainter dispImagePainter; @@ -823,10 +818,11 @@ void Client::renderFrame() } } setUptodate(); + setDisplayImage(); +} - -//////put another func if works - +void Client::setDisplayImage() +{ Frame* currentFrame=this->getCurrentFrame(); QPixmap pix; if(!currentFrame->crc) @@ -1120,10 +1116,18 @@ ExtWin* Client::findExtWinById(uint32_t extWinId) return NULL; } +void Client::repaintAllWindows() +{ + foreach(ExtWin* w, extWindows) + { + QTimer::singleShot(10, w->getDisplayArea(), SLOT(repaint())); + } +} + void Client::getWinUpdateBuffer() { //process window updates from messageBuffer - KDRStdErr()<<"get winupdate buffer size: "<<winUpdateSize<<KDR_ENDL; +// KDRStdErr()<<"get winupdate buffer size: "<<winUpdateSize<<KDR_ENDL; int readFromBuf=0; while(readFromBuf < winUpdateSize) { @@ -1145,10 +1149,11 @@ void Client::getWinUpdateBuffer() } if(state==3) { - KDRStdErr()<<"win deleted: "<<KDR_HEX<<extWinId<<KDR_ENDL; +// KDRStdErr()<<"win deleted: "<<KDR_HEX<<extWinId<<KDR_ENDL; extWindows.removeAll(win); win->close(); delete win; + repaintAllWindows(); } else { @@ -1217,15 +1222,15 @@ void Client::getWinUpdateBuffer() Qt::WindowFlags flags; switch(winType) { - case WINDOW_TYPE_UTILITY: case WINDOW_TYPE_DIALOG: winType=WINDOW_TYPE_DIALOG; flags=Qt::Dialog; - KDRStdErr()<<"new win: "<<KDR_HEX<<extWinId<<" Setting dialog flags"; +// KDRStdErr()<<"new win: "<<KDR_HEX<<extWinId<<" Setting dialog flags"; break; case WINDOW_TYPE_SPLASH: flags=Qt::SplashScreen; break; + case WINDOW_TYPE_UTILITY: case WINDOW_TYPE_COMBO: case WINDOW_TYPE_POPUP_MENU: case WINDOW_TYPE_DROPDOWN_MENU: @@ -1237,17 +1242,17 @@ void Client::getWinUpdateBuffer() default:flags=Qt::Window ; } - KDRStdErr()<<"new win: "<<KDR_HEX<<extWinId; +// KDRStdErr()<<"new win: "<<KDR_HEX<<extWinId; if(parId==0) { - KDRStdErr()<<"win is top window: "<<KDR_HEX<<parId; +// KDRStdErr()<<"win is top window: "<<KDR_HEX<<parId; win=new ExtWin(extWinId,this, 0, flags); win->setParent(0); } else { ExtWin* parentWin=findExtWinById(parId); - KDRStdErr()<<"win has parent!!!!!: "<<KDR_HEX<<parId; +// KDRStdErr()<<"win has parent!!!!!: "<<KDR_HEX<<parId; if(!parentWin) { KDRStdErr()<<"parent Win not found in list: "<<KDR_HEX<<parId; @@ -1261,11 +1266,11 @@ void Client::getWinUpdateBuffer() ExtWin* transWin=findExtWinById(transWinId); if(!transWin) { - KDRStdErr()<<"trans Win not found in list: "<<KDR_HEX<<transWinId; +// KDRStdErr()<<"trans Win not found in list: "<<KDR_HEX<<transWinId; } else { - KDRStdErr()<<"trans Window: "<<KDR_HEX<<transWinId; +// KDRStdErr()<<"trans Window: "<<KDR_HEX<<transWinId<<" me: "<<extWinId<<KDR_ENDL; // win->setParent(transWin); win->setTransWinId(transWinId); if(winType==WINDOW_TYPE_DIALOG) @@ -1293,13 +1298,14 @@ void Client::getWinUpdateBuffer() win->showNormal(); win->raise(); win->activateWindow(); + repaintAllWindows(); if(!icon.isNull()) { win->setWindowIcon(icon); } // win->update(); } - KDRStdErr()<<KDR_DEC<<name<<" "<<x<<":"<<y<<" "<<w<<"x"<<h<<" min size: "<<minw<<"x"<<minh<<" bw - "<<bw<<" "<<visibility<<KDR_ENDL; +// KDRStdErr()<<KDR_DEC<<name<<" "<<x<<":"<<y<<" "<<w<<"x"<<h<<" min size: "<<minw<<"x"<<minh<<" bw - "<<bw<<" "<<visibility<<KDR_ENDL; if(win->geometry().width() != w || win->geometry().height() != h) win->resize(w,h); if(win->geometry().x()!=x || win->geometry().y()!=y) @@ -1309,17 +1315,15 @@ void Client::getWinUpdateBuffer() // win->raise(); if(win->getParentId()!=parId) { - #warning inplement this //set new parent and remap window win->setParentId(parId); KDRStdErr()<<"Reparent window"; } if(win->getNextSibId()!=nextSibId) { - #warning inplement this // set sib and restack windows win->setNextSibId(nextSibId); - KDRStdErr()<<"Check if need to Restack window???"; +// KDRStdErr()<<"Check if need to Restack window???"; } } } @@ -2050,7 +2054,6 @@ void Client::send_selnotify_to_server(SelectionType selection, SelectionMime mim } - void Client::slotSelectionChanged(QClipboard::Mode mode) { diff --git a/client.h b/client.h index b9c544a..6383c5d 100644 --- a/client.h +++ b/client.h @@ -200,11 +200,10 @@ public: const QList<ExtWin*> getSiblings(ExtWin* win); ExtWin* findExtWinById(uint32_t extWinId); QImage* getDisplayImage(){return &displayImage;} + void repaintAllWindows(); public slots: void sendOutputSelChunk(); - void saveDispImage(QString path="/tmp/dispPin.png"); - private slots: void sendClientVersion(); @@ -266,6 +265,7 @@ private: void setFS(int screenNumber); void reinitCaches(); void initGeometry(); + void setDisplayImage(); bool wantRepaint=false; bool hasUpdates=false; #ifndef Q_OS_LINUX diff --git a/displayarea.cpp b/displayarea.cpp index 9b913ea..598996e 100644 --- a/displayarea.cpp +++ b/displayarea.cpp @@ -173,12 +173,14 @@ void DisplayArea::paintEvent(QPaintEvent* ev) { if(!client->isRootless()) { -// Client::KDRStdErr()<<"WM update: "<<Client::QRectToStr(ev->rect())<<KDR_ENDL; - painter.drawImage(ev->rect(),*(client->getDisplayImage()),ev->rect()); + Client::KDRStdErr()<<"WM update: "<<Client::QRectToStr(ev->rect())<<KDR_ENDL; + painter.drawImage(ev->rect(),*(client->getDisplayImage()),ev->rect()); } else { - painter.drawImage(ev->rect().x(),ev->rect().y(), +// if(((ExtWin*)parentWidget)->getWindowType()==WINDOW_TYPE_NORMAL) +// Client::KDRStdErr()<<"WM update: "<<Client::QRectToStr(ev->rect())<<KDR_ENDL; + painter.drawImage(ev->rect().x(),ev->rect().y(), *(client->getDisplayImage()), ev->rect().x()+((ExtWin*)parentWidget)->adjustGeometry().x(), ev->rect().y()+((ExtWin*)parentWidget)->adjustGeometry().y(), ev->rect().width(), ev->rect().height()); } diff --git a/extwin.cpp b/extwin.cpp index 4fe46d9..98204de 100644 --- a/extwin.cpp +++ b/extwin.cpp @@ -346,6 +346,7 @@ void ExtWin::slotCheckStackOrder() return ; } Client::KDRStdErr()<<"Need to restack "<<KDR_HEX<<extWinId<<" Above "<<newNextSib<<KDR_ENDL; + client->repaintAllWindows(); nextSibId=newNextSib; client->changeWindow(this); } @@ -444,13 +445,23 @@ bool ExtWin::nativeEvent(const QByteArray &eventType, void *message, long *resul break; case WM_KILLFOCUS: slotCheckStackOrder(); -// Client::KDRStdErr()<<"FOCUS OUT "<<KDR_HEX<<extWinId<<KDR_ENDL; +// if(windowType==WINDOW_TYPE_NORMAL) + { +// Client::KDRStdErr()<<"FOCUS OUT "<<KDR_HEX<<extWinId<<KDR_ENDL; +// QTimer::singleShot(100, this, SLOT(update())); + } if(hasFocus()) { setHasFocus(false); client->changeWindow(this); } break; + case WM_PAINT: + if(windowType==WINDOW_TYPE_NORMAL) + { +// Client::KDRStdErr()<<"WM PAINT EVENT: "<<KDR_ENDL; + } + break; } } } diff --git a/extwin.h b/extwin.h index 175edd2..a82498e 100644 --- a/extwin.h +++ b/extwin.h @@ -23,8 +23,6 @@ #include <QMainWindow> #ifdef Q_OS_LINUX #include <QX11Info> -#else -#warning add code for WIN EVENTS #endif #include "client.h" @@ -42,10 +40,12 @@ public: void setParentId(uint32_t id){parentId=id;} void setTransWinId(uint32_t id){transWinId=id;} void setNextSibId(uint32_t id){nextSibId=id;} + uint8_t getWindowType(){return windowType;} void setWindowType(uint8_t tp){windowType=tp;} uint64_t getParentId(){return parentId;} uint64_t getNextSibId(){return nextSibId;} uint64_t getExtWinId(){return extWinId;} + uint32_t getTransWinId(){return transWinId;} DisplayArea* getDisplayArea(){return displayArea;} void setModality(int mod){modality=mod;} QRect adjustGeometry(); diff --git a/menuframe.cpp b/menuframe.cpp index 774b593..62018af 100644 --- a/menuframe.cpp +++ b/menuframe.cpp @@ -127,7 +127,6 @@ MenuFrame::MenuFrame(QWidget* parent, QMenu* menu):QFrame(parent) bDisc->setIcon(QIcon(":res/network-disconnect.svg")); Client* client=(Client*)parent; connect(bDisc, SIGNAL(clicked(bool)),client, SLOT(slotDisconnect())); - connect(bPin, SIGNAL(toggled(bool)), client, SLOT(saveDispImage())); bMin=new QToolButton(this); -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gokdriveclient.git