Commit 2d21588c authored by David Thompson's avatar David Thompson Committed by Kitware Robot

Merge topic 'cursory-fix'

533cac7f Allow X11::Xcursor to be absent.
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Ben Boeckel's avatarBen Boeckel <ben.boeckel@kitware.com>
Merge-request: !7354
parents d14d15da 533cac7f
......@@ -350,12 +350,19 @@ vtk_module_link(VTK::RenderingOpenGL2
endif ()
if (VTK_USE_X)
vtk_module_find_package(
PACKAGE X11)
vtk_module_link(VTK::RenderingOpenGL2
PUBLIC
X11::X11
X11::Xcursor)
vtk_module_find_package(PACKAGE X11)
vtk_module_link(VTK::RenderingOpenGL2 PUBLIC X11::X11)
if (X11_Xcursor_FOUND)
vtk_module_link(VTK::RenderingOpenGL2 PRIVATE X11::Xcursor)
set(_have_xcursor 1)
else()
message(WARNING "X11::Xcursor not found; custom cursors will be ignored.")
set(_have_xcursor 0)
endif()
set_property(SOURCE vtkXOpenGLRenderWindow.cxx APPEND
PROPERTY
COMPILE_DEFINITIONS "VTK_HAVE_XCURSOR=${_have_xcursor}"
)
elseif (VTK_USE_COCOA)
vtk_module_link(VTK::RenderingOpenGL2 PUBLIC "-framework Cocoa")
endif ()
......
......@@ -63,7 +63,9 @@ typedef ptrdiff_t GLsizeiptr;
#include <sstream>
#include <X11/Xatom.h>
#if VTK_HAVE_XCURSOR
#include <X11/Xcursor/Xcursor.h>
#endif
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/cursorfont.h>
......@@ -1711,6 +1713,7 @@ void vtkXOpenGLRenderWindow::SetCurrentCursor(int shape)
XDefineCursor(this->DisplayId, this->WindowId, this->XCHand);
break;
case VTK_CURSOR_CUSTOM:
#if VTK_HAVE_XCURSOR
this->XCCustom = XcursorFilenameLoadCursor(this->DisplayId, this->GetCursorFileName());
if (!this->XCCustom)
{
......@@ -1718,6 +1721,16 @@ void vtkXOpenGLRenderWindow::SetCurrentCursor(int shape)
break;
}
XDefineCursor(this->DisplayId, this->WindowId, this->XCCustom);
#else
{
static bool once = false;
if (!once)
{
once = true;
vtkWarningMacro("VTK built without Xcursor support; ignoring requests for custom cursors.");
}
}
#endif
break;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment