if(X11_Xfixes_FOUND)
set(FLTK_LIBRARIES ${FLTK_LIBRARIES} ${X11_Xfixes_LIB})
endif()
+ if(X11_Xcursor_FOUND)
+ set(FLTK_LIBRARIES ${FLTK_LIBRARIES} ${X11_Xcursor_LIB})
+ endif()
set(CMAKE_REQUIRED_INCLUDES ${FLTK_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${FLTK_LIBRARIES})
# FLTK STR #2641
check_cxx_source_compiles("#include <FL/Enumerations.H>\nint main(int c, char** v) { return FL_FULLSCREEN; }" HAVE_FLTK_FULLSCREEN)
+ # FLTK STR #2660
+ check_cxx_source_compiles("#include <FL/Fl_Window.H>\nint main(int c, char** v) { void (Fl_Window::*foo)(const Fl_RGB_Image*,int,int) = &Fl_Window::cursor; return 0; }" HAVE_FLTK_CURSOR)
+
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_LIBRARIES)
endif()
#cmakedefine HAVE_FLTK_CLIPBOARD
#cmakedefine HAVE_FLTK_MEDIAKEYS
#cmakedefine HAVE_FLTK_FULLSCREEN
+#cmakedefine HAVE_FLTK_CURSOR
#cmakedefine ENABLE_NLS 1
/* MS Visual Studio 2008 and newer doesn't know ssize_t */
void CConn::setCursor(int width, int height, const Point& hotspot,
void* data, void* mask)
{
-// desktop->setCursor(width, height, hotspot, data, mask);
+ desktop->setCursor(width, height, hotspot, data, mask);
}
////////////////////// Internal methods //////////////////////
}
-// Cursor stuff
-
-void DesktopWindow::setCursor(int width, int height, const Point& hotspot,
- void* data, void* mask)
-{
-}
-
-
void DesktopWindow::setName(const char *name)
{
CharArray windowNameStr;
}
+void DesktopWindow::setCursor(int width, int height, const Point& hotspot,
+ void* data, void* mask)
+{
+ viewport->setCursor(width, height, hotspot, data, mask);
+}
+
+
void DesktopWindow::resize(int x, int y, int w, int h)
{
Fl_Window::resize(x, y, w, h);
// Most efficient format (from DesktopWindow's point of view)
const rfb::PixelFormat &getPreferredPF();
- // setCursor() sets the shape of the local cursor
- void setCursor(int width, int height, const rfb::Point& hotspot,
- void* data, void* mask);
-
// Flush updates to screen
void updateWindow();
void resizeFramebuffer(int new_w, int new_h);
+ void setCursor(int width, int height, const rfb::Point& hotspot,
+ void* data, void* mask);
+
// Fl_Window callback methods
void resize(int x, int y, int w, int h);
#include "keysym2ucs.h"
using namespace rfb;
+using namespace rdr;
extern void exit_vncviewer();
extern void about_vncviewer();
Viewport::Viewport(int w, int h, const rfb::PixelFormat& serverPF, CConn* cc_)
: Fl_Widget(0, 0, w, h), cc(cc_), frameBuffer(NULL), pixelTrans(NULL),
- lastPointerPos(0, 0), lastButtonMask(0)
+ lastPointerPos(0, 0), lastButtonMask(0), cursor(NULL)
{
// FLTK STR #2599 must be fixed for proper dead keys support
#ifdef HAVE_FLTK_DEAD_KEYS
if (pixelTrans)
delete pixelTrans;
+ if (cursor) {
+ delete [] cursor->array;
+ delete cursor;
+ }
+
// FLTK automatically deletes all child widgets, so we shouldn't touch
// them ourselves here
}
}
+void Viewport::setCursor(int width, int height, const Point& hotspot,
+ void* data, void* mask)
+{
+#ifdef HAVE_FLTK_CURSOR
+ U8 *buffer = new U8[width*height*4];
+ U8 *i, *o, *m;
+ int m_width;
+
+ const PixelFormat &pf = frameBuffer->getPF();
+
+ i = (U8*)data;
+ o = buffer;
+ m = (U8*)mask;
+ m_width = (width+7)/8;
+ for (int y = 0;y < height;y++) {
+ for (int x = 0;x < width;x++) {
+ pf.rgbFromBuffer(o, i, 1, &colourMap);
+
+ if (m[(m_width*y)+(x/8)] & 0x80>>(x%8))
+ o[3] = 255;
+ else
+ o[3] = 0;
+
+ o += 4;
+ i += pf.bpp/8;
+ }
+ }
+
+ if (cursor) {
+ delete [] cursor->array;
+ delete cursor;
+ }
+
+ cursor = new Fl_RGB_Image(buffer, width, height, 4);
+
+ cursorHotspot = hotspot;
+
+ if (Fl::belowmouse() == this)
+ window()->cursor(cursor, cursorHotspot.x, cursorHotspot.y);
+#endif
+}
+
+
void Viewport::draw()
{
int X, Y, W, H;
case FL_ENTER:
// Yes, we would like some pointer events please!
+#ifdef HAVE_FLTK_CURSOR
+ window()->cursor(cursor, cursorHotspot.x, cursorHotspot.y);
+#endif
return 1;
+
+ case FL_LEAVE:
+#ifdef HAVE_FLTK_CURSOR
+ window()->cursor(FL_CURSOR_DEFAULT);
+#endif
+ return 1;
+
case FL_PUSH:
case FL_RELEASE:
case FL_DRAG:
#include <FL/Fl.H>
#include <FL/Fl_Widget.H>
#include <FL/Fl_Menu_Button.H>
+#include <FL/Fl_RGB_Image.H>
#include <rfb/Rect.h>
#include <rfb/Region.h>
damageRect(r);
}
+ void setCursor(int width, int height, const rfb::Point& hotspot,
+ void* data, void* mask);
+
// Fl_Widget callback methods
void draw();
int menuKeyCode;
Fl_Menu_Button *contextMenu;
+
+ Fl_RGB_Image *cursor;
+ rfb::Point cursorHotspot;
};
#endif