diff --git a/SOURCES/tigervnc-fix-ghost-cursor-in-zaphod-mode.patch b/SOURCES/tigervnc-fix-ghost-cursor-in-zaphod-mode.patch new file mode 100644 index 0000000..5527076 --- /dev/null +++ b/SOURCES/tigervnc-fix-ghost-cursor-in-zaphod-mode.patch @@ -0,0 +1,101 @@ +diff --git a/unix/x0vncserver/XDesktop.cxx b/unix/x0vncserver/XDesktop.cxx +index f2046e43..8805be51 100644 +--- a/unix/x0vncserver/XDesktop.cxx ++++ b/unix/x0vncserver/XDesktop.cxx +@@ -80,7 +80,7 @@ XDesktop::XDesktop(Display* dpy_, Geometry *geometry_) + queryConnectDialog(0), queryConnectSock(0), + oldButtonMask(0), haveXtest(false), haveDamage(false), + maxButtons(0), running(false), ledMasks(), ledState(0), +- codeMap(0), codeMapLen(0) ++ codeMap(0), codeMapLen(0), isCursorVisibleOnScreen(false) + { + int major, minor; + +@@ -192,7 +192,7 @@ XDesktop::XDesktop(Display* dpy_, Geometry *geometry_) + RRScreenChangeNotifyMask | RRCrtcChangeNotifyMask); + /* Override TXWindow::init input mask */ + XSelectInput(dpy, DefaultRootWindow(dpy), +- PropertyChangeMask | StructureNotifyMask | ExposureMask); ++ PropertyChangeMask | StructureNotifyMask | ExposureMask | EnterWindowMask | LeaveWindowMask); + } else { + #endif + vlog.info("RANDR extension not present"); +@@ -217,11 +217,13 @@ void XDesktop::poll() { + Window root, child; + int x, y, wx, wy; + unsigned int mask; +- XQueryPointer(dpy, DefaultRootWindow(dpy), &root, &child, +- &x, &y, &wx, &wy, &mask); +- x -= geometry->offsetLeft(); +- y -= geometry->offsetTop(); +- server->setCursorPos(rfb::Point(x, y), false); ++ isCursorVisibleOnScreen = XQueryPointer(dpy, DefaultRootWindow(dpy), &root, &child, ++ &x, &y, &wx, &wy, &mask); ++ if (isCursorVisibleOnScreen) { ++ x -= geometry->offsetLeft(); ++ y -= geometry->offsetTop(); ++ server->setCursorPos(rfb::Point(x, y), false); ++ } + } + } + +@@ -253,7 +255,15 @@ void XDesktop::start(VNCServer* vs) { + #endif + + #ifdef HAVE_XFIXES +- setCursor(); ++ Window root, child; ++ int x, y, wx, wy; ++ unsigned int mask; ++ // Check whether the cursor is initially on our screen ++ isCursorVisibleOnScreen = XQueryPointer(dpy, DefaultRootWindow(dpy), &root, &child, ++ &x, &y, &wx, &wy, &mask); ++ if (isCursorVisibleOnScreen) ++ setCursor(); ++ + #endif + + server->setLEDState(ledState); +@@ -701,6 +711,9 @@ bool XDesktop::handleGlobalEvent(XEvent* ev) { + if (cev->subtype != XFixesDisplayCursorNotify) + return false; + ++ if (!isCursorVisibleOnScreen) ++ return false; ++ + return setCursor(); + #endif + #ifdef HAVE_XRANDR +@@ -753,6 +766,20 @@ bool XDesktop::handleGlobalEvent(XEvent* ev) { + + return true; + #endif ++ } else if (ev->type == EnterNotify || ev->type == LeaveNotify) { ++ XCrossingEvent* cev; ++ ++ if (!running) ++ return true; ++ ++ cev = (XCrossingEvent*)ev; ++ ++ if (cev->window != cev->root) ++ return false; ++ ++ setCursor(); ++ ++ return true; + } + + return false; +diff --git a/unix/x0vncserver/XDesktop.h b/unix/x0vncserver/XDesktop.h +index 840d4331..f01c63f7 100644 +--- a/unix/x0vncserver/XDesktop.h ++++ b/unix/x0vncserver/XDesktop.h +@@ -97,6 +97,7 @@ protected: + unsigned ledState; + const unsigned short *codeMap; + unsigned codeMapLen; ++ bool isCursorVisibleOnScreen; + bool setCursor(); + rfb::ScreenSet computeScreenLayout(); + }; diff --git a/SPECS/tigervnc.spec b/SPECS/tigervnc.spec index 13da769..8c9a978 100644 --- a/SPECS/tigervnc.spec +++ b/SPECS/tigervnc.spec @@ -5,7 +5,7 @@ Name: tigervnc Version: 1.12.0 -Release: 5%{?dist} +Release: 6%{?dist} Summary: A TigerVNC remote display system %global _hardened_build 1 @@ -34,6 +34,9 @@ Patch100: tigervnc-xserver120.patch # 1326867 - [RHEL7.3] GLX applications in an Xvnc session fails to start Patch101: 0001-rpath-hack.patch +# Upstreamable patches +Patch200: tigervnc-fix-ghost-cursor-in-zaphod-mode.patch + BuildRequires: gcc-c++ BuildRequires: libX11-devel, automake, autoconf, libtool, gettext, gettext-autopoint BuildRequires: libXext-devel, xorg-x11-server-source, libXi-devel @@ -165,6 +168,8 @@ popd %patch52 -p1 -b .root-user-selinux-context %patch53 -p1 -b .vncsession-restore-script-systemd-service +%patch200 -p1 -b .fix-ghost-cursor-in-zaphod-mode + %build %ifarch sparcv9 sparc64 s390 s390x export CFLAGS="$RPM_OPT_FLAGS -fPIC" @@ -318,6 +323,10 @@ fi %ghost %verify(not md5 size mtime) %{_sharedstatedir}/selinux/%{selinuxtype}/active/modules/200/%{modulename} %changelog +* Wed Aug 17 2022 Jan Grulich - 1.12.0-6 +- x0vncserver: fix ghost cursor in zaphod mode + Resolves: bz#2109679 + * Tue May 31 2022 Jan Grulich - 1.12.0-5 - BR: libXdamage, libXfixes, libXrandr Resolves: bz#2088733