diff options
author | Luminarys <kizunanohikari@gmail.com> | 2015-08-17 10:18:06 -0500 |
---|---|---|
committer | Luminarys <kizunanohikari@gmail.com> | 2015-08-17 10:18:06 -0500 |
commit | 47ec999e7184d29c2911af20ce696d1f4e948e29 (patch) | |
tree | 15e595e631b97210708ffae99684eb6e00a9c70c /sway/container.c | |
parent | da77dc45a9fe8fd4c2d7db474d14257501dd1813 (diff) |
Fixes to floating and umanaged views
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) { view->name = strdup(title); view->visible = true; + view->desired_width = -1; + view->desired_height = -1; + // TODO: properly set this view->is_floating = false; @@ -149,6 +152,38 @@ swayc_t *new_view(swayc_t *sibling, wlc_handle handle) { return view; } +swayc_t *new_floating_view(wlc_handle handle) { + const char *title = wlc_view_get_title(handle); + swayc_t *view = new_swayc(C_VIEW); + sway_log(L_DEBUG, "Adding new view %u:%s as a floating view", + (unsigned int)handle, title); + //Setup values + view->handle = handle; + view->name = strdup(title); + view->visible = true; + + // Set the geometry of the floating view + const struct wlc_geometry* geometry = wlc_view_get_geometry(handle); + + view->x = geometry->origin.x; + view->y = geometry->origin.y; + view->width = geometry->size.w; + view->height = geometry->size.h; + + view->desired_width = -1; + view->desired_height = -1; + + view->is_floating = true; + + //Case of focused workspace, just create as child of it + list_add(active_workspace->floating, view); + view->parent = active_workspace; + if (active_workspace->focused == NULL) { + active_workspace->focused = view; + } + return view; +} + swayc_t *destroy_output(swayc_t *output) { if (output->children->length == 0) { |