~ubuntu-branches/ubuntu/quantal/weston/quantal

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
#ifndef DESKTOP_SERVER_PROTOCOL_H
#define DESKTOP_SERVER_PROTOCOL_H

#ifdef  __cplusplus
extern "C" {
#endif

#include <stdint.h>
#include <stddef.h>
#include "wayland-util.h"

struct wl_client;
struct wl_resource;

struct desktop_shell;
struct screensaver;
struct input_panel;

extern const struct wl_interface desktop_shell_interface;
extern const struct wl_interface screensaver_interface;
extern const struct wl_interface input_panel_interface;

#ifndef DESKTOP_SHELL_CURSOR_ENUM
#define DESKTOP_SHELL_CURSOR_ENUM
enum desktop_shell_cursor {
	DESKTOP_SHELL_CURSOR_NONE = 0,
	DESKTOP_SHELL_CURSOR_RESIZE_TOP = 1,
	DESKTOP_SHELL_CURSOR_RESIZE_BOTTOM = 2,
	DESKTOP_SHELL_CURSOR_ARROW = 3,
	DESKTOP_SHELL_CURSOR_RESIZE_LEFT = 4,
	DESKTOP_SHELL_CURSOR_RESIZE_TOP_LEFT = 5,
	DESKTOP_SHELL_CURSOR_RESIZE_BOTTOM_LEFT = 6,
	DESKTOP_SHELL_CURSOR_MOVE = 7,
	DESKTOP_SHELL_CURSOR_RESIZE_RIGHT = 8,
	DESKTOP_SHELL_CURSOR_RESIZE_TOP_RIGHT = 9,
	DESKTOP_SHELL_CURSOR_RESIZE_BOTTOM_RIGHT = 10,
	DESKTOP_SHELL_CURSOR_BUSY = 11,
};
#endif /* DESKTOP_SHELL_CURSOR_ENUM */

/**
 * desktop_shell - create desktop widgets and helpers
 * @set_background: (none)
 * @set_panel: (none)
 * @set_lock_surface: (none)
 * @unlock: (none)
 * @set_grab_surface: set grab surface
 *
 * Traditional user interfaces can rely on this interface to define the
 * foundations of typical desktops. Currently it's possible to set up
 * background, panels and locking surfaces.
 */
struct desktop_shell_interface {
	/**
	 * set_background - (none)
	 * @output: (none)
	 * @surface: (none)
	 */
	void (*set_background)(struct wl_client *client,
			       struct wl_resource *resource,
			       struct wl_resource *output,
			       struct wl_resource *surface);
	/**
	 * set_panel - (none)
	 * @output: (none)
	 * @surface: (none)
	 */
	void (*set_panel)(struct wl_client *client,
			  struct wl_resource *resource,
			  struct wl_resource *output,
			  struct wl_resource *surface);
	/**
	 * set_lock_surface - (none)
	 * @surface: (none)
	 */
	void (*set_lock_surface)(struct wl_client *client,
				 struct wl_resource *resource,
				 struct wl_resource *surface);
	/**
	 * unlock - (none)
	 */
	void (*unlock)(struct wl_client *client,
		       struct wl_resource *resource);
	/**
	 * set_grab_surface - set grab surface
	 * @surface: (none)
	 *
	 * The surface set by this request will receive a fake
	 * pointer.enter event during grabs at position 0, 0 and is
	 * expected to set an appropriate cursor image as described by the
	 * grab_cursor event sent just before the enter event.
	 */
	void (*set_grab_surface)(struct wl_client *client,
				 struct wl_resource *resource,
				 struct wl_resource *surface);
};

#define DESKTOP_SHELL_CONFIGURE	0
#define DESKTOP_SHELL_PREPARE_LOCK_SURFACE	1
#define DESKTOP_SHELL_GRAB_CURSOR	2

static inline void
desktop_shell_send_configure(struct wl_resource *resource_, uint32_t edges, struct wl_resource *surface, int32_t width, int32_t height)
{
	wl_resource_post_event(resource_, DESKTOP_SHELL_CONFIGURE, edges, surface, width, height);
}

static inline void
desktop_shell_send_prepare_lock_surface(struct wl_resource *resource_)
{
	wl_resource_post_event(resource_, DESKTOP_SHELL_PREPARE_LOCK_SURFACE);
}

static inline void
desktop_shell_send_grab_cursor(struct wl_resource *resource_, uint32_t cursor)
{
	wl_resource_post_event(resource_, DESKTOP_SHELL_GRAB_CURSOR, cursor);
}

/**
 * screensaver - interface for implementing screensavers
 * @set_surface: set the surface type as a screensaver
 *
 * Only one client can bind this interface at a time.
 */
struct screensaver_interface {
	/**
	 * set_surface - set the surface type as a screensaver
	 * @surface: (none)
	 * @output: (none)
	 *
	 * A screensaver surface is normally hidden, and only visible
	 * after an idle timeout.
	 */
	void (*set_surface)(struct wl_client *client,
			    struct wl_resource *resource,
			    struct wl_resource *surface,
			    struct wl_resource *output);
};

/**
 * input_panel - interface for implementing keyboards
 * @set_surface: set the surface type as a keyboard
 *
 * Only one client can bind this interface at a time.
 */
struct input_panel_interface {
	/**
	 * set_surface - set the surface type as a keyboard
	 * @surface: (none)
	 * @output: (none)
	 *
	 * A keybaord surface is only shown, when a text model is active
	 */
	void (*set_surface)(struct wl_client *client,
			    struct wl_resource *resource,
			    struct wl_resource *surface,
			    struct wl_resource *output);
};

#ifdef  __cplusplus
}
#endif

#endif