diff options
Diffstat (limited to 'sway/container.c')
-rw-r--r-- | sway/container.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/sway/container.c b/sway/container.c index 87e48e91..1f93d4dc 100644 --- a/sway/container.c +++ b/sway/container.c | |||
@@ -135,6 +135,9 @@ swayc_t *new_view(swayc_t *sibling, wlc_handle handle) { | |||
135 | view->name = strdup(title); | 135 | view->name = strdup(title); |
136 | view->visible = true; | 136 | view->visible = true; |
137 | 137 | ||
138 | view->desired_width = -1; | ||
139 | view->desired_height = -1; | ||
140 | |||
138 | // TODO: properly set this | 141 | // TODO: properly set this |
139 | view->is_floating = false; | 142 | view->is_floating = false; |
140 | 143 | ||
@@ -149,6 +152,38 @@ swayc_t *new_view(swayc_t *sibling, wlc_handle handle) { | |||
149 | return view; | 152 | return view; |
150 | } | 153 | } |
151 | 154 | ||
155 | swayc_t *new_floating_view(wlc_handle handle) { | ||
156 | const char *title = wlc_view_get_title(handle); | ||
157 | swayc_t *view = new_swayc(C_VIEW); | ||
158 | sway_log(L_DEBUG, "Adding new view %u:%s as a floating view", | ||
159 | (unsigned int)handle, title); | ||
160 | //Setup values | ||
161 | view->handle = handle; | ||
162 | view->name = strdup(title); | ||
163 | view->visible = true; | ||
164 | |||
165 | // Set the geometry of the floating view | ||
166 | const struct wlc_geometry* geometry = wlc_view_get_geometry(handle); | ||
167 | |||
168 | view->x = geometry->origin.x; | ||
169 | view->y = geometry->origin.y; | ||
170 | view->width = geometry->size.w; | ||
171 | view->height = geometry->size.h; | ||
172 | |||
173 | view->desired_width = -1; | ||
174 | view->desired_height = -1; | ||
175 | |||
176 | view->is_floating = true; | ||
177 | |||
178 | //Case of focused workspace, just create as child of it | ||
179 | list_add(active_workspace->floating, view); | ||
180 | view->parent = active_workspace; | ||
181 | if (active_workspace->focused == NULL) { | ||
182 | active_workspace->focused = view; | ||
183 | } | ||
184 | return view; | ||
185 | } | ||
186 | |||
152 | 187 | ||
153 | swayc_t *destroy_output(swayc_t *output) { | 188 | swayc_t *destroy_output(swayc_t *output) { |
154 | if (output->children->length == 0) { | 189 | if (output->children->length == 0) { |