aboutsummaryrefslogtreecommitdiffstats
path: root/include/sway/output.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/sway/output.h')
-rw-r--r--include/sway/output.h114
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
20struct sway_output { 21struct 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
76struct sway_output_non_desktop {
77 struct wlr_output *wlr_output;
78
79 struct wl_listener destroy;
59}; 80};
60 81
61struct sway_output *output_create(struct wlr_output *wlr_output); 82struct sway_output *output_create(struct wlr_output *wlr_output);
@@ -72,22 +93,12 @@ struct sway_output *output_get_in_direction(struct sway_output *reference,
72void output_add_workspace(struct sway_output *output, 93void output_add_workspace(struct sway_output *output,
73 struct sway_workspace *workspace); 94 struct sway_workspace *workspace);
74 95
75typedef void (*sway_surface_iterator_func_t)(struct sway_output *output, struct sway_view *view, 96typedef 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
79void output_damage_whole(struct sway_output *output); 100bool output_match_name_or_id(struct sway_output *output,
80 101 const char *name_or_id);
81void output_damage_surface(struct sway_output *output, double ox, double oy,
82 struct wlr_surface *surface, bool whole);
83
84void output_damage_from_view(struct sway_output *output,
85 struct sway_view *view);
86
87void output_damage_box(struct sway_output *output, struct wlr_box *box);
88
89void 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
93struct sway_output *output_by_name_or_id(const char *name_or_id); 104struct 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
102void output_disable(struct sway_output *output); 113void output_disable(struct sway_output *output);
103 114
104bool output_has_opaque_overlay_layer_surface(struct sway_output *output);
105
106struct sway_workspace *output_get_active_workspace(struct sway_output *output); 115struct sway_workspace *output_get_active_workspace(struct sway_output *output);
107 116
108void output_render(struct sway_output *output, struct timespec *when,
109 pixman_region32_t *damage);
110
111void 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
115void 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
119void 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
123void 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
127void 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
131void 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
136void 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
141void 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
145void output_for_each_workspace(struct sway_output *output, 117void 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);
159enum sway_container_layout output_get_default_layout( 131enum sway_container_layout output_get_default_layout(
160 struct sway_output *output); 132 struct sway_output *output);
161 133
162void render_rect(struct sway_output *output,
163 pixman_region32_t *output_damage, const struct wlr_box *_box,
164 float color[static 4]);
165
166void premultiply_alpha(float color[4], float opacity);
167
168void scale_box(struct wlr_box *box, float scale);
169
170enum wlr_direction opposite_direction(enum wlr_direction d); 134enum wlr_direction opposite_direction(enum wlr_direction d);
171 135
172void handle_output_layout_change(struct wl_listener *listener, void *data); 136void handle_output_layout_change(struct wl_listener *listener, void *data);
173 137
138void handle_gamma_control_set_gamma(struct wl_listener *listener, void *data);
139
174void handle_output_manager_apply(struct wl_listener *listener, void *data); 140void handle_output_manager_apply(struct wl_listener *listener, void *data);
175 141
176void handle_output_manager_test(struct wl_listener *listener, void *data); 142void 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);
178void handle_output_power_manager_set_mode(struct wl_listener *listener, 144void handle_output_power_manager_set_mode(struct wl_listener *listener,
179 void *data); 145 void *data);
180 146
147struct sway_output_non_desktop *output_non_desktop_create(struct wlr_output *wlr_output);
148
181#endif 149#endif