Kristian Høgsberg | 1ef2313 | 2013-12-04 00:20:01 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright © 2010-2012 Intel Corporation |
| 3 | * Copyright © 2011-2012 Collabora, Ltd. |
| 4 | * Copyright © 2013 Raspberry Pi Foundation |
| 5 | * |
| 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. |
| 15 | * |
| 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. |
| 23 | */ |
| 24 | |
| 25 | #include <stdbool.h> |
| 26 | |
| 27 | #include "compositor.h" |
| 28 | |
| 29 | enum animation_type { |
| 30 | ANIMATION_NONE, |
| 31 | |
| 32 | ANIMATION_ZOOM, |
| 33 | ANIMATION_FADE, |
| 34 | ANIMATION_DIM_LAYER, |
| 35 | }; |
| 36 | |
| 37 | enum fade_type { |
| 38 | FADE_IN, |
| 39 | FADE_OUT |
| 40 | }; |
| 41 | |
| 42 | enum exposay_target_state { |
| 43 | EXPOSAY_TARGET_OVERVIEW, /* show all windows */ |
| 44 | EXPOSAY_TARGET_CANCEL, /* return to normal, same focus */ |
| 45 | EXPOSAY_TARGET_SWITCH, /* return to normal, switch focus */ |
| 46 | }; |
| 47 | |
| 48 | enum exposay_layout_state { |
| 49 | EXPOSAY_LAYOUT_INACTIVE = 0, /* normal desktop */ |
| 50 | EXPOSAY_LAYOUT_ANIMATE_TO_INACTIVE, /* in transition to normal */ |
| 51 | EXPOSAY_LAYOUT_OVERVIEW, /* show all windows */ |
| 52 | EXPOSAY_LAYOUT_ANIMATE_TO_OVERVIEW, /* in transition to all windows */ |
| 53 | }; |
| 54 | |
Emilio Pozuelo Monfort | 3b6e68e | 2014-02-10 13:22:32 +0100 | [diff] [blame] | 55 | struct exposay_output { |
| 56 | int num_surfaces; |
| 57 | int grid_size; |
| 58 | int surface_size; |
| 59 | |
| 60 | int hpadding_outer; |
| 61 | int vpadding_outer; |
| 62 | int padding_inner; |
| 63 | }; |
| 64 | |
| 65 | struct exposay { |
| 66 | /* XXX: Make these exposay_surfaces. */ |
| 67 | struct weston_view *focus_prev; |
| 68 | struct weston_view *focus_current; |
| 69 | struct weston_view *clicked; |
| 70 | struct workspace *workspace; |
| 71 | struct weston_seat *seat; |
| 72 | |
| 73 | struct wl_list surface_list; |
| 74 | |
| 75 | struct weston_keyboard_grab grab_kbd; |
| 76 | struct weston_pointer_grab grab_ptr; |
| 77 | |
| 78 | enum exposay_target_state state_target; |
| 79 | enum exposay_layout_state state_cur; |
| 80 | int in_flight; /* number of animations still running */ |
| 81 | |
| 82 | int row_current; |
| 83 | int column_current; |
| 84 | struct exposay_output *cur_output; |
| 85 | |
| 86 | bool mod_pressed; |
| 87 | bool mod_invalid; |
| 88 | }; |
| 89 | |
Kristian Høgsberg | 1ef2313 | 2013-12-04 00:20:01 -0800 | [diff] [blame] | 90 | struct focus_surface { |
| 91 | struct weston_surface *surface; |
| 92 | struct weston_view *view; |
| 93 | struct weston_transform workspace_transform; |
| 94 | }; |
| 95 | |
| 96 | struct workspace { |
| 97 | struct weston_layer layer; |
| 98 | |
| 99 | struct wl_list focus_list; |
| 100 | struct wl_listener seat_destroyed_listener; |
| 101 | |
| 102 | struct focus_surface *fsurf_front; |
| 103 | struct focus_surface *fsurf_back; |
| 104 | struct weston_view_animation *focus_animation; |
| 105 | }; |
| 106 | |
Emilio Pozuelo Monfort | 3b6e68e | 2014-02-10 13:22:32 +0100 | [diff] [blame] | 107 | struct shell_output { |
| 108 | struct desktop_shell *shell; |
| 109 | struct weston_output *output; |
| 110 | struct exposay_output eoutput; |
| 111 | struct wl_listener destroy_listener; |
| 112 | struct wl_list link; |
| 113 | }; |
| 114 | |
Kristian Høgsberg | 1ef2313 | 2013-12-04 00:20:01 -0800 | [diff] [blame] | 115 | struct desktop_shell { |
| 116 | struct weston_compositor *compositor; |
| 117 | |
| 118 | struct wl_listener idle_listener; |
| 119 | struct wl_listener wake_listener; |
| 120 | struct wl_listener destroy_listener; |
| 121 | struct wl_listener show_input_panel_listener; |
| 122 | struct wl_listener hide_input_panel_listener; |
| 123 | struct wl_listener update_input_panel_listener; |
| 124 | |
| 125 | struct weston_layer fullscreen_layer; |
| 126 | struct weston_layer panel_layer; |
| 127 | struct weston_layer background_layer; |
| 128 | struct weston_layer lock_layer; |
| 129 | struct weston_layer input_panel_layer; |
| 130 | |
| 131 | struct wl_listener pointer_focus_listener; |
| 132 | struct weston_surface *grab_surface; |
| 133 | |
| 134 | struct { |
| 135 | struct weston_process process; |
| 136 | struct wl_client *client; |
| 137 | struct wl_resource *desktop_shell; |
Ander Conselvan de Oliveira | 312ea4c | 2013-12-20 21:07:01 +0200 | [diff] [blame] | 138 | struct wl_listener client_destroy_listener; |
Kristian Høgsberg | 1ef2313 | 2013-12-04 00:20:01 -0800 | [diff] [blame] | 139 | |
| 140 | unsigned deathcount; |
| 141 | uint32_t deathstamp; |
| 142 | } child; |
| 143 | |
| 144 | bool locked; |
| 145 | bool showing_input_panels; |
| 146 | bool prepare_event_sent; |
| 147 | |
| 148 | struct { |
| 149 | struct weston_surface *surface; |
| 150 | pixman_box32_t cursor_rectangle; |
| 151 | } text_input; |
| 152 | |
| 153 | struct weston_surface *lock_surface; |
| 154 | struct wl_listener lock_surface_listener; |
| 155 | |
| 156 | struct { |
| 157 | struct wl_array array; |
| 158 | unsigned int current; |
| 159 | unsigned int num; |
| 160 | |
| 161 | struct wl_list client_list; |
| 162 | |
| 163 | struct weston_animation animation; |
| 164 | struct wl_list anim_sticky_list; |
| 165 | int anim_dir; |
| 166 | uint32_t anim_timestamp; |
| 167 | double anim_current; |
| 168 | struct workspace *anim_from; |
| 169 | struct workspace *anim_to; |
| 170 | } workspaces; |
| 171 | |
| 172 | struct { |
| 173 | char *path; |
| 174 | int duration; |
| 175 | struct wl_resource *binding; |
| 176 | struct weston_process process; |
| 177 | struct wl_event_source *timer; |
| 178 | } screensaver; |
| 179 | |
| 180 | struct { |
| 181 | struct wl_resource *binding; |
| 182 | struct wl_list surfaces; |
| 183 | } input_panel; |
| 184 | |
| 185 | struct { |
| 186 | struct weston_view *view; |
| 187 | struct weston_view_animation *animation; |
| 188 | enum fade_type type; |
| 189 | struct wl_event_source *startup_timer; |
| 190 | } fade; |
| 191 | |
Emilio Pozuelo Monfort | 3b6e68e | 2014-02-10 13:22:32 +0100 | [diff] [blame] | 192 | struct exposay exposay; |
Kristian Høgsberg | 1ef2313 | 2013-12-04 00:20:01 -0800 | [diff] [blame] | 193 | |
| 194 | uint32_t binding_modifier; |
Kristian Høgsberg | d56ab4e | 2014-01-16 16:51:52 -0800 | [diff] [blame] | 195 | uint32_t exposay_modifier; |
Kristian Høgsberg | 1ef2313 | 2013-12-04 00:20:01 -0800 | [diff] [blame] | 196 | enum animation_type win_animation_type; |
| 197 | enum animation_type startup_animation_type; |
| 198 | enum animation_type focus_animation_type; |
| 199 | |
Manuel Bachmann | 50c87db | 2014-02-26 15:52:13 +0100 | [diff] [blame] | 200 | struct weston_layer minimized_layer; |
| 201 | |
Kristian Høgsberg | 1ef2313 | 2013-12-04 00:20:01 -0800 | [diff] [blame] | 202 | struct wl_listener output_create_listener; |
Ander Conselvan de Oliveira | a8a9baf | 2014-01-29 18:47:52 +0200 | [diff] [blame] | 203 | struct wl_listener output_move_listener; |
Kristian Høgsberg | 1ef2313 | 2013-12-04 00:20:01 -0800 | [diff] [blame] | 204 | struct wl_list output_list; |
| 205 | |
| 206 | char *client; |
| 207 | }; |
| 208 | |
Emilio Pozuelo Monfort | 1a26f1b | 2014-01-07 16:41:40 +0100 | [diff] [blame] | 209 | void |
| 210 | set_alpha_if_fullscreen(struct shell_surface *shsurf); |
| 211 | |
Kristian Høgsberg | 1ef2313 | 2013-12-04 00:20:01 -0800 | [diff] [blame] | 212 | struct weston_output * |
| 213 | get_default_output(struct weston_compositor *compositor); |
| 214 | |
| 215 | struct weston_view * |
| 216 | get_default_view(struct weston_surface *surface); |
| 217 | |
| 218 | struct shell_surface * |
| 219 | get_shell_surface(struct weston_surface *surface); |
| 220 | |
| 221 | struct workspace * |
| 222 | get_current_workspace(struct desktop_shell *shell); |
| 223 | |
| 224 | void |
| 225 | lower_fullscreen_layer(struct desktop_shell *shell); |
| 226 | |
| 227 | void |
| 228 | activate(struct desktop_shell *shell, struct weston_surface *es, |
| 229 | struct weston_seat *seat); |
| 230 | |
| 231 | void |
| 232 | exposay_binding(struct weston_seat *seat, |
| 233 | enum weston_keyboard_modifier modifier, |
| 234 | void *data); |
Kristian Høgsberg | 677a5f5 | 2013-12-04 11:00:19 -0800 | [diff] [blame] | 235 | int |
| 236 | input_panel_setup(struct desktop_shell *shell); |
| 237 | void |
| 238 | input_panel_destroy(struct desktop_shell *shell); |