-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathvncdisplaymm.h
225 lines (170 loc) · 6.77 KB
/
vncdisplaymm.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
/* This file is part of gsshvnc.
*
* gsshvnc is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* gsshvnc is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with gsshvnc. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _VNCDISPLAYMM_H
#define _VNCDISPLAYMM_H
/* TODO: Use gmmproc to build a standard glibmm wrapper for VncDisplay,
* instead of these "fake" wrappers */
#include <gtkmm/applicationwindow.h>
#include <vncdisplay.h>
#ifdef GTK_VNC_HAVE_VNCVERSION
// Introduced in v1.2.0
# include <vncversion.h>
#else
# define VNC_CHECK_VERSION(major, minor, micro) (0)
#endif
#include "vncgrabsequencemm.h"
namespace Gio
{
class SocketAddress;
}
namespace Gtk
{
class ScrolledWindow;
class MenuBar;
class CheckMenuItem;
class RadioMenuItem;
}
namespace Vnc
{
class DisplayWindow : public Gtk::ApplicationWindow
{
public:
DisplayWindow();
~DisplayWindow() override;
bool open_fd(int fd);
bool open_fd(int fd, const Glib::ustring &hostname);
bool open_addr(Gio::SocketAddress *address, const Glib::ustring &hostname);
bool open_host(const Glib::ustring &host, const Glib::ustring &port);
bool is_open();
void close_vnc();
//VncConnection *get_connection();
// For use in credential storage.
// NOTE: vnc_host might not match the one passed to open_host, since the
// latter might be a local socket through an SSH tunnel.
void set_ssh_host(const Glib::ustring &ssh_host) { m_ssh_host = ssh_host; }
void set_vnc_host(const Glib::ustring &vnc_host) { m_vnc_host = vnc_host; }
void send_keys(const std::vector<guint> &keys);
void send_keys(const std::vector<guint> &keys, VncDisplayKeyEvent kind);
void send_pointer(gint x, gint y, int buttonmask);
void set_grab_keys(Vnc::GrabSequence &seq);
Vnc::GrabSequence get_grab_keys();
bool set_credential(int type, const Glib::ustring &data);
void set_pointer_local(bool enable=true);
bool get_pointer_local();
void set_pointer_grab(bool enable=true);
bool get_pointer_grab();
void set_keyboard_grab(bool enable=true);
bool get_keyboard_grab();
void set_read_only(bool enable=true);
bool get_read_only();
Glib::RefPtr<Gdk::Pixbuf> get_pixbuf();
int get_width();
int get_height();
Glib::ustring get_name();
void client_cut_text(const std::string &text);
void set_lossy_encoding(bool enable=true);
bool get_lossy_encoding();
void set_scaling(bool enable=true);
bool get_scaling();
void set_force_size(bool enable=true);
bool get_force_size();
/* gtk-vnc >= 1.2.0 */
void set_allow_resize(bool enable=true);
bool get_allow_resize();
/* Not supported on gtk-vnc < 0.7.0 */
void set_smoothing(bool enable=true);
bool get_smoothing();
/* gtk-vnc >= 1.2.0 */
void set_keep_aspect_ratio(bool enable=true);
bool get_keep_aspect_ratio();
void set_shared_flag(bool enable=true);
bool get_shared_flag();
void set_depth(VncDisplayDepthColor depth);
VncDisplayDepthColor get_depth();
void force_grab(bool enable=true);
bool is_pointer_absolute();
static Glib::OptionGroup &option_group();
sigc::signal<void> &signal_connection_lost() { return m_signal_connection_lost; }
sigc::signal<void> &signal_want_reconnect() { return m_signal_reconnect; }
void set_capture_keyboard(bool enable=true);
bool get_capture_keyboard();
void activate_menubar();
private:
Glib::SignalProxy0<void> signal_vnc_connected();
Glib::SignalProxy0<void> signal_vnc_initialized();
Glib::SignalProxy0<void> signal_vnc_disconnected();
/* NOTE: signal_vnc_error not emitted on gtk-vnc < 0.6.0 */
Glib::SignalProxy1<void, const Glib::ustring &> signal_vnc_error();
Glib::SignalProxy1<void, const std::vector<VncDisplayCredential> &>
signal_vnc_auth_credential();
Glib::SignalProxy0<void> signal_vnc_pointer_grab();
Glib::SignalProxy0<void> signal_vnc_pointer_ungrab();
Glib::SignalProxy0<void> signal_vnc_keyboard_grab();
Glib::SignalProxy0<void> signal_vnc_keyboard_ungrab();
Glib::SignalProxy2<void, gint, gint> signal_vnc_desktop_resize();
Glib::SignalProxy1<void, const Glib::ustring &> signal_vnc_auth_failure();
Glib::SignalProxy1<void, guint> signal_vnc_auth_unsupported();
Glib::SignalProxy1<void, const std::string &> signal_vnc_server_cut_text();
Glib::SignalProxy0<void> signal_vnc_bell();
// Emitted when VNC disconnects for any reason, to signal that the
// SSH client should also terminate. This is emitted before handling
// the user response and potentially requesting a reconnection.
sigc::signal<void> m_signal_connection_lost;
// Emitted after VNC disconnects and the user requests re-connection.
sigc::signal<void> m_signal_reconnect;
Gtk::Widget *m_vnc;
Gtk::ScrolledWindow *m_viewport;
VncDisplay *get_vnc();
bool m_connected;
bool m_accel_enabled;
bool m_enable_mnemonics;
Glib::ustring m_menu_bar_accel;
Gtk::MenuBar *m_menubar;
Gtk::CheckMenuItem *m_capture_keyboard;
Gtk::CheckMenuItem *m_hide_menubar;
Gtk::CheckMenuItem *m_fullscreen;
Gtk::RadioMenuItem *m_resize_none;
Gtk::RadioMenuItem *m_resize_scale;
Gtk::RadioMenuItem *m_resize_remote;
Gtk::CheckMenuItem *m_smoothing;
Gtk::CheckMenuItem *m_keep_ratio;
void *m_pulse_ifc;
std::string m_clipboard_text;
Glib::ustring m_vnc_host;
Glib::ustring m_ssh_host;
void init_vnc();
void handle_disconnect(const Glib::ustring &connected_msg,
const Glib::ustring &disconnected_msg);
void vnc_screenshot();
void vnc_initialized();
void update_title(bool grabbed);
void vnc_credential(const std::vector<VncDisplayCredential> &credList);
void on_set_scaling(bool enable=true);
void on_set_allow_resize(bool enable=true);
void on_set_smoothing(bool enable=true);
void on_set_keep_aspect_ratio(bool enable=true);
void disable_modifiers();
void enable_modifiers();
void toggle_menubar();
struct { int width, height; } m_remote_size;
void update_scrolling();
void clipboard_text_received(const Gtk::SelectionData &selection_data);
void remote_clipboard_text(const std::string &text);
static void vnc_copy_handler(GtkClipboard *clipboard, GtkSelectionData *data,
guint info, gpointer owner);
};
}
#endif