[X2Go-Commits] [x2gokdriveclient] 01/01: rootles mode for Windows: disable resize animation, change background of display area, don't show window content and don't send geometry events while moving/resizing.
git-admin at x2go.org
git-admin at x2go.org
Thu Jun 9 21:52:45 CEST 2022
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository x2gokdriveclient.
commit fd71678c3416f1b262e104aa6005d84b0a557664
Author: Oleksandr Shneyder <o.shneyder at phoca-gmbh.de>
Date: Thu Jun 9 14:52:28 2022 -0500
rootles mode for Windows: disable resize animation, change background of display area, don't show window content and don't send geometry events while moving/resizing.
---
client.cpp | 2 +-
debian/changelog | 3 +++
extwin.cpp | 56 ++++++++++++++++++++++++++++++++++++++++++++++------
extwin.h | 3 +++
x2gokdriveclient.pro | 5 +++++
5 files changed, 62 insertions(+), 7 deletions(-)
diff --git a/client.cpp b/client.cpp
index d605de5..dbf1a9e 100644
--- a/client.cpp
+++ b/client.cpp
@@ -1945,7 +1945,7 @@ void Client::changeWindow(ExtWin* win, uint8_t newState)
w=win->geometry().width();
h=win->geometry().height();
etype=WINCHANGE;
-// KDRStdErr()<<"win pos "<<x<<":"<<y<<KDR_ENDL;
+// KDRStdErr()<<"win geom "<<w<<"x"<<h<<KDR_ENDL;
memcpy(evmsg,(char*)&etype,4);
memcpy(evmsg+4,(char*)&extWinId,4);
memcpy(evmsg+8,(char*)&sibId,4);
diff --git a/debian/changelog b/debian/changelog
index b096f7d..6df6a0d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -52,5 +52,8 @@ x2gokdriveclient (0.0.0.1-0x2go1) UNRELEASED; urgency=medium
- rootless mode: if updated window not found, considering it as a new one.
- rootless mode: update window on focus events.
- normal mode: update window on focus events (MS Windows).
+ - rootles mode for Windows: disable resize animation,
+ change background of display area,
+ don't show window content and don't send geometry events while moving/resizing.
-- Mike Gabriel <mike.gabriel at das-netzwerkteam.de> Tue, 04 Jun 2019 11:10:43 +0200
diff --git a/extwin.cpp b/extwin.cpp
index bfd1ffe..a529462 100644
--- a/extwin.cpp
+++ b/extwin.cpp
@@ -24,8 +24,9 @@
#include <QTimer>
#include <QCloseEvent>
#include <QScreen>
-
-
+#ifdef Q_OS_WIN
+#include <dwmapi.h>
+#endif
ExtWin::ExtWin(uint32_t extWinId, Client *client, QWidget* parent, uint8_t wt, Qt::WindowFlags flags): QMainWindow(parent, flags)
{
changeTimer=new QTimer(this);
@@ -33,7 +34,7 @@ ExtWin::ExtWin(uint32_t extWinId, Client *client, QWidget* parent, uint8_t wt, Q
connect(changeTimer, SIGNAL(timeout()), this, SLOT(slotChangeWin()));
displayArea=new DisplayArea((Client*)client,this);
displayArea->setObjectName("DisplayArea");
- displayArea->setStyleSheet("QFrame#DisplayArea{background-color:black;}");
+// displayArea->setStyleSheet("QFrame#DisplayArea{background-color:black;}");
displayArea->show();
setCentralWidget(displayArea);
setWindowIcon(QIcon(":res/x2goclient.png"));
@@ -43,6 +44,8 @@ ExtWin::ExtWin(uint32_t extWinId, Client *client, QWidget* parent, uint8_t wt, Q
#ifdef Q_OS_WIN
if((windowType!=WINDOW_TYPE_NORMAL) && (windowType!=WINDOW_TYPE_DIALOG))
QTimer::singleShot(10,this,SLOT(slotSetTaskbar()));
+ else
+ QTimer::singleShot(10,this,SLOT(slotSetWinWindow()));
#endif
#ifdef Q_OS_LINUX
switch(windowType)
@@ -79,6 +82,16 @@ void ExtWin::slotSetTaskbar()
SetWindowLong(hWnd, GWL_EXSTYLE, style);
}
}
+
+void ExtWin::slotSetWinWindow()
+{
+ HWND hWnd=(HWND)winId();
+ BOOL fDisable = TRUE;
+ DwmSetWindowAttribute(hWnd,
+ DWMWA_TRANSITIONS_FORCEDISABLED,
+ &fDisable,
+ sizeof(fDisable));
+}
#endif
void ExtWin::setWinSize(int w, int h)
@@ -101,9 +114,13 @@ void ExtWin::slotChangeWin()
void ExtWin::moveEvent(QMoveEvent* ev)
{
- if(((windowType == WINDOW_TYPE_NORMAL)||(windowType == WINDOW_TYPE_DIALOG))&&(!ignoreGeometryChangeEvent))
+ if(((windowType == WINDOW_TYPE_NORMAL)||(windowType == WINDOW_TYPE_DIALOG))&&(!ignoreGeometryChangeEvent && ! isChanging))
{
+#ifdef Q_OS_WIN
+ slotChangeWin();
+#else
changeTimer->start(50);
+#endif
}
QMainWindow::moveEvent(ev);
}
@@ -120,9 +137,17 @@ void ExtWin::closeEvent(QCloseEvent* ev)
void ExtWin::resizeEvent(QResizeEvent* ev)
{
- if((windowType == WINDOW_TYPE_NORMAL)||(windowType == WINDOW_TYPE_DIALOG))
+ if(((windowType == WINDOW_TYPE_NORMAL)||(windowType == WINDOW_TYPE_DIALOG))&&!isChanging)
{
- slotChangeWin();
+#ifdef Q_OS_WIN
+ displayArea->hide();
+ setWindowOpacity(0.2);
+#endif
+ slotChangeWin();
+ slotChangeWin();
+#ifdef Q_OS_WIN
+ QTimer::singleShot(200, this, SLOT(slotRestoreWin()));
+#endif
}
QMainWindow::resizeEvent(ev);
}
@@ -420,6 +445,14 @@ bool ExtWin::checkModality(QList<ExtWin*> &siblings)
return mod_res;
}
+#ifdef Q_OS_WIN
+void ExtWin::slotRestoreWin()
+{
+ displayArea->show();
+ setWindowOpacity(1);
+}
+#endif
+
bool ExtWin::nativeEvent(const QByteArray &eventType, void *message, long *result)
{
#ifdef Q_OS_LINUX
@@ -460,6 +493,17 @@ bool ExtWin::nativeEvent(const QByteArray &eventType, void *message, long *resul
MSG* ev = static_cast<MSG *>(message);
switch((ev->message))
{
+ case WM_ENTERSIZEMOVE:
+ isChanging=true;
+ displayArea->hide();
+ setWindowOpacity(0.2);
+ break;
+ case WM_EXITSIZEMOVE:
+ isChanging=false;
+ slotChangeWin();
+ QTimer::singleShot(10, this, SLOT(slotChangeWin()));
+ QTimer::singleShot(200, this, SLOT(slotRestoreWin()));
+ break;
case WM_SETFOCUS:
slotCheckStackOrder();
// Client::KDRStdErr()<<"FOCUS IN "<<KDR_HEX<<extWinId<<KDR_ENDL;
diff --git a/extwin.h b/extwin.h
index a0f6bdd..ab96a1b 100644
--- a/extwin.h
+++ b/extwin.h
@@ -78,6 +78,7 @@ private:
int modality=MOD_NONE;
bool focus=0;
bool ignoreGeometryChangeEvent=false;
+ bool isChanging=false;
QTimer* changeTimer;
private slots:
@@ -85,6 +86,8 @@ private slots:
void slotCheckStackOrder();
#ifdef Q_OS_WIN
void slotSetTaskbar();
+ void slotSetWinWindow();
+ void slotRestoreWin();
#endif
protected:
void closeEvent(QCloseEvent*);
diff --git a/x2gokdriveclient.pro b/x2gokdriveclient.pro
index 903bf63..6ef1844 100644
--- a/x2gokdriveclient.pro
+++ b/x2gokdriveclient.pro
@@ -28,4 +28,9 @@ SOURCES += xcbclip.cpp
HEADERS += xcbclip.h
}
+windows {
+message("Building for Windows")
+LIBS += -ldwmapi
+}
+
LIBS += -lz
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gokdriveclient.git
More information about the x2go-commits
mailing list