1 /* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /*
3    Copyright (C) 2010 Red Hat, Inc.
4 
5    This library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9 
10    This library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14 
15    You should have received a copy of the GNU Lesser General Public
16    License along with this library; if not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef __SPICE_CLIENT_WIDGET_H__
19 #define __SPICE_CLIENT_WIDGET_H__
20 
21 #if !defined(__SPICE_CLIENT_GTK_H_INSIDE__) && !defined(SPICE_COMPILATION)
22 #warning "Only <spice-client-gtk.h> can be included directly"
23 #endif
24 
25 #include "spice-client.h"
26 
27 #include <gtk/gtk.h>
28 #include "spice-grabsequence.h"
29 #include "spice-widget-enums.h"
30 #include "spice-util.h"
31 #include "spice-gtk-session.h"
32 
33 G_BEGIN_DECLS
34 
35 #define SPICE_TYPE_DISPLAY            (spice_display_get_type())
36 #define SPICE_DISPLAY(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), SPICE_TYPE_DISPLAY, SpiceDisplay))
37 #define SPICE_DISPLAY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), SPICE_TYPE_DISPLAY, SpiceDisplayClass))
38 #define SPICE_IS_DISPLAY(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), SPICE_TYPE_DISPLAY))
39 #define SPICE_IS_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SPICE_TYPE_DISPLAY))
40 #define SPICE_DISPLAY_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), SPICE_TYPE_DISPLAY, SpiceDisplayClass))
41 
42 
43 /**
44  * SpiceDisplay:
45  *
46  * The #SpiceDisplay struct is opaque and should not be accessed directly.
47  */
48 typedef struct _SpiceDisplay SpiceDisplay;
49 
50 /**
51  * SpiceDisplayClass:
52  *
53  * Class structure for #SpiceDisplay. It is opaque and should not be accessed directly.
54  */
55 typedef struct _SpiceDisplayClass SpiceDisplayClass;
56 
57 /**
58  * SpiceDisplayKeyEvent:
59  * @SPICE_DISPLAY_KEY_EVENT_PRESS: key press
60  * @SPICE_DISPLAY_KEY_EVENT_RELEASE: key release
61  * @SPICE_DISPLAY_KEY_EVENT_CLICK: key click (press and release)
62  *
63  * Constants for key events.
64  */
65 typedef enum
66 {
67 	SPICE_DISPLAY_KEY_EVENT_PRESS = 1,
68 	SPICE_DISPLAY_KEY_EVENT_RELEASE = 2,
69 	SPICE_DISPLAY_KEY_EVENT_CLICK = 3,
70 } SpiceDisplayKeyEvent;
71 
72 GType	        spice_display_get_type(void);
73 
74 SpiceDisplay* spice_display_new(SpiceSession *session, int channel_id);
75 SpiceDisplay* spice_display_new_with_monitor(SpiceSession *session, gint channel_id, gint monitor_id);
76 
77 void spice_display_mouse_ungrab(SpiceDisplay *display);
78 void spice_display_set_grab_keys(SpiceDisplay *display, SpiceGrabSequence *seq);
79 SpiceGrabSequence *spice_display_get_grab_keys(SpiceDisplay *display);
80 void spice_display_send_keys(SpiceDisplay *display, const guint *keyvals,
81                              int nkeyvals, SpiceDisplayKeyEvent kind);
82 GdkPixbuf *spice_display_get_pixbuf(SpiceDisplay *display);
83 
84 G_END_DECLS
85 
86 #endif /* __SPICE_CLIENT_WIDGET_H__ */
87