Merge pull request #42 from tiosgz/view-geom
Various view geometry-related fixes
This commit is contained in:
commit
c8d7c7d547
3 changed files with 14 additions and 11 deletions
|
@ -105,8 +105,8 @@ desktop_active_output(struct kiwmi_server *server)
|
||||||
break; // get first element of list
|
break; // get first element of list
|
||||||
}
|
}
|
||||||
|
|
||||||
double lx = view->geom.x + view->geom.width / 2;
|
double lx = view->x + view->geom.width / 2;
|
||||||
double ly = view->geom.y + view->geom.height / 2;
|
double ly = view->y + view->geom.height / 2;
|
||||||
|
|
||||||
struct wlr_output *wlr_output =
|
struct wlr_output *wlr_output =
|
||||||
wlr_output_layout_output_at(server->desktop.output_layout, lx, ly);
|
wlr_output_layout_output_at(server->desktop.output_layout, lx, ly);
|
||||||
|
|
|
@ -388,10 +388,11 @@ xdg_shell_view_get_size(
|
||||||
uint32_t *width,
|
uint32_t *width,
|
||||||
uint32_t *height)
|
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;
|
*width = geom.width;
|
||||||
*height = geom->height;
|
*height = geom.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
|
|
|
@ -47,29 +47,31 @@ process_cursor_motion(struct kiwmi_server *server, uint32_t time)
|
||||||
int dy = cursor->cursor->y - cursor->grabbed.orig_y;
|
int dy = cursor->cursor->y - cursor->grabbed.orig_y;
|
||||||
|
|
||||||
struct wlr_box new_geom = {
|
struct wlr_box new_geom = {
|
||||||
.x = view->x,
|
.x = cursor->grabbed.orig_geom.x,
|
||||||
.y = view->y,
|
.y = cursor->grabbed.orig_geom.y,
|
||||||
.width = cursor->grabbed.orig_geom.width,
|
.width = cursor->grabbed.orig_geom.width,
|
||||||
.height = cursor->grabbed.orig_geom.height,
|
.height = cursor->grabbed.orig_geom.height,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (cursor->grabbed.resize_edges & WLR_EDGE_TOP) {
|
if (cursor->grabbed.resize_edges & WLR_EDGE_TOP) {
|
||||||
new_geom.y = cursor->grabbed.orig_y + dy;
|
new_geom.y += dy;
|
||||||
new_geom.height -= dy;
|
new_geom.height -= dy;
|
||||||
if (new_geom.height < 1) {
|
if (new_geom.height < 1) {
|
||||||
new_geom.y += new_geom.height;
|
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;
|
new_geom.height += dy;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursor->grabbed.resize_edges & WLR_EDGE_LEFT) {
|
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;
|
new_geom.width -= dx;
|
||||||
if (new_geom.width < 1) {
|
if (new_geom.width < 1) {
|
||||||
new_geom.x += new_geom.width;
|
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;
|
new_geom.width += dx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue