diff options
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r-- | sway/tree/view.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c index 16d48cc9..9855c5e1 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -102,6 +102,15 @@ static void view_get_layout_box(struct sway_view *view, struct wlr_box *box) { | |||
102 | box->height = view->height; | 102 | box->height = view->height; |
103 | } | 103 | } |
104 | 104 | ||
105 | void view_for_each_surface(struct sway_view *view, | ||
106 | wlr_surface_iterator_func_t iterator, void *user_data) { | ||
107 | if (view->impl->for_each_surface) { | ||
108 | view->impl->for_each_surface(view, iterator, user_data); | ||
109 | } else { | ||
110 | wlr_surface_for_each_surface(view->surface, iterator, user_data); | ||
111 | } | ||
112 | } | ||
113 | |||
105 | static void view_subsurface_create(struct sway_view *view, | 114 | static void view_subsurface_create(struct sway_view *view, |
106 | struct wlr_subsurface *subsurface); | 115 | struct wlr_subsurface *subsurface); |
107 | 116 | ||
@@ -116,6 +125,18 @@ static void view_handle_surface_new_subsurface(struct wl_listener *listener, | |||
116 | view_subsurface_create(view, subsurface); | 125 | view_subsurface_create(view, subsurface); |
117 | } | 126 | } |
118 | 127 | ||
128 | static void surface_send_enter_iterator(struct wlr_surface *surface, | ||
129 | int x, int y, void *data) { | ||
130 | struct wlr_output *wlr_output = data; | ||
131 | wlr_surface_send_enter(surface, wlr_output); | ||
132 | } | ||
133 | |||
134 | static void surface_send_leave_iterator(struct wlr_surface *surface, | ||
135 | int x, int y, void *data) { | ||
136 | struct wlr_output *wlr_output = data; | ||
137 | wlr_surface_send_leave(surface, wlr_output); | ||
138 | } | ||
139 | |||
119 | static void view_handle_container_reparent(struct wl_listener *listener, | 140 | static void view_handle_container_reparent(struct wl_listener *listener, |
120 | void *data) { | 141 | void *data) { |
121 | struct sway_view *view = | 142 | struct sway_view *view = |
@@ -137,11 +158,11 @@ static void view_handle_container_reparent(struct wl_listener *listener, | |||
137 | } | 158 | } |
138 | 159 | ||
139 | if (old_output != NULL) { | 160 | if (old_output != NULL) { |
140 | wlr_surface_send_leave(view->surface, | 161 | view_for_each_surface(view, surface_send_leave_iterator, |
141 | old_output->sway_output->wlr_output); | 162 | old_output->sway_output->wlr_output); |
142 | } | 163 | } |
143 | if (new_output != NULL) { | 164 | if (new_output != NULL) { |
144 | wlr_surface_send_enter(view->surface, | 165 | view_for_each_surface(view, surface_send_enter_iterator, |
145 | new_output->sway_output->wlr_output); | 166 | new_output->sway_output->wlr_output); |
146 | } | 167 | } |
147 | } | 168 | } |
@@ -283,6 +304,14 @@ void view_child_init(struct sway_view_child *child, | |||
283 | wl_signal_add(&view->events.unmap, &child->view_unmap); | 304 | wl_signal_add(&view->events.unmap, &child->view_unmap); |
284 | child->view_unmap.notify = view_child_handle_view_unmap; | 305 | child->view_unmap.notify = view_child_handle_view_unmap; |
285 | 306 | ||
307 | struct sway_container *output = child->view->swayc->parent; | ||
308 | if (output != NULL) { | ||
309 | if (output->type != C_OUTPUT) { | ||
310 | output = container_parent(output, C_OUTPUT); | ||
311 | } | ||
312 | wlr_surface_send_enter(child->surface, output->sway_output->wlr_output); | ||
313 | } | ||
314 | |||
286 | view_init_subsurfaces(child->view, surface); | 315 | view_init_subsurfaces(child->view, surface); |
287 | 316 | ||
288 | // TODO: only damage the whole child | 317 | // TODO: only damage the whole child |