diff --git a/ChangeLog b/ChangeLog index 9545de360..7098dd5c8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,14 +9,16 @@ Bug fixes: - #6670 Build computers failing with language file error - #6661 Removed deprecated namespace in gtest/gmock by updating - #6601 Update man page with missing crypto option +- #4036 Client cursor constrained to old resolution Enhancements: -- #6666 Add doxygen documentation output from piplines +- #6666 Add doxygen documentation output from pipelines - #6674 Debian 10 X11 build for CI - #6714 Added windows core binaries upload to sandor - #6715 Updated language file from Crowdin - #6688 Fully migrate CI from Jenkins to Azure Pipelines - #6718 Action to test PR's for updated changelog +- #6722 Allow servers to be announced by screen name instead of IP - #6720 Add macqtdeploy to cmake Features: diff --git a/src/gui/src/ZeroconfService.cpp b/src/gui/src/ZeroconfService.cpp index eff56aef8..461ac1392 100644 --- a/src/gui/src/ZeroconfService.cpp +++ b/src/gui/src/ZeroconfService.cpp @@ -101,27 +101,6 @@ void ZeroconfService::errorHandle(DNSServiceErrorType errorCode) tr("Error code: %1.").arg(errorCode)); } -QString ZeroconfService::getLocalIPAddresses() -{ - QStringList addresses; - foreach (const QHostAddress& address, QNetworkInterface::allAddresses()) { - if (address.protocol() == QAbstractSocket::IPv4Protocol && - address != QHostAddress(QHostAddress::LocalHost)) { - addresses.append(address.toString()); - } - } - - foreach (const QString& preferedIP, preferedIPAddress) { - foreach (const QString& address, addresses) { - if (address.startsWith(preferedIP)) { - return address; - } - } - } - - return ""; -} - bool ZeroconfService::registerService(bool server) { bool result = true; @@ -137,20 +116,10 @@ bool ZeroconfService::registerService(bool server) else { m_pZeroconfRegister = new ZeroconfRegister(this); if (server) { - QString localIP = getLocalIPAddresses(); - if (localIP.isEmpty()) { - QMessageBox::warning( - m_pMainWindow, tr("Synergy Auto Config"), - tr("Failed to get local IP address. " - "Please manually type in server address " - "on your clients")); - } - else { - m_pZeroconfRegister->registerService( - ZeroconfRecord(tr("%1").arg(localIP), - QLatin1String(m_ServerServiceName), QString()), - m_zeroconfServer.serverPort()); - } + m_pZeroconfRegister->registerService( + ZeroconfRecord(tr("%1").arg(m_pMainWindow->getScreenName()), + QLatin1String(m_ServerServiceName), QString()), + m_zeroconfServer.serverPort()); } else { m_pZeroconfRegister->registerService( diff --git a/src/gui/src/ZeroconfService.h b/src/gui/src/ZeroconfService.h index 17fe3bf7e..d77125323 100644 --- a/src/gui/src/ZeroconfService.h +++ b/src/gui/src/ZeroconfService.h @@ -42,7 +42,6 @@ private slots: void errorHandle(DNSServiceErrorType errorCode); private: - QString getLocalIPAddresses(); bool registerService(bool server); private: diff --git a/src/lib/platform/XWindowsScreen.cpp b/src/lib/platform/XWindowsScreen.cpp index 6a0d72bfc..84035d4f6 100644 --- a/src/lib/platform/XWindowsScreen.cpp +++ b/src/lib/platform/XWindowsScreen.cpp @@ -1011,6 +1011,53 @@ XWindowsScreen::saveShape() #endif } +void +XWindowsScreen::setShape(SInt32 width, SInt32 height) +{ + // set shape + m_x = 0; + m_y = 0; + + m_w = width; + m_h = height; + + // get center of default screen + m_xCenter = m_x + (m_w >> 1); + m_yCenter = m_y + (m_h >> 1); + + // check if xinerama is enabled and there is more than one screen. + // get center of first Xinerama screen. Xinerama appears to have + // a bug when XWarpPointer() is used in combination with + // XGrabPointer(). in that case, the warp is successful but the + // next pointer motion warps the pointer again, apparently to + // constrain it to some unknown region, possibly the region from + // 0,0 to Wm,Hm where Wm (Hm) is the minimum width (height) over + // all physical screens. this warp only seems to happen if the + // pointer wasn't in that region before the XWarpPointer(). the + // second (unexpected) warp causes synergy to think the pointer + // has been moved when it hasn't. to work around the problem, + // we warp the pointer to the center of the first physical + // screen instead of the logical screen. + m_xinerama = false; +#if HAVE_X11_EXTENSIONS_XINERAMA_H + int eventBase, errorBase; + if ((XineramaQueryExtension(m_display, &eventBase, &errorBase) != 0) && + (XineramaIsActive(m_display) != 0)) { + int numScreens; + XineramaScreenInfo* screens; + screens = XineramaQueryScreens(m_display, &numScreens); + if (screens != nullptr) { + if (numScreens > 1) { + m_xinerama = true; + m_xCenter = screens[0].x_org + (screens[0].width >> 1); + m_yCenter = screens[0].y_org + (screens[0].height >> 1); + } + XFree(screens); + } + } +#endif +} + Window XWindowsScreen::openWindow() const { @@ -1124,6 +1171,9 @@ XWindowsScreen::openIM() XWindowAttributes attr; XGetWindowAttributes(m_display, m_window, &attr); XSelectInput(m_display, m_window, attr.your_event_mask | mask); + + // listen for screen-resize messages + XSelectInput (m_display, m_root, StructureNotifyMask); } void @@ -1386,6 +1436,13 @@ XWindowsScreen::handleSystemEvent(const Event& event, void*) } return; + case ConfigureNotify: + if (!m_isPrimary && xevent->xconfigure.window == m_root) { + setShape(xevent->xconfigure.width, xevent->xconfigure.height); + sendEvent(m_events->forIScreen().shapeChanged()); + } + return; + default: #if HAVE_XKB_EXTENSION if (m_xkb && xevent->type == m_xkbEventBase) { diff --git a/src/lib/platform/XWindowsScreen.h b/src/lib/platform/XWindowsScreen.h index 895244906..e0be16ec8 100644 --- a/src/lib/platform/XWindowsScreen.h +++ b/src/lib/platform/XWindowsScreen.h @@ -125,6 +125,7 @@ private: Display* openDisplay(const char* displayName); void saveShape(); + void setShape(SInt32 width, SInt32 height); Window openWindow() const; void openIM();