拼接屏2

This commit is contained in:
韩品龙 2024-03-16 15:07:48 +08:00
parent 024568914a
commit f94eb54e82
1 changed files with 14 additions and 8 deletions

View File

@ -536,6 +536,7 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, QXcbVirtualDesktop *virtualDe
, m_crtc(output ? output->crtc : XCB_NONE)
, m_outputName(getOutputName(output))
, m_outputSizeMillimeters(output ? QSize(output->mm_width, output->mm_height) : QSize())
, m_cursor(std::make_unique<QXcbCursor>(connection, this))
{
// if (connection->hasXRandr()) {
if (connection->isAtLeastXRandR12()) {
@ -564,7 +565,7 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, QXcbVirtualDesktop *virtualDe
if (m_sizeMillimeters.isEmpty())
m_sizeMillimeters = virtualDesktop->physicalSize();
m_cursor = new QXcbCursor(connection, this);
// m_cursor = new QXcbCursor(connection, this);
// if (connection->hasXRandr()) { // Parse EDID
if (connection->isAtLeastXRandR12()) { // Parse EDID
@ -592,6 +593,7 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, QXcbVirtualDesktop *virtualDe
: QXcbObject(connection)
, m_virtualDesktop(virtualDesktop)
, m_monitor(monitorInfo)
, m_cursor(std::make_unique<QXcbCursor>(connection, this))
{
setMonitor(monitorInfo, timestamp);
}
@ -649,9 +651,9 @@ void QXcbScreen::setMonitor(xcb_randr_monitor_info_t *monitorInfo, xcb_timestamp
m_singlescreen = (monitorGeometry == (QRect(crtc->x, crtc->y, crtc->width, crtc->height)));
if (m_singlescreen) {
if (crtc->mode) {
if (crtc->rotation == XCB_RANDR_ROTATION_ROTATE_90 ||
crtc->rotation == XCB_RANDR_ROTATION_ROTATE_270)
std::swap(crtc->width, crtc->height);
// if (crtc->rotation == XCB_RANDR_ROTATION_ROTATE_90 ||
// crtc->rotation == XCB_RANDR_ROTATION_ROTATE_270)
// std::swap(crtc->width, crtc->height);
updateGeometry(QRect(crtc->x, crtc->y, crtc->width, crtc->height), crtc->rotation);
if (mode() != crtc->mode)
updateRefreshRate(crtc->mode);
@ -675,10 +677,13 @@ void QXcbScreen::setMonitor(xcb_randr_monitor_info_t *monitorInfo, xcb_timestamp
QByteArray ba = connection()->atomName(monitorInfo->name);
m_outputName = getName(monitorInfo);
if (monitorInfo->primary)
// if (monitorInfo->primary)
if (connection()->primaryScreenNumber() == virtualDesktop()->number() && monitorInfo->primary)
m_primary = true;
m_cursor = new QXcbCursor(connection(), this);
// m_cursor = new QXcbCursor(connection(), this);
else
m_primary = false;
}
@ -686,7 +691,7 @@ void QXcbScreen::setMonitor(xcb_randr_monitor_info_t *monitorInfo, xcb_timestamp
QXcbScreen::~QXcbScreen()
{
delete m_cursor;
// delete m_cursor;
}
QString QXcbScreen::getName(xcb_randr_monitor_info_t *monitorInfo)
@ -861,7 +866,8 @@ QDpi QXcbScreen::logicalDpi() const
QPlatformCursor *QXcbScreen::cursor() const
{
return m_cursor;
// return m_cursor;
return m_cursor.get();
}
void QXcbScreen::setOutput(xcb_randr_output_t outputId,