Fixes to floating and umanaged views

This commit is contained in:
Luminarys 2015-08-17 10:18:06 -05:00
parent da77dc45a9
commit 47ec999e71
5 changed files with 99 additions and 14 deletions

View file

@ -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) {