static bool set_size_floating(int new_dimension, bool use_width) { swayc_t *view = get_focused_float(swayc_active_workspace()); if (view) { if (use_width) { int current_width = view->width; view->desired_width = new_dimension; floating_view_sane_size(view); int new_x = view->x + (int)(((view->desired_width - current_width) / 2) * -1); view->width = view->desired_width; view->x = new_x; update_geometry(view); } else { int current_height = view->height; view->desired_height = new_dimension; floating_view_sane_size(view); int new_y = view->y + (int)(((view->desired_height - current_height) / 2) * -1); view->height = view->desired_height; view->y = new_y; update_geometry(view); } return true; } return false; }
static bool resize_floating(int amount, bool use_width) { swayc_t *view = get_focused_float(swayc_active_workspace()); if (view) { if (use_width) { return set_size_floating(view->width + amount, true); } else { return set_size_floating(view->height + amount, false); } } return false; }
swayc_t *get_focused_view_include_floating(swayc_t *parent) { swayc_t *c = parent; swayc_t *f = NULL; while (c && c->type != C_VIEW) { if (c->type == C_WORKSPACE && c->focused == NULL) { return ((f = get_focused_float(c))) ? f : c; } c = c->focused; } if (c == NULL) { c = swayc_active_workspace_for(parent); } return c; }