summaryrefslogtreecommitdiffstats
path: root/vncviewer
diff options
context:
space:
mode:
Diffstat (limited to 'vncviewer')
-rw-r--r--vncviewer/CConn.cxx35
-rw-r--r--vncviewer/CConn.h8
-rw-r--r--vncviewer/DesktopWindow.cxx22
-rw-r--r--vncviewer/DesktopWindow.h28
-rw-r--r--vncviewer/OptionsDialog.cxx4
-rw-r--r--vncviewer/OptionsDialog.h13
-rw-r--r--vncviewer/ServerDialog.h5
-rw-r--r--vncviewer/Viewport.cxx62
-rw-r--r--vncviewer/Viewport.h73
-rw-r--r--vncviewer/Win32PixelBuffer.h2
10 files changed, 151 insertions, 101 deletions
diff --git a/vncviewer/CConn.cxx b/vncviewer/CConn.cxx
index f97b0f4c..789cf09e 100644
--- a/vncviewer/CConn.cxx
+++ b/vncviewer/CConn.cxx
@@ -44,6 +44,7 @@
#include "CConn.h"
#include "OptionsDialog.h"
+#include "DesktopWindow.h"
#include "i18n.h"
#include "parameters.h"
#include "vncviewer.h"
@@ -88,11 +89,15 @@ CConn::CConn(const char* vncServerName, network::Socket* socket=NULL)
cp.supportsExtendedDesktopSize = true;
cp.supportsDesktopRename = true;
- cp.customCompressLevel = customCompressLevel;
- cp.compressLevel = compressLevel;
+ if (customCompressLevel)
+ cp.compressLevel = compressLevel;
+ else
+ cp.compressLevel = -1;
- cp.noJpeg = noJpeg;
- cp.qualityLevel = qualityLevel;
+ if (!noJpeg)
+ cp.qualityLevel = qualityLevel;
+ else
+ cp.qualityLevel = -1;
if(sock == NULL) {
try {
@@ -394,14 +399,17 @@ void CConn::fillRect(const rfb::Rect& r, rfb::Pixel p)
{
desktop->fillRect(r,p);
}
+
void CConn::imageRect(const rfb::Rect& r, void* p)
{
desktop->imageRect(r,p);
}
+
void CConn::copyRect(const rfb::Rect& r, int sx, int sy)
{
desktop->copyRect(r,sx,sy);
}
+
void CConn::setCursor(int width, int height, const Point& hotspot,
void* data, void* mask)
{
@@ -443,10 +451,10 @@ void CConn::fence(rdr::U32 flags, unsigned len, const char data[])
}
}
-rdr::U8* CConn::getRawPixelsRW(const rfb::Rect& r, int* stride) {
- return desktop->getPixelsRW(r, stride);
+rdr::U8* CConn::getRawBufferRW(const rfb::Rect& r, int* stride) {
+ return desktop->getBufferRW(r, stride);
}
-void CConn::releaseRawPixels(const rfb::Rect& r) {
+void CConn::releaseRawBuffer(const rfb::Rect& r) {
desktop->damageRect(r);
}
@@ -615,16 +623,19 @@ void CConn::handleOptions(void *data)
if (encNum != -1)
self->currentEncoding = encNum;
-
- self->cp.qualityLevel = qualityLevel;
}
self->cp.supportsLocalCursor = true;
- self->cp.customCompressLevel = customCompressLevel;
- self->cp.compressLevel = compressLevel;
+ if (customCompressLevel)
+ self->cp.compressLevel = compressLevel;
+ else
+ self->cp.compressLevel = -1;
- self->cp.noJpeg = noJpeg;
+ if (!noJpeg && !autoSelect)
+ self->cp.qualityLevel = qualityLevel;
+ else
+ self->cp.qualityLevel = -1;
self->encodingChange = true;
diff --git a/vncviewer/CConn.h b/vncviewer/CConn.h
index 24fbbab4..286a09ed 100644
--- a/vncviewer/CConn.h
+++ b/vncviewer/CConn.h
@@ -20,10 +20,12 @@
#ifndef __CCONN_H__
#define __CCONN_H__
+#include <FL/Fl.H>
+
#include <rfb/CConnection.h>
#include <network/Socket.h>
-#include "DesktopWindow.h"
+class DesktopWindow;
class CConn : public rfb::CConnection,
public rdr::FdInStreamBlockCallback
@@ -67,8 +69,8 @@ public:
void imageRect(const rfb::Rect& r, void* p);
void copyRect(const rfb::Rect& r, int sx, int sy);
- rdr::U8* getRawPixelsRW(const rfb::Rect& r, int* stride);
- void releaseRawPixels(const rfb::Rect& r);
+ rdr::U8* getRawBufferRW(const rfb::Rect& r, int* stride);
+ void releaseRawBuffer(const rfb::Rect& r);
const rfb::PixelFormat &getPreferredPF() { return fullColourPF; }
diff --git a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx
index 40d08ae2..2a2f8734 100644
--- a/vncviewer/DesktopWindow.cxx
+++ b/vncviewer/DesktopWindow.cxx
@@ -34,7 +34,9 @@
#include "parameters.h"
#include "vncviewer.h"
#include "CConn.h"
+#include "Viewport.h"
+#include <FL/Fl.H>
#include <FL/Fl_Scroll.H>
#include <FL/x.H>
@@ -220,6 +222,26 @@ void DesktopWindow::setColourMapEntries(int firstColour, int nColours,
viewport->setColourMapEntries(firstColour, nColours, rgbs);
}
+void DesktopWindow::fillRect(const rfb::Rect& r, rfb::Pixel pix) {
+ viewport->fillRect(r, pix);
+}
+
+void DesktopWindow::imageRect(const rfb::Rect& r, void* pixels) {
+ viewport->imageRect(r, pixels);
+}
+
+void DesktopWindow::copyRect(const rfb::Rect& r, int srcX, int srcY) {
+ viewport->copyRect(r, srcX, srcY);
+}
+
+rdr::U8* DesktopWindow::getBufferRW(const rfb::Rect& r, int* stride) {
+ return viewport->getBufferRW(r, stride);
+}
+
+void DesktopWindow::damageRect(const rfb::Rect& r) {
+ viewport->damageRect(r);
+}
+
// Copy the areas of the framebuffer that have been changed (damaged)
// to the displayed window.
diff --git a/vncviewer/DesktopWindow.h b/vncviewer/DesktopWindow.h
index 78d9bf79..06f25f55 100644
--- a/vncviewer/DesktopWindow.h
+++ b/vncviewer/DesktopWindow.h
@@ -23,13 +23,13 @@
#include <map>
#include <rfb/Rect.h>
+#include <rfb/Pixel.h>
-#include "Viewport.h"
-
-#include <FL/Fl.H>
#include <FL/Fl_Window.H>
class CConn;
+class Viewport;
+
class Fl_Scroll;
class DesktopWindow : public Fl_Window {
@@ -52,22 +52,12 @@ public:
void setColourMapEntries(int firstColour, int nColours, rdr::U16* rgbs);
- void fillRect(const rfb::Rect& r, rfb::Pixel pix) {
- viewport->fillRect(r, pix);
- }
- void imageRect(const rfb::Rect& r, void* pixels) {
- viewport->imageRect(r, pixels);
- }
- void copyRect(const rfb::Rect& r, int srcX, int srcY) {
- viewport->copyRect(r, srcX, srcY);
- }
-
- rdr::U8* getPixelsRW(const rfb::Rect& r, int* stride) {
- return viewport->getPixelsRW(r, stride);
- }
- void damageRect(const rfb::Rect& r) {
- viewport->damageRect(r);
- }
+ void fillRect(const rfb::Rect& r, rfb::Pixel pix);
+ void imageRect(const rfb::Rect& r, void* pixels);
+ void copyRect(const rfb::Rect& r, int srcX, int srcY);
+
+ rdr::U8* getBufferRW(const rfb::Rect& r, int* stride);
+ void damageRect(const rfb::Rect& r);
void resizeFramebuffer(int new_w, int new_h);
diff --git a/vncviewer/OptionsDialog.cxx b/vncviewer/OptionsDialog.cxx
index df9f3554..e21f2dd3 100644
--- a/vncviewer/OptionsDialog.cxx
+++ b/vncviewer/OptionsDialog.cxx
@@ -41,7 +41,11 @@
#include <FL/Fl_Tabs.H>
#include <FL/Fl_Button.H>
+#include <FL/Fl_Check_Button.H>
#include <FL/Fl_Return_Button.H>
+#include <FL/Fl_Round_Button.H>
+#include <FL/Fl_Int_Input.H>
+#include <FL/Fl_Choice.H>
using namespace std;
using namespace rdr;
diff --git a/vncviewer/OptionsDialog.h b/vncviewer/OptionsDialog.h
index b3ac0156..a6b504e9 100644
--- a/vncviewer/OptionsDialog.h
+++ b/vncviewer/OptionsDialog.h
@@ -22,11 +22,14 @@
#include <map>
#include <FL/Fl_Window.H>
-#include <FL/Fl_Group.H>
-#include <FL/Fl_Check_Button.H>
-#include <FL/Fl_Round_Button.H>
-#include <FL/Fl_Int_Input.H>
-#include <FL/Fl_Choice.H>
+
+class Fl_Widget;
+class Fl_Group;
+class Fl_Check_Button;
+class Fl_Round_Button;
+class Fl_Input;
+class Fl_Int_Input;
+class Fl_Choice;
typedef void (OptionsCallback)(void*);
diff --git a/vncviewer/ServerDialog.h b/vncviewer/ServerDialog.h
index e023659c..7926849a 100644
--- a/vncviewer/ServerDialog.h
+++ b/vncviewer/ServerDialog.h
@@ -20,8 +20,9 @@
#define __SERVERDIALOG_H__
#include <FL/Fl_Window.H>
-#include <FL/Fl_Input.H>
-#include <FL/Fl_File_Chooser.H>
+
+class Fl_Widget;
+class Fl_Input;
class ServerDialog : public Fl_Window {
protected:
diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx
index 4b8a85b0..0ac76024 100644
--- a/vncviewer/Viewport.cxx
+++ b/vncviewer/Viewport.cxx
@@ -27,6 +27,7 @@
#include <rfb/CMsgWriter.h>
#include <rfb/LogWriter.h>
+#include <rfb/PixelTransformer.h>
// FLTK can pull in the X11 headers on some systems
#ifndef XK_VoidSymbol
@@ -42,6 +43,7 @@
#include "Viewport.h"
#include "CConn.h"
#include "OptionsDialog.h"
+#include "DesktopWindow.h"
#include "i18n.h"
#include "fltk_layout.h"
#include "parameters.h"
@@ -49,9 +51,25 @@
#include "menukey.h"
#include "vncviewer.h"
+#if defined(WIN32)
+#include "Win32PixelBuffer.h"
+#elif defined(__APPLE__)
+#include "OSXPixelBuffer.h"
+#else
+#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>
+#include <FL/Fl_Menu.H>
+#include <FL/Fl_Menu_Button.H>
+
#ifdef WIN32
#include "win32.h"
#endif
@@ -209,6 +227,48 @@ void Viewport::updateWindow()
damage.clear();
}
+void Viewport::fillRect(const rfb::Rect& r, rfb::Pixel pix) {
+ if (pixelTrans) {
+ rfb::Pixel pix2;
+ if (colourMapChange)
+ commitColourMap();
+ pixelTrans->translatePixels(&pix, &pix2, 1);
+ pix = pix2;
+ }
+
+ frameBuffer->fillRect(r, pix);
+ damageRect(r);
+}
+
+void Viewport::imageRect(const rfb::Rect& r, void* pixels) {
+ if (pixelTrans) {
+ if (colourMapChange)
+ commitColourMap();
+ pixelTrans->translateRect(pixels, r.width(),
+ rfb::Rect(0, 0, r.width(), r.height()),
+ frameBuffer->data, frameBuffer->getStride(),
+ r.tl);
+ } else {
+ frameBuffer->imageRect(r, pixels);
+ }
+ damageRect(r);
+}
+
+void Viewport::copyRect(const rfb::Rect& r, int srcX, int srcY) {
+ frameBuffer->copyRect(r, rfb::Point(r.tl.x-srcX, r.tl.y-srcY));
+ damageRect(r);
+}
+
+rdr::U8* Viewport::getBufferRW(const rfb::Rect& r, int* stride) {
+ return frameBuffer->getBufferRW(r, stride);
+}
+
+void Viewport::damageRect(const rfb::Rect& r) {
+ damage.assign_union(rfb::Region(r));
+ if (!Fl::has_timeout(handleUpdateTimeout, this))
+ Fl::add_timeout(0.500, handleUpdateTimeout, this);
+};
+
#ifdef HAVE_FLTK_CURSOR
static const char * dotcursor_xpm[] = {
"5 5 2 1",
@@ -931,7 +991,7 @@ void Viewport::popupContextMenu()
// Back to our proper mouse pointer.
#ifdef HAVE_FLTK_CURSOR
- if (Fl::belowmouse() == this)
+ if ((Fl::belowmouse() == this) && cursor)
window()->cursor(cursor, cursorHotspot.x, cursorHotspot.y);
#endif
diff --git a/vncviewer/Viewport.h b/vncviewer/Viewport.h
index c66c19a0..e83a14ba 100644
--- a/vncviewer/Viewport.h
+++ b/vncviewer/Viewport.h
@@ -22,31 +22,19 @@
#include <map>
-#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>
-#include <rfb/Timer.h>
-#include <rfb/PixelBuffer.h>
-#include <rfb/PixelTransformer.h>
-
-#if defined(WIN32)
-#include "Win32PixelBuffer.h"
-#elif defined(__APPLE__)
-#include "OSXPixelBuffer.h"
-#else
-#include "X11PixelBuffer.h"
-#endif
+#include <rfb/Pixel.h>
+#include <rfb/ColourMap.h>
+
+class Fl_Menu_Button;
+class Fl_RGB_Image;
-// We also have a generic version of the above, using pure FLTK:
-//
-// #include "PlatformPixelBuffer.h"
-//
+namespace rfb { class PixelTransformer; }
class CConn;
+class PlatformPixelBuffer;
class Viewport : public Fl_Widget {
public:
@@ -63,49 +51,16 @@ public:
void updateWindow();
// Methods forwarded from CConn
- void setName(const char *name);
void setColourMapEntries(int firstColour, int nColours, rdr::U16* rgbs);
- void fillRect(const rfb::Rect& r, rfb::Pixel pix) {
- if (pixelTrans) {
- rfb::Pixel pix2;
- if (colourMapChange)
- commitColourMap();
- pixelTrans->translatePixels(&pix, &pix2, 1);
- pix = pix2;
- }
-
- frameBuffer->fillRect(r, pix);
- damageRect(r);
- }
- void imageRect(const rfb::Rect& r, void* pixels) {
- if (pixelTrans) {
- if (colourMapChange)
- commitColourMap();
- pixelTrans->translateRect(pixels, r.width(),
- rfb::Rect(0, 0, r.width(), r.height()),
- frameBuffer->data, frameBuffer->getStride(),
- r.tl);
- } else {
- frameBuffer->imageRect(r, pixels);
- }
- damageRect(r);
- }
- void copyRect(const rfb::Rect& r, int srcX, int srcY) {
- frameBuffer->copyRect(r, rfb::Point(r.tl.x-srcX, r.tl.y-srcY));
- damageRect(r);
- }
-
- rdr::U8* getPixelsRW(const rfb::Rect& r, int* stride) {
- return frameBuffer->getPixelsRW(r, stride);
- }
-
- void damageRect(const rfb::Rect& r) {
- damage.assign_union(rfb::Region(r));
- if (!Fl::has_timeout(handleUpdateTimeout, this))
- Fl::add_timeout(0.500, handleUpdateTimeout, this);
- };
+ void fillRect(const rfb::Rect& r, rfb::Pixel pix);
+ void imageRect(const rfb::Rect& r, void* pixels);
+ void copyRect(const rfb::Rect& r, int srcX, int srcY);
+
+ rdr::U8* getBufferRW(const rfb::Rect& r, int* stride);
+
+ void damageRect(const rfb::Rect& r);
void setCursor(int width, int height, const rfb::Point& hotspot,
void* data, void* mask);
diff --git a/vncviewer/Win32PixelBuffer.h b/vncviewer/Win32PixelBuffer.h
index ae2b71ac..7d91e09d 100644
--- a/vncviewer/Win32PixelBuffer.h
+++ b/vncviewer/Win32PixelBuffer.h
@@ -19,6 +19,8 @@
#ifndef __WIN32PIXELBUFFER_H__
#define __WIN32PIXELBUFFER_H__
+#include <windows.h>
+
#include <rfb/PixelBuffer.h>
class PlatformPixelBuffer: public rfb::FullFramePixelBuffer {