2 * Copyright © 2010-2012 Intel Corporation
3 * Copyright © 2011-2012 Collabora, Ltd.
4 * Copyright © 2013 Raspberry Pi Foundation
6 * Permission to use, copy, modify, distribute, and sell this software and
7 * its documentation for any purpose is hereby granted without fee, provided
8 * that the above copyright notice appear in all copies and that both that
9 * copyright notice and this permission notice appear in supporting
10 * documentation, and that the name of the copyright holders not be used in
11 * advertising or publicity pertaining to distribution of the software
12 * without specific, written prior permission. The copyright holders make
13 * no representations about the suitability of this software for any
14 * purpose. It is provided "as is" without express or implied warranty.
16 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
17 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
20 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
21 * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
22 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
27 #include "compositor.h"
29 #include "desktop-shell-server-protocol.h"
44 enum exposay_target_state {
45 EXPOSAY_TARGET_OVERVIEW, /* show all windows */
46 EXPOSAY_TARGET_CANCEL, /* return to normal, same focus */
47 EXPOSAY_TARGET_SWITCH, /* return to normal, switch focus */
50 enum exposay_layout_state {
51 EXPOSAY_LAYOUT_INACTIVE = 0, /* normal desktop */
52 EXPOSAY_LAYOUT_ANIMATE_TO_INACTIVE, /* in transition to normal */
53 EXPOSAY_LAYOUT_OVERVIEW, /* show all windows */
54 EXPOSAY_LAYOUT_ANIMATE_TO_OVERVIEW, /* in transition to all windows */
57 struct exposay_output {
68 /* XXX: Make these exposay_surfaces. */
69 struct weston_view *focus_prev;
70 struct weston_view *focus_current;
71 struct weston_view *clicked;
72 struct workspace *workspace;
73 struct weston_seat *seat;
75 struct wl_list surface_list;
77 struct weston_keyboard_grab grab_kbd;
78 struct weston_pointer_grab grab_ptr;
80 enum exposay_target_state state_target;
81 enum exposay_layout_state state_cur;
82 int in_flight; /* number of animations still running */
86 struct exposay_output *cur_output;
92 struct focus_surface {
93 struct weston_surface *surface;
94 struct weston_view *view;
95 struct weston_transform workspace_transform;
99 struct weston_layer layer;
101 struct wl_list focus_list;
102 struct wl_listener seat_destroyed_listener;
104 struct focus_surface *fsurf_front;
105 struct focus_surface *fsurf_back;
106 struct weston_view_animation *focus_animation;
109 struct shell_output {
110 struct desktop_shell *shell;
111 struct weston_output *output;
112 struct exposay_output eoutput;
113 struct wl_listener destroy_listener;
117 struct desktop_shell {
118 struct weston_compositor *compositor;
120 struct wl_listener idle_listener;
121 struct wl_listener wake_listener;
122 struct wl_listener destroy_listener;
123 struct wl_listener show_input_panel_listener;
124 struct wl_listener hide_input_panel_listener;
125 struct wl_listener update_input_panel_listener;
127 struct weston_layer fullscreen_layer;
128 struct weston_layer panel_layer;
129 struct weston_layer background_layer;
130 struct weston_layer lock_layer;
131 struct weston_layer input_panel_layer;
133 struct wl_listener pointer_focus_listener;
134 struct weston_surface *grab_surface;
137 struct weston_process process;
138 struct wl_client *client;
139 struct wl_resource *desktop_shell;
140 struct wl_listener client_destroy_listener;
147 bool showing_input_panels;
148 bool prepare_event_sent;
151 struct weston_surface *surface;
152 pixman_box32_t cursor_rectangle;
155 struct weston_surface *lock_surface;
156 struct wl_listener lock_surface_listener;
159 struct wl_array array;
160 unsigned int current;
163 struct wl_list client_list;
165 struct weston_animation animation;
166 struct wl_list anim_sticky_list;
168 uint32_t anim_timestamp;
170 struct workspace *anim_from;
171 struct workspace *anim_to;
177 struct wl_resource *binding;
178 struct weston_process process;
179 struct wl_event_source *timer;
183 struct wl_resource *binding;
184 struct wl_list surfaces;
188 struct weston_view *view;
189 struct weston_view_animation *animation;
191 struct wl_event_source *startup_timer;
194 struct exposay exposay;
196 uint32_t binding_modifier;
197 uint32_t exposay_modifier;
198 enum animation_type win_animation_type;
199 enum animation_type win_close_animation_type;
200 enum animation_type startup_animation_type;
201 enum animation_type focus_animation_type;
203 struct weston_layer minimized_layer;
205 struct wl_listener seat_create_listener;
206 struct wl_listener output_create_listener;
207 struct wl_listener output_move_listener;
208 struct wl_list output_list;
210 enum desktop_shell_panel_position panel_position;
215 struct weston_output *
216 get_default_output(struct weston_compositor *compositor);
219 get_default_view(struct weston_surface *surface);
221 struct shell_surface *
222 get_shell_surface(struct weston_surface *surface);
225 get_current_workspace(struct desktop_shell *shell);
228 lower_fullscreen_layer(struct desktop_shell *shell);
231 activate(struct desktop_shell *shell, struct weston_surface *es,
232 struct weston_seat *seat, bool configure);
235 exposay_binding(struct weston_seat *seat,
236 enum weston_keyboard_modifier modifier,
239 input_panel_setup(struct desktop_shell *shell);
241 input_panel_destroy(struct desktop_shell *shell);
243 typedef void (*shell_for_each_layer_func_t)(struct desktop_shell *,
244 struct weston_layer *, void *);
247 shell_for_each_layer(struct desktop_shell *shell,
248 shell_for_each_layer_func_t func,