summaryrefslogtreecommitdiffstats
path: root/vncviewer/Viewport.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vncviewer/Viewport.cxx')
-rw-r--r--vncviewer/Viewport.cxx32
1 files changed, 25 insertions, 7 deletions
diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx
index a7296e9a..a930cf89 100644
--- a/vncviewer/Viewport.cxx
+++ b/vncviewer/Viewport.cxx
@@ -51,6 +51,9 @@
#include "menukey.h"
#include "vncviewer.h"
+#include "PlatformPixelBuffer.h"
+#include "FLTKPixelBuffer.h"
+
#if defined(WIN32)
#include "Win32PixelBuffer.h"
#elif defined(__APPLE__)
@@ -59,11 +62,6 @@
#include "X11PixelBuffer.h"
#endif
-// We also have a generic version of the above, using pure FLTK:
-//
-// #include "PlatformPixelBuffer.h"
-//
-
#include <FL/fl_draw.H>
#include <FL/fl_ask.H>
@@ -100,7 +98,7 @@ Viewport::Viewport(int w, int h, const rfb::PixelFormat& serverPF, CConn* cc_)
Fl::add_clipboard_notify(handleClipboardChange, this);
#endif
- frameBuffer = new PlatformPixelBuffer(w, h);
+ frameBuffer = createFramebuffer(w, h);
assert(frameBuffer);
setServerPF(serverPF);
@@ -358,7 +356,7 @@ void Viewport::resize(int x, int y, int w, int h)
vlog.debug("Resizing framebuffer from %dx%d to %dx%d",
frameBuffer->width(), frameBuffer->height(), w, h);
- newBuffer = new PlatformPixelBuffer(w, h);
+ newBuffer = createFramebuffer(w, h);
assert(newBuffer);
rect.setXYWH(0, 0,
@@ -500,6 +498,26 @@ int Viewport::handle(int event)
}
+PlatformPixelBuffer* Viewport::createFramebuffer(int w, int h)
+{
+ PlatformPixelBuffer *fb;
+
+ try {
+#if defined(WIN32)
+ fb = new Win32PixelBuffer(w, h);
+#elif defined(__APPLE__)
+ fb = new OSXPixelBuffer(w, h);
+#else
+ fb = new X11PixelBuffer(w, h);
+#endif
+ } catch (rdr::Exception& e) {
+ fb = new FLTKPixelBuffer(w, h);
+ }
+
+ return fb;
+}
+
+
void Viewport::handleUpdateTimeout(void *data)
{
Viewport *self = (Viewport *)data;