Skip to content

Commit

Permalink
react to wlroots changes
Browse files Browse the repository at this point in the history
  • Loading branch information
keithbowes committed Aug 17, 2024
1 parent 88ce9ad commit 19339ac
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
4 changes: 4 additions & 0 deletions waybox/cursor.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,12 @@ static void process_cursor_resize(struct wb_server *server) {
}
}

#if WLR_CHECK_VERSION(0, 19, 0)
struct wlr_box geo_box = toplevel->xdg_toplevel->base->geometry;
#else
struct wlr_box geo_box;
wlr_xdg_surface_get_geometry(toplevel->xdg_toplevel->base, &geo_box);
#endif
toplevel->geometry.x = new_left - geo_box.x;
toplevel->geometry.y = new_top - geo_box.y;
wlr_scene_node_set_position(&toplevel->scene_tree->node,
Expand Down
4 changes: 4 additions & 0 deletions waybox/seat.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,12 @@ static bool handle_keybinding(struct wb_server *server, xkb_keysym_t sym, uint32
if (key_binding->action & ACTION_SHADE) {
struct wb_toplevel *toplevel = wl_container_of(server->toplevels.next, toplevel, link);
if (toplevel->scene_tree->node.enabled) {
#if WLR_CHECK_VERSION(0, 19, 0)
struct wlr_box geo_box = toplevel->xdg_toplevel->base->geometry;
#else
struct wlr_box geo_box;
wlr_xdg_surface_get_geometry(toplevel->xdg_toplevel->base, &geo_box);
#endif
int decoration_height = MAX(geo_box.y - toplevel->geometry.y, TITLEBAR_HEIGHT);

toplevel->previous_geometry = toplevel->geometry;
Expand Down
10 changes: 9 additions & 1 deletion waybox/xdg_shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,13 @@ static void xdg_toplevel_map(struct wl_listener *listener, void *data) {
return;

struct wb_config *config = toplevel->server->config;
struct wlr_box geo_box = {0};
struct wlr_box usable_area = get_usable_area(toplevel);
#if WLR_CHECK_VERSION(0, 19, 0)
struct wlr_box geo_box = toplevel->xdg_toplevel->base->geometry;
#else
struct wlr_box geo_box = {0};
wlr_xdg_surface_get_geometry(toplevel->xdg_toplevel->base, &geo_box);
#endif

if (config) {
toplevel->geometry.height = MIN(geo_box.height,
Expand Down Expand Up @@ -318,8 +322,12 @@ static void begin_interactive(struct wb_toplevel *toplevel,
server->grab_x = server->cursor->cursor->x - toplevel->geometry.x;
server->grab_y = server->cursor->cursor->y - toplevel->geometry.y;
} else if (mode == WB_CURSOR_RESIZE) {
#if WLR_CHECK_VERSION(0, 19, 0)
struct wlr_box geo_box = toplevel->xdg_toplevel->base->geometry;
#else
struct wlr_box geo_box;
wlr_xdg_surface_get_geometry(toplevel->xdg_toplevel->base, &geo_box);
#endif

double border_x = (toplevel->geometry.x + geo_box.x) +
((edges & WLR_EDGE_RIGHT) ? geo_box.width : 0);
Expand Down

0 comments on commit 19339ac

Please sign in to comment.