Constantin Kaplinsky | af1891c | 2005-09-29 06:18:28 +0000 | [diff] [blame] | 1 | /* Copyright (C) 2004-2005 Constantin Kaplinsky. 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 | // |
| 20 | // PollingManager.h |
| 21 | // |
| 22 | |
| 23 | #ifndef __POLLINGMANAGER_H__ |
| 24 | #define __POLLINGMANAGER_H__ |
| 25 | |
| 26 | #include <X11/Xlib.h> |
| 27 | #include <rfb/VNCServer.h> |
| 28 | |
| 29 | #include <x0vncserver/Image.h> |
| 30 | |
| 31 | using namespace rfb; |
| 32 | |
| 33 | class PollingManager { |
| 34 | |
| 35 | public: |
| 36 | |
| 37 | PollingManager(Display *dpy, Image *image, ImageFactory *factory); |
Constantin Kaplinsky | 14cd547 | 2005-09-29 17:12:11 +0000 | [diff] [blame] | 38 | virtual ~PollingManager(); |
Constantin Kaplinsky | af1891c | 2005-09-29 06:18:28 +0000 | [diff] [blame] | 39 | |
Constantin Kaplinsky | 14cd547 | 2005-09-29 17:12:11 +0000 | [diff] [blame] | 40 | void setVNCServer(VNCServer *s); |
Constantin Kaplinsky | af1891c | 2005-09-29 06:18:28 +0000 | [diff] [blame] | 41 | void pollDebug(); |
| 42 | void poll(); |
| 43 | |
| 44 | protected: |
| 45 | |
Constantin Kaplinsky | c42eab2 | 2006-02-01 05:59:21 +0000 | [diff] [blame] | 46 | // |
| 47 | // Implementations of different polling algorithms. |
| 48 | // Return value of true reports that some changes were detected. |
| 49 | // |
| 50 | bool poll_DetectVideo(); |
| 51 | bool poll_SkipCycles(); |
| 52 | bool poll_Traditional(); |
| 53 | bool poll_Dumb(); |
Constantin Kaplinsky | 14cd547 | 2005-09-29 17:12:11 +0000 | [diff] [blame] | 54 | |
| 55 | Display *m_dpy; |
| 56 | VNCServer *m_server; |
| 57 | |
| 58 | Image *m_image; |
| 59 | int m_width; |
| 60 | int m_height; |
| 61 | int m_widthTiles; |
| 62 | int m_heightTiles; |
| 63 | |
Constantin Kaplinsky | 6df6990 | 2006-02-03 11:42:00 +0000 | [diff] [blame^] | 64 | private: |
| 65 | |
| 66 | void adjustVideoArea(); |
| 67 | |
Constantin Kaplinsky | 14cd547 | 2005-09-29 17:12:11 +0000 | [diff] [blame] | 68 | Image *m_rowImage; |
| 69 | Image *m_tileImage; |
| 70 | |
| 71 | char *m_statusMatrix; |
| 72 | |
Constantin Kaplinsky | dc54fc1 | 2005-10-19 13:57:16 +0000 | [diff] [blame] | 73 | char *m_rateMatrix; |
| 74 | char *m_videoFlags; |
| 75 | char *m_changedFlags; |
| 76 | |
Constantin Kaplinsky | af1891c | 2005-09-29 06:18:28 +0000 | [diff] [blame] | 77 | unsigned int m_pollingStep; |
| 78 | static const int m_pollingOrder[]; |
Constantin Kaplinsky | af1891c | 2005-09-29 06:18:28 +0000 | [diff] [blame] | 79 | |
| 80 | }; |
| 81 | |
| 82 | #endif // __POLLINGMANAGER_H__ |