blob: f5ef8b74ece01a5d50a06a4a8431adec53647be2 [file] [log] [blame]
Constantin Kaplinsky729598c2006-05-25 05:12:25 +00001/* 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#ifndef WINVNCCONF_HOOKING
19#define WINVNCCONF_HOOKING
20
21#include <rfb_win32/Registry.h>
22#include <rfb_win32/Dialog.h>
23#include <rfb_win32/SDisplay.h>
24#include <rfb_win32/WMPoller.h>
25#include <rfb/ServerCore.h>
26
27namespace rfb {
28
29 namespace win32 {
30
31 class HookingPage : public PropSheetPage {
32 public:
33 HookingPage(const RegKey& rk)
34 : PropSheetPage(GetModuleHandle(0), MAKEINTRESOURCE(IDD_HOOKING)), regKey(rk) {}
35 void initDialog() {
36 setItemChecked(IDC_USEPOLLING, rfb::win32::SDisplay::updateMethod == 0);
Pierre Ossmanfc08bee2016-01-12 12:32:15 +010037 setItemChecked(IDC_USEHOOKS, (rfb::win32::SDisplay::updateMethod == 1));
Constantin Kaplinsky729598c2006-05-25 05:12:25 +000038 setItemChecked(IDC_POLLCONSOLES, rfb::win32::WMPoller::poll_console_windows);
Pierre Ossmanfc08bee2016-01-12 12:32:15 +010039 setItemChecked(IDC_CAPTUREBLT, rfb::win32::DeviceFrameBuffer::useCaptureBlt);
Constantin Kaplinsky729598c2006-05-25 05:12:25 +000040 onCommand(IDC_USEHOOKS, 0);
41 }
42 bool onCommand(int id, int cmd) {
43 switch (id) {
44 case IDC_USEPOLLING:
45 case IDC_USEHOOKS:
Constantin Kaplinsky729598c2006-05-25 05:12:25 +000046 case IDC_POLLCONSOLES:
47 case IDC_CAPTUREBLT:
48 setChanged(((rfb::win32::SDisplay::updateMethod == 0) != isItemChecked(IDC_USEPOLLING)) ||
49 ((rfb::win32::SDisplay::updateMethod == 1) != isItemChecked(IDC_USEHOOKS)) ||
Constantin Kaplinsky729598c2006-05-25 05:12:25 +000050 (rfb::win32::WMPoller::poll_console_windows != isItemChecked(IDC_POLLCONSOLES)) ||
51 (rfb::win32::DeviceFrameBuffer::useCaptureBlt != isItemChecked(IDC_CAPTUREBLT)));
52 enableItem(IDC_POLLCONSOLES, isItemChecked(IDC_USEHOOKS));
53 break;
54 }
55 return false;
56 }
57 bool onOk() {
58 if (isItemChecked(IDC_USEPOLLING))
59 regKey.setInt(_T("UpdateMethod"), 0);
60 if (isItemChecked(IDC_USEHOOKS))
61 regKey.setInt(_T("UpdateMethod"), 1);
Constantin Kaplinsky729598c2006-05-25 05:12:25 +000062 regKey.setBool(_T("PollConsoleWindows"), isItemChecked(IDC_POLLCONSOLES));
63 regKey.setBool(_T("UseCaptureBlt"), isItemChecked(IDC_CAPTUREBLT));
64
65 // *** LEGACY compatibility ***
66 regKey.setBool(_T("UseHooks"), isItemChecked(IDC_USEHOOKS));
67 return true;
68 }
69 protected:
70 RegKey regKey;
71 };
72
73 };
74
75};
76
77#endif