-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FreeRDP::Rail: fix QWidge::move invalid bug
- Loading branch information
Showing
5 changed files
with
47 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,23 @@ | ||
// Author: Kang Lin <[email protected]> | ||
|
||
#include <QLoggingCategory> | ||
|
||
#include "RailManageWindows.h" | ||
#include "ConnectFreeRDP.h" | ||
|
||
#include <QLoggingCategory> | ||
#ifdef Q_OS_LINUX | ||
#include <X11/Xlib.h> | ||
Check failure on line 8 in Plugins/FreeRDP/Client/RailManageWindows.cpp GitHub Actions / android / build_android (Release, android_arm64_v8a, 6.8.1)
|
||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) | ||
#include <QX11Info> | ||
#else | ||
#include <QGuiApplication> | ||
#endif | ||
#endif | ||
|
||
#define HEX(x) QString("0x%1").arg((x), 8, 16, QLatin1Char('0')) | ||
#define WINDOW_ID(x) QString("WindowId: 0x%1").arg((x), 8, 16, QLatin1Char('0')) | ||
|
||
static Q_LOGGING_CATEGORY(log, "FreeRDP.Rail.ManageWindows") | ||
static Q_LOGGING_CATEGORY(logWin, "FreeRDP.Rail.Window") | ||
static Q_LOGGING_CATEGORY(logWin, "FreeRDP.Rail.ManageWindows.Window") | ||
|
||
CRailManageWindows::CRailManageWindows(QObject *parent) | ||
: QObject{parent} | ||
|
@@ -101,44 +109,37 @@ void CRailManageWindows::slotWindow(QSharedPointer<CRailInfo> info) | |
return; | ||
} | ||
|
||
/* Keep track of any position/size update so that we can force a refresh of the window */ | ||
if ((fieldFlags & WINDOW_ORDER_FIELD_WND_OFFSET) || | ||
(fieldFlags & WINDOW_ORDER_FIELD_WND_SIZE) || | ||
(fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_OFFSET) || | ||
(fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_SIZE) || | ||
(fieldFlags & WINDOW_ORDER_FIELD_WND_CLIENT_DELTA) || | ||
(fieldFlags & WINDOW_ORDER_FIELD_VIS_OFFSET) || | ||
(fieldFlags & WINDOW_ORDER_FIELD_VISIBILITY)) | ||
{ | ||
|
||
} | ||
|
||
/* Update Parameters */ | ||
|
||
if ((fieldFlags & WINDOW_ORDER_FIELD_WND_OFFSET) | ||
|| (fieldFlags & WINDOW_ORDER_FIELD_WND_SIZE)) | ||
{ | ||
QRect r = pWin->m_Info.m_rectWindow; | ||
if ((fieldFlags & WINDOW_ORDER_FIELD_WND_OFFSET) | ||
&& (info->m_rectWindow.topLeft() | ||
!= pWin->m_Info.m_rectWindow.topLeft())) { | ||
if (fieldFlags & WINDOW_ORDER_FIELD_WND_SIZE) { | ||
qDebug(logWin) << WINDOW_ID(info->m_OrderInfo.windowId) | ||
<< "window offset:" << info->m_rectWindow << "old:" << r; | ||
r.setTopLeft(info->m_rectWindow.topLeft()); | ||
pWin->move(r.x(), r.y()); | ||
} | ||
|
||
if ((fieldFlags & WINDOW_ORDER_FIELD_WND_SIZE) | ||
&& ((info->m_rectWindow.width() != r.width()) | ||
|| (info->m_rectWindow.height() != r.height()))) { | ||
qDebug(logWin) << WINDOW_ID(info->m_OrderInfo.windowId) | ||
<< "window size:" << info->m_rectWindow << "old:" << r; | ||
<< "window size:" << info->m_rectWindow | ||
<< "old:" << r | ||
<< "maximumSize:" << pWin->maximumSize() | ||
<< "minimumSize:" << pWin->minimumSize(); | ||
r.setWidth(info->m_rectWindow.width()); | ||
r.setHeight(info->m_rectWindow.height()); | ||
pWin->resize(r.width(), r.height()); | ||
pWin->slotSetDesktopSize(r.width(), r.height()); | ||
} | ||
|
||
if (fieldFlags & WINDOW_ORDER_FIELD_WND_OFFSET) { | ||
qDebug(logWin) << WINDOW_ID(info->m_OrderInfo.windowId) | ||
<< "window offset:" << info->m_rectWindow << "old:" << r; | ||
r.setTopLeft(info->m_rectWindow.topLeft()); | ||
|
||
/* 现在很多 linux 用 wayland 作为桌面显示,这样会出现一个问题, | ||
由于没有坐标系统,导致无边框窗体无法拖动和定位(即 QWidge::move 失效)。 | ||
(一般是 Qt6 开始强制默认优先用 wayland ,之前 Qt5 是默认有 xcb 则优先用 xcb), | ||
你需要在 main 函数最前面加一行 qputenv("QT_QPA_PLATFORM", "xcb"); | ||
*/ | ||
pWin->move(r.x(), r.y()); | ||
} | ||
|
||
pWin->m_Info.m_rectWindow = r; | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters