#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
This commit is contained in:
Andrew Nelless 2016-06-17 13:31:09 +01:00 committed by Jerry (Xinyu Hou)
parent 0c4746492f
commit 8a4caba386
1 changed files with 4 additions and 1 deletions

View File

@ -36,6 +36,7 @@
#include <cstring> #include <cstring>
#include <cstdlib> #include <cstdlib>
#include <algorithm>
#if X_DISPLAY_MISSING #if X_DISPLAY_MISSING
# error X11 is required to build synergy # error X11 is required to build synergy
#else #else
@ -1661,8 +1662,10 @@ XWindowsScreen::createBlankCursor() const
// this seems just a bit more complicated than really necessary // this seems just a bit more complicated than really necessary
// get the closet cursor size to 1x1 // 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); 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 // make bitmap data for cursor of closet size. since the cursor
// is blank we can use the same bitmap for shape and mask: all // is blank we can use the same bitmap for shape and mask: all