From 3abc7d44920f72f4e9df45011347739ade4e17c4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Peter=20=C3=85strand=20=28astrand=29?= Date: Wed, 11 Oct 2017 15:12:10 +0200 Subject: [PATCH] Set the correct cursor when starting XFixes only reports cursor changes. We must manually call XFixesGetCursorImage() when starting. --- unix/x0vncserver/XDesktop.cxx | 21 +++++++++++++++------ unix/x0vncserver/XDesktop.h | 1 + 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/unix/x0vncserver/XDesktop.cxx b/unix/x0vncserver/XDesktop.cxx index c60d0813..e670a0b7 100644 --- a/unix/x0vncserver/XDesktop.cxx +++ b/unix/x0vncserver/XDesktop.cxx @@ -207,6 +207,10 @@ void XDesktop::start(VNCServer* vs) { } #endif +#ifdef HAVE_XFIXES + setCursor(); +#endif + server->setLEDState(ledState); running = true; @@ -357,7 +361,6 @@ bool XDesktop::handleGlobalEvent(XEvent* ev) { #ifdef HAVE_XFIXES } else if (ev->type == xfixesEventBase + XFixesCursorNotify) { XFixesCursorNotifyEvent* cev; - XFixesCursorImage *cim; if (!running) return true; @@ -367,6 +370,17 @@ bool XDesktop::handleGlobalEvent(XEvent* ev) { if (cev->subtype != XFixesDisplayCursorNotify) return false; + return setCursor(); +#endif + } + + return false; +} + +bool XDesktop::setCursor() +{ + XFixesCursorImage *cim; + cim = XFixesGetCursorImage(dpy); if (cim == NULL) return false; @@ -410,9 +424,4 @@ bool XDesktop::handleGlobalEvent(XEvent* ev) { delete [] cursorData; XFree(cim); return true; -#endif - } - - return false; } - diff --git a/unix/x0vncserver/XDesktop.h b/unix/x0vncserver/XDesktop.h index cc513a03..bc0648c8 100644 --- a/unix/x0vncserver/XDesktop.h +++ b/unix/x0vncserver/XDesktop.h @@ -74,6 +74,7 @@ protected: unsigned ledState; const unsigned short *codeMap; unsigned codeMapLen; + bool setCursor(); }; #endif // __XDESKTOP_H__ -- 2.39.5