diff options
author | Pierre Ossman <ossman@cendio.se> | 2011-04-15 07:46:56 +0000 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2011-04-15 07:46:56 +0000 |
commit | d50b3d137b14c9111c9c789a9acb4d1d67802400 (patch) | |
tree | 94675ead37f01e2f613e1dc901db5f5309a01fb7 /vncviewer/DesktopWindow.h | |
parent | a64515286b115ba425297012bfb268d22cd5763c (diff) | |
download | tigervnc-d50b3d137b14c9111c9c789a9acb4d1d67802400.tar.gz tigervnc-d50b3d137b14c9111c9c789a9acb4d1d67802400.zip |
Split out the graphics and input handling to a separate widget in preparation
for things like scroll bars.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4371 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'vncviewer/DesktopWindow.h')
-rw-r--r-- | vncviewer/DesktopWindow.h | 62 |
1 files changed, 6 insertions, 56 deletions
diff --git a/vncviewer/DesktopWindow.h b/vncviewer/DesktopWindow.h index bf54c211..39fb9e7b 100644 --- a/vncviewer/DesktopWindow.h +++ b/vncviewer/DesktopWindow.h @@ -26,10 +26,8 @@ #include <FL/Fl_Window.H> #include <rfb/Rect.h> -#include <rfb/Region.h> -#include <rfb/Timer.h> -#include <rfb/PixelBuffer.h> -#include <rfb/PixelTransformer.h> + +#include "Viewport.h" class CConn; @@ -58,68 +56,20 @@ public: void setColourMapEntries(int firstColour, int nColours, rdr::U16* rgbs); void fillRect(const rfb::Rect& r, rfb::Pixel pix) { - if (pixelTrans) { - rfb::Pixel pix2; - pixelTrans->translatePixels(&pix, &pix2, 1); - pix = pix2; - } - - frameBuffer->fillRect(r, pix); - damageRect(r); + viewport->fillRect(r, pix); } void imageRect(const rfb::Rect& r, void* pixels) { - if (pixelTrans) - 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); + viewport->imageRect(r, pixels); } 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); + viewport->copyRect(r, srcX, srcY); } - // Fl_Window callback methods - void draw(); - int handle(int event); - private: - - void damageRect(const rfb::Rect& r) { - damage.assign_union(rfb::Region(r)); - if (!Fl::has_timeout(handleUpdateTimeout, this)) - Fl::add_timeout(0.100, handleUpdateTimeout, this); - }; - - static void handleUpdateTimeout(void *data); - static void handleColourMap(void *data); - static void handleClose(Fl_Widget *wnd, void *data); - void handlePointerEvent(const rfb::Point& pos, int buttonMask); - static void handlePointerTimeout(void *data); - - rdr::U32 translateKeyEvent(int keyCode, const char *keyText); - void handleKeyEvent(int keyCode, const char *keyText, bool down); - private: - CConn* cc; - - rfb::ManagedPixelBuffer* frameBuffer; - - rfb::PixelTransformer *pixelTrans; - rfb::SimpleColourMap colourMap; - - rfb::Region damage; - - rfb::Point lastPointerPos; - int lastButtonMask; - - typedef std::map<int, rdr::U32> DownMap; - DownMap downKeySym; + Viewport *viewport; }; #endif |