From 8a4caba3865f8c3fa7189a809283c9d4582fdfc3 Mon Sep 17 00:00:00 2001 From: Andrew Nelless Date: Fri, 17 Jun 2016 13:31:09 +0100 Subject: [PATCH] #5087 Ensure createBlankCursor() doesn't try to create 0x0 cursor XQueryBestCursor sometimes returns 0 for both width and height of the cursor pixmap. Also caused #5322 and #5068 --- src/lib/platform/XWindowsScreen.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/platform/XWindowsScreen.cpp b/src/lib/platform/XWindowsScreen.cpp index d10b7e1c..7579f66f 100644 --- a/src/lib/platform/XWindowsScreen.cpp +++ b/src/lib/platform/XWindowsScreen.cpp @@ -36,6 +36,7 @@ #include #include +#include #if X_DISPLAY_MISSING # error X11 is required to build synergy #else @@ -1661,8 +1662,10 @@ XWindowsScreen::createBlankCursor() const // this seems just a bit more complicated than really necessary // get the closet cursor size to 1x1 - unsigned int w, h; + unsigned int w = 0, h = 0; XQueryBestCursor(m_display, m_root, 1, 1, &w, &h); + w = std::max(1u, w); + h = std::max(1u, h); // make bitmap data for cursor of closet size. since the cursor // is blank we can use the same bitmap for shape and mask: all