diff options
-rw-r--r-- | include/sway/desktop.h | 7 | ||||
-rw-r--r-- | include/sway/output.h | 3 | ||||
-rw-r--r-- | sway/desktop/desktop.c | 20 | ||||
-rw-r--r-- | sway/desktop/output.c | 6 | ||||
-rw-r--r-- | sway/desktop/xwayland.c | 22 | ||||
-rw-r--r-- | sway/meson.build | 1 |
6 files changed, 50 insertions, 9 deletions
diff --git a/include/sway/desktop.h b/include/sway/desktop.h new file mode 100644 index 00000000..96bdc94c --- /dev/null +++ b/include/sway/desktop.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #include <wlr/types/wlr_surface.h> | ||
2 | |||
3 | void desktop_damage_whole_surface(struct wlr_surface *surface, double lx, | ||
4 | double ly); | ||
5 | |||
6 | void desktop_damage_from_surface(struct wlr_surface *surface, double lx, | ||
7 | double ly); | ||
diff --git a/include/sway/output.h b/include/sway/output.h index 98d0f83f..9964a484 100644 --- a/include/sway/output.h +++ b/include/sway/output.h | |||
@@ -37,6 +37,9 @@ void output_damage_whole(struct sway_output *output); | |||
37 | void output_damage_whole_view(struct sway_output *output, | 37 | void output_damage_whole_view(struct sway_output *output, |
38 | struct sway_view *view); | 38 | struct sway_view *view); |
39 | 39 | ||
40 | void output_damage_whole_surface(struct sway_output *output, | ||
41 | struct wlr_surface *surface, double ox, double oy); | ||
42 | |||
40 | struct sway_container *output_by_name(const char *name); | 43 | struct sway_container *output_by_name(const char *name); |
41 | 44 | ||
42 | #endif | 45 | #endif |
diff --git a/sway/desktop/desktop.c b/sway/desktop/desktop.c new file mode 100644 index 00000000..78a2d49f --- /dev/null +++ b/sway/desktop/desktop.c | |||
@@ -0,0 +1,20 @@ | |||
1 | #include "sway/tree/container.h" | ||
2 | #include "sway/desktop.h" | ||
3 | #include "sway/output.h" | ||
4 | |||
5 | void desktop_damage_whole_surface(struct wlr_surface *surface, double lx, | ||
6 | double ly) { | ||
7 | for (int i = 0; i < root_container.children->length; ++i) { | ||
8 | struct sway_container *cont = root_container.children->items[i]; | ||
9 | if (cont->type == C_OUTPUT) { | ||
10 | output_damage_whole_surface(cont->sway_output, surface, | ||
11 | lx - cont->x, ly - cont->y); | ||
12 | } | ||
13 | } | ||
14 | } | ||
15 | |||
16 | void desktop_damage_from_surface(struct wlr_surface *surface, double lx, | ||
17 | double ly) { | ||
18 | // TODO | ||
19 | desktop_damage_whole_surface(surface, lx, ly); | ||
20 | } | ||
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 0e8a9485..0ae5e782 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -341,6 +341,12 @@ void output_damage_whole_view(struct sway_output *output, | |||
341 | output_damage_whole(output); | 341 | output_damage_whole(output); |
342 | } | 342 | } |
343 | 343 | ||
344 | void output_damage_whole_surface(struct sway_output *output, | ||
345 | struct wlr_surface *surface, double ox, double oy) { | ||
346 | // TODO | ||
347 | output_damage_whole(output); | ||
348 | } | ||
349 | |||
344 | static void damage_handle_destroy(struct wl_listener *listener, void *data) { | 350 | static void damage_handle_destroy(struct wl_listener *listener, void *data) { |
345 | struct sway_output *output = | 351 | struct sway_output *output = |
346 | wl_container_of(listener, output, damage_destroy); | 352 | wl_container_of(listener, output, damage_destroy); |
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index 3842c2c8..4797b801 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c | |||
@@ -2,17 +2,18 @@ | |||
2 | #include <stdbool.h> | 2 | #include <stdbool.h> |
3 | #include <stdlib.h> | 3 | #include <stdlib.h> |
4 | #include <wayland-server.h> | 4 | #include <wayland-server.h> |
5 | #include <wlr/xwayland.h> | ||
6 | #include <wlr/types/wlr_output_layout.h> | 5 | #include <wlr/types/wlr_output_layout.h> |
7 | #include <wlr/types/wlr_output.h> | 6 | #include <wlr/types/wlr_output.h> |
7 | #include <wlr/xwayland.h> | ||
8 | #include "log.h" | ||
9 | #include "sway/desktop.h" | ||
10 | #include "sway/input/input-manager.h" | ||
11 | #include "sway/input/seat.h" | ||
12 | #include "sway/output.h" | ||
13 | #include "sway/server.h" | ||
8 | #include "sway/tree/container.h" | 14 | #include "sway/tree/container.h" |
9 | #include "sway/tree/layout.h" | 15 | #include "sway/tree/layout.h" |
10 | #include "sway/server.h" | ||
11 | #include "sway/tree/view.h" | 16 | #include "sway/tree/view.h" |
12 | #include "sway/output.h" | ||
13 | #include "sway/input/seat.h" | ||
14 | #include "sway/input/input-manager.h" | ||
15 | #include "log.h" | ||
16 | 17 | ||
17 | static void unmanaged_handle_request_configure(struct wl_listener *listener, | 18 | static void unmanaged_handle_request_configure(struct wl_listener *listener, |
18 | void *data) { | 19 | void *data) { |
@@ -27,7 +28,9 @@ static void unmanaged_handle_request_configure(struct wl_listener *listener, | |||
27 | static void unmanaged_handle_commit(struct wl_listener *listener, void *data) { | 28 | static void unmanaged_handle_commit(struct wl_listener *listener, void *data) { |
28 | struct sway_xwayland_unmanaged *surface = | 29 | struct sway_xwayland_unmanaged *surface = |
29 | wl_container_of(listener, surface, commit); | 30 | wl_container_of(listener, surface, commit); |
30 | // TODO: damage tracking | 31 | struct wlr_xwayland_surface *xsurface = surface->wlr_xwayland_surface; |
32 | desktop_damage_from_surface(xsurface->surface, xsurface->x, xsurface->y); | ||
33 | // TODO: handle window motion | ||
31 | } | 34 | } |
32 | 35 | ||
33 | static void unmanaged_handle_map(struct wl_listener *listener, void *data) { | 36 | static void unmanaged_handle_map(struct wl_listener *listener, void *data) { |
@@ -38,15 +41,16 @@ static void unmanaged_handle_map(struct wl_listener *listener, void *data) { | |||
38 | &surface->link); | 41 | &surface->link); |
39 | wl_signal_add(&xsurface->surface->events.commit, &surface->commit); | 42 | wl_signal_add(&xsurface->surface->events.commit, &surface->commit); |
40 | surface->commit.notify = unmanaged_handle_commit; | 43 | surface->commit.notify = unmanaged_handle_commit; |
41 | // TODO: damage tracking | 44 | desktop_damage_whole_surface(xsurface->surface, xsurface->x, xsurface->y); |
42 | } | 45 | } |
43 | 46 | ||
44 | static void unmanaged_handle_unmap(struct wl_listener *listener, void *data) { | 47 | static void unmanaged_handle_unmap(struct wl_listener *listener, void *data) { |
45 | struct sway_xwayland_unmanaged *surface = | 48 | struct sway_xwayland_unmanaged *surface = |
46 | wl_container_of(listener, surface, unmap); | 49 | wl_container_of(listener, surface, unmap); |
50 | struct wlr_xwayland_surface *xsurface = surface->wlr_xwayland_surface; | ||
51 | desktop_damage_whole_surface(xsurface->surface, xsurface->x, xsurface->y); | ||
47 | wl_list_remove(&surface->link); | 52 | wl_list_remove(&surface->link); |
48 | wl_list_remove(&surface->commit.link); | 53 | wl_list_remove(&surface->commit.link); |
49 | // TODO: damage tracking | ||
50 | } | 54 | } |
51 | 55 | ||
52 | static void unmanaged_handle_destroy(struct wl_listener *listener, void *data) { | 56 | static void unmanaged_handle_destroy(struct wl_listener *listener, void *data) { |
diff --git a/sway/meson.build b/sway/meson.build index ec7b4c42..29aaa7b7 100644 --- a/sway/meson.build +++ b/sway/meson.build | |||
@@ -8,6 +8,7 @@ sway_sources = files( | |||
8 | 'ipc-server.c', | 8 | 'ipc-server.c', |
9 | 'security.c', | 9 | 'security.c', |
10 | 10 | ||
11 | 'desktop/desktop.c', | ||
11 | 'desktop/output.c', | 12 | 'desktop/output.c', |
12 | 'desktop/layer_shell.c', | 13 | 'desktop/layer_shell.c', |
13 | 'desktop/wl_shell.c', | 14 | 'desktop/wl_shell.c', |