diff options
Diffstat (limited to 'include/sway/output.h')
-rw-r--r-- | include/sway/output.h | 114 |
1 files changed, 41 insertions, 73 deletions
diff --git a/include/sway/output.h b/include/sway/output.h index 96986700..d546d488 100644 --- a/include/sway/output.h +++ b/include/sway/output.h | |||
@@ -3,8 +3,9 @@ | |||
3 | #include <time.h> | 3 | #include <time.h> |
4 | #include <unistd.h> | 4 | #include <unistd.h> |
5 | #include <wayland-server-core.h> | 5 | #include <wayland-server-core.h> |
6 | #include <wlr/types/wlr_box.h> | 6 | #include <wlr/types/wlr_damage_ring.h> |
7 | #include <wlr/types/wlr_output.h> | 7 | #include <wlr/types/wlr_output.h> |
8 | #include <wlr/types/wlr_scene.h> | ||
8 | #include "config.h" | 9 | #include "config.h" |
9 | #include "sway/tree/node.h" | 10 | #include "sway/tree/node.h" |
10 | #include "sway/tree/view.h" | 11 | #include "sway/tree/view.h" |
@@ -19,43 +20,63 @@ struct sway_output_state { | |||
19 | 20 | ||
20 | struct sway_output { | 21 | struct sway_output { |
21 | struct sway_node node; | 22 | struct sway_node node; |
23 | |||
24 | struct { | ||
25 | struct wlr_scene_tree *shell_background; | ||
26 | struct wlr_scene_tree *shell_bottom; | ||
27 | struct wlr_scene_tree *tiling; | ||
28 | struct wlr_scene_tree *fullscreen; | ||
29 | struct wlr_scene_tree *shell_top; | ||
30 | struct wlr_scene_tree *shell_overlay; | ||
31 | struct wlr_scene_tree *session_lock; | ||
32 | } layers; | ||
33 | |||
34 | // when a container is fullscreen, in case the fullscreen surface is | ||
35 | // translucent (can see behind) we must make sure that the background is a | ||
36 | // solid color in order to conform to the wayland protocol. This rect | ||
37 | // ensures that when looking through a surface, all that will be seen | ||
38 | // is black. | ||
39 | struct wlr_scene_rect *fullscreen_background; | ||
40 | |||
22 | struct wlr_output *wlr_output; | 41 | struct wlr_output *wlr_output; |
42 | struct wlr_scene_output *scene_output; | ||
23 | struct sway_server *server; | 43 | struct sway_server *server; |
24 | struct wl_list link; | 44 | struct wl_list link; |
25 | 45 | ||
26 | struct wl_list layers[4]; // sway_layer_surface::link | ||
27 | struct wlr_box usable_area; | 46 | struct wlr_box usable_area; |
28 | 47 | ||
29 | struct timespec last_frame; | ||
30 | struct wlr_output_damage *damage; | ||
31 | |||
32 | int lx, ly; // layout coords | 48 | int lx, ly; // layout coords |
33 | int width, height; // transformed buffer size | 49 | int width, height; // transformed buffer size |
34 | enum wl_output_subpixel detected_subpixel; | 50 | enum wl_output_subpixel detected_subpixel; |
35 | enum scale_filter_mode scale_filter; | 51 | enum scale_filter_mode scale_filter; |
36 | // last applied mode when the output is DPMS'ed | ||
37 | struct wlr_output_mode *current_mode; | ||
38 | 52 | ||
39 | bool enabling, enabled; | 53 | bool enabled; |
40 | list_t *workspaces; | 54 | list_t *workspaces; |
41 | 55 | ||
42 | struct sway_output_state current; | 56 | struct sway_output_state current; |
43 | 57 | ||
58 | struct wl_listener layout_destroy; | ||
44 | struct wl_listener destroy; | 59 | struct wl_listener destroy; |
45 | struct wl_listener commit; | 60 | struct wl_listener commit; |
46 | struct wl_listener mode; | ||
47 | struct wl_listener present; | 61 | struct wl_listener present; |
48 | struct wl_listener damage_destroy; | 62 | struct wl_listener frame; |
49 | struct wl_listener damage_frame; | 63 | struct wl_listener request_state; |
50 | 64 | ||
51 | struct { | 65 | struct { |
52 | struct wl_signal destroy; | 66 | struct wl_signal disable; |
53 | } events; | 67 | } events; |
54 | 68 | ||
55 | struct timespec last_presentation; | 69 | struct timespec last_presentation; |
56 | uint32_t refresh_nsec; | 70 | uint32_t refresh_nsec; |
57 | int max_render_time; // In milliseconds | 71 | int max_render_time; // In milliseconds |
58 | struct wl_event_source *repaint_timer; | 72 | struct wl_event_source *repaint_timer; |
73 | bool gamma_lut_changed; | ||
74 | }; | ||
75 | |||
76 | struct sway_output_non_desktop { | ||
77 | struct wlr_output *wlr_output; | ||
78 | |||
79 | struct wl_listener destroy; | ||
59 | }; | 80 | }; |
60 | 81 | ||
61 | struct sway_output *output_create(struct wlr_output *wlr_output); | 82 | struct sway_output *output_create(struct wlr_output *wlr_output); |
@@ -72,22 +93,12 @@ struct sway_output *output_get_in_direction(struct sway_output *reference, | |||
72 | void output_add_workspace(struct sway_output *output, | 93 | void output_add_workspace(struct sway_output *output, |
73 | struct sway_workspace *workspace); | 94 | struct sway_workspace *workspace); |
74 | 95 | ||
75 | typedef void (*sway_surface_iterator_func_t)(struct sway_output *output, struct sway_view *view, | 96 | typedef void (*sway_surface_iterator_func_t)(struct sway_output *output, |
76 | struct wlr_surface *surface, struct wlr_box *box, float rotation, | 97 | struct sway_view *view, struct wlr_surface *surface, struct wlr_box *box, |
77 | void *user_data); | 98 | void *user_data); |
78 | 99 | ||
79 | void output_damage_whole(struct sway_output *output); | 100 | bool output_match_name_or_id(struct sway_output *output, |
80 | 101 | const char *name_or_id); | |
81 | void output_damage_surface(struct sway_output *output, double ox, double oy, | ||
82 | struct wlr_surface *surface, bool whole); | ||
83 | |||
84 | void output_damage_from_view(struct sway_output *output, | ||
85 | struct sway_view *view); | ||
86 | |||
87 | void output_damage_box(struct sway_output *output, struct wlr_box *box); | ||
88 | |||
89 | void output_damage_whole_container(struct sway_output *output, | ||
90 | struct sway_container *con); | ||
91 | 102 | ||
92 | // this ONLY includes the enabled outputs | 103 | // this ONLY includes the enabled outputs |
93 | struct sway_output *output_by_name_or_id(const char *name_or_id); | 104 | struct sway_output *output_by_name_or_id(const char *name_or_id); |
@@ -101,47 +112,8 @@ void output_enable(struct sway_output *output); | |||
101 | 112 | ||
102 | void output_disable(struct sway_output *output); | 113 | void output_disable(struct sway_output *output); |
103 | 114 | ||
104 | bool output_has_opaque_overlay_layer_surface(struct sway_output *output); | ||
105 | |||
106 | struct sway_workspace *output_get_active_workspace(struct sway_output *output); | 115 | struct sway_workspace *output_get_active_workspace(struct sway_output *output); |
107 | 116 | ||
108 | void output_render(struct sway_output *output, struct timespec *when, | ||
109 | pixman_region32_t *damage); | ||
110 | |||
111 | void output_surface_for_each_surface(struct sway_output *output, | ||
112 | struct wlr_surface *surface, double ox, double oy, | ||
113 | sway_surface_iterator_func_t iterator, void *user_data); | ||
114 | |||
115 | void output_view_for_each_surface(struct sway_output *output, | ||
116 | struct sway_view *view, sway_surface_iterator_func_t iterator, | ||
117 | void *user_data); | ||
118 | |||
119 | void output_view_for_each_popup_surface(struct sway_output *output, | ||
120 | struct sway_view *view, sway_surface_iterator_func_t iterator, | ||
121 | void *user_data); | ||
122 | |||
123 | void output_layer_for_each_surface(struct sway_output *output, | ||
124 | struct wl_list *layer_surfaces, sway_surface_iterator_func_t iterator, | ||
125 | void *user_data); | ||
126 | |||
127 | void output_layer_for_each_toplevel_surface(struct sway_output *output, | ||
128 | struct wl_list *layer_surfaces, sway_surface_iterator_func_t iterator, | ||
129 | void *user_data); | ||
130 | |||
131 | void output_layer_for_each_popup_surface(struct sway_output *output, | ||
132 | struct wl_list *layer_surfaces, sway_surface_iterator_func_t iterator, | ||
133 | void *user_data); | ||
134 | |||
135 | #if HAVE_XWAYLAND | ||
136 | void output_unmanaged_for_each_surface(struct sway_output *output, | ||
137 | struct wl_list *unmanaged, sway_surface_iterator_func_t iterator, | ||
138 | void *user_data); | ||
139 | #endif | ||
140 | |||
141 | void output_drag_icons_for_each_surface(struct sway_output *output, | ||
142 | struct wl_list *drag_icons, sway_surface_iterator_func_t iterator, | ||
143 | void *user_data); | ||
144 | |||
145 | void output_for_each_workspace(struct sway_output *output, | 117 | void output_for_each_workspace(struct sway_output *output, |
146 | void (*f)(struct sway_workspace *ws, void *data), void *data); | 118 | void (*f)(struct sway_workspace *ws, void *data), void *data); |
147 | 119 | ||
@@ -159,18 +131,12 @@ void output_get_box(struct sway_output *output, struct wlr_box *box); | |||
159 | enum sway_container_layout output_get_default_layout( | 131 | enum sway_container_layout output_get_default_layout( |
160 | struct sway_output *output); | 132 | struct sway_output *output); |
161 | 133 | ||
162 | void render_rect(struct sway_output *output, | ||
163 | pixman_region32_t *output_damage, const struct wlr_box *_box, | ||
164 | float color[static 4]); | ||
165 | |||
166 | void premultiply_alpha(float color[4], float opacity); | ||
167 | |||
168 | void scale_box(struct wlr_box *box, float scale); | ||
169 | |||
170 | enum wlr_direction opposite_direction(enum wlr_direction d); | 134 | enum wlr_direction opposite_direction(enum wlr_direction d); |
171 | 135 | ||
172 | void handle_output_layout_change(struct wl_listener *listener, void *data); | 136 | void handle_output_layout_change(struct wl_listener *listener, void *data); |
173 | 137 | ||
138 | void handle_gamma_control_set_gamma(struct wl_listener *listener, void *data); | ||
139 | |||
174 | void handle_output_manager_apply(struct wl_listener *listener, void *data); | 140 | void handle_output_manager_apply(struct wl_listener *listener, void *data); |
175 | 141 | ||
176 | void handle_output_manager_test(struct wl_listener *listener, void *data); | 142 | void handle_output_manager_test(struct wl_listener *listener, void *data); |
@@ -178,4 +144,6 @@ void handle_output_manager_test(struct wl_listener *listener, void *data); | |||
178 | void handle_output_power_manager_set_mode(struct wl_listener *listener, | 144 | void handle_output_power_manager_set_mode(struct wl_listener *listener, |
179 | void *data); | 145 | void *data); |
180 | 146 | ||
147 | struct sway_output_non_desktop *output_non_desktop_create(struct wlr_output *wlr_output); | ||
148 | |||
181 | #endif | 149 | #endif |