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