Merge pull request #42 from tiosgz/view-geom

Various view geometry-related fixes
This commit is contained in:
Niclas 2021-10-08 17:07:50 +00:00 committed by GitHub
commit c8d7c7d547
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 11 deletions

View file

@ -105,8 +105,8 @@ desktop_active_output(struct kiwmi_server *server)
break; // get first element of list
}
double lx = view->geom.x + view->geom.width / 2;
double ly = view->geom.y + view->geom.height / 2;
double lx = view->x + view->geom.width / 2;
double ly = view->y + view->geom.height / 2;
struct wlr_output *wlr_output =
wlr_output_layout_output_at(server->desktop.output_layout, lx, ly);

View file

@ -388,10 +388,11 @@ xdg_shell_view_get_size(
uint32_t *width,
uint32_t *height)
{
struct wlr_box *geom = &view->xdg_surface->geometry;
struct wlr_box geom;
wlr_xdg_surface_get_geometry(view->xdg_surface, &geom);
*width = geom->width;
*height = geom->height;
*width = geom.width;
*height = geom.height;
}
static const char *

View file

@ -47,29 +47,31 @@ process_cursor_motion(struct kiwmi_server *server, uint32_t time)
int dy = cursor->cursor->y - cursor->grabbed.orig_y;
struct wlr_box new_geom = {
.x = view->x,
.y = view->y,
.x = cursor->grabbed.orig_geom.x,
.y = cursor->grabbed.orig_geom.y,
.width = cursor->grabbed.orig_geom.width,
.height = cursor->grabbed.orig_geom.height,
};
if (cursor->grabbed.resize_edges & WLR_EDGE_TOP) {
new_geom.y = cursor->grabbed.orig_y + dy;
new_geom.y += dy;
new_geom.height -= dy;
if (new_geom.height < 1) {
new_geom.y += new_geom.height;
}
} else if (cursor->grabbed.resize_edges & WLR_EDGE_BOTTOM) {
}
if (cursor->grabbed.resize_edges & WLR_EDGE_BOTTOM) {
new_geom.height += dy;
}
if (cursor->grabbed.resize_edges & WLR_EDGE_LEFT) {
new_geom.x = cursor->grabbed.orig_geom.x + dx;
new_geom.x += dx;
new_geom.width -= dx;
if (new_geom.width < 1) {
new_geom.x += new_geom.width;
}
} else if (cursor->grabbed.resize_edges & WLR_EDGE_RIGHT) {
}
if (cursor->grabbed.resize_edges & WLR_EDGE_RIGHT) {
new_geom.width += dx;
}