diff --git a/kiwmi/desktop/desktop.c b/kiwmi/desktop/desktop.c index add373e..d6dee0b 100644 --- a/kiwmi/desktop/desktop.c +++ b/kiwmi/desktop/desktop.c @@ -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); diff --git a/kiwmi/desktop/xdg_shell.c b/kiwmi/desktop/xdg_shell.c index 8e9dabb..d24ab50 100644 --- a/kiwmi/desktop/xdg_shell.c +++ b/kiwmi/desktop/xdg_shell.c @@ -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 * diff --git a/kiwmi/input/cursor.c b/kiwmi/input/cursor.c index c15e1fa..6fff8ec 100644 --- a/kiwmi/input/cursor.c +++ b/kiwmi/input/cursor.c @@ -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; }