Constantin Kaplinsky | 0a1eca1 | 2006-04-16 07:28:14 +0000 | [diff] [blame] | 1 | /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. |
| 2 | * |
| 3 | * This is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License as published by |
| 5 | * the Free Software Foundation; either version 2 of the License, or |
| 6 | * (at your option) any later version. |
| 7 | * |
| 8 | * This software is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this software; if not, write to the Free Software |
| 15 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
| 16 | * USA. |
| 17 | */ |
| 18 | |
| 19 | // -=- SDisplayCorePolling.h |
| 20 | // |
| 21 | // SDisplayCore implementation that simply polls the screen, in sections, |
| 22 | // in order to detect changes. This Core will signal the SDisplay's |
| 23 | // updateEvent regularly, causing it to call the Core back to propagate |
| 24 | // changes to the VNC Server. |
| 25 | |
| 26 | |
| 27 | #ifndef __RFB_SDISPLAY_CORE_POLLING_H__ |
| 28 | #define __RFB_SDISPLAY_CORE_POLLING_H__ |
| 29 | |
| 30 | #include <rfb_win32/SDisplay.h> |
| 31 | #include <rfb_win32/IntervalTimer.h> |
| 32 | #include <rfb_win32/WMWindowCopyRect.h> |
| 33 | |
| 34 | namespace rfb { |
| 35 | namespace win32 { |
| 36 | |
| 37 | class SDisplayCorePolling : public SDisplayCore, protected MsgWindow { |
| 38 | public: |
| 39 | SDisplayCorePolling(SDisplay* display, UpdateTracker* ut, int pollIntervalMs=50); |
| 40 | ~SDisplayCorePolling(); |
| 41 | |
| 42 | // - Called by SDisplay to inform Core of the screen size |
| 43 | virtual void setScreenRect(const Rect& screenRect_); |
| 44 | |
| 45 | // - Called by SDisplay to flush updates to the specified tracker |
| 46 | virtual void flushUpdates(); |
| 47 | |
| 48 | virtual const char* methodName() const { return "Polling"; } |
| 49 | |
| 50 | protected: |
| 51 | // - MsgWindow overrides |
| 52 | // processMessage is used to service the cursor & polling timers |
| 53 | virtual LRESULT processMessage(UINT msg, WPARAM wParam, LPARAM lParam); |
| 54 | |
| 55 | // - Hooking subcomponents used to track the desktop state |
| 56 | WMCopyRect copyrect; |
| 57 | |
| 58 | // - Background full screen polling fields |
| 59 | IntervalTimer pollTimer; |
| 60 | static const int pollTimerId; |
| 61 | Rect screenRect; |
| 62 | int pollInterval; |
| 63 | int pollNextY; |
| 64 | int pollIncrementY; |
| 65 | bool pollNextStrip; |
| 66 | |
| 67 | // - Handle back to the owning SDisplay, and to the UpdateTracker to flush to |
| 68 | SDisplay* display; |
| 69 | UpdateTracker* updateTracker; |
| 70 | }; |
| 71 | |
| 72 | }; |
| 73 | }; |
| 74 | |
| 75 | #endif |