diff --git a/include/labwc.h b/include/labwc.h index e422d4b8..40b7e351 100644 --- a/include/labwc.h +++ b/include/labwc.h @@ -545,6 +545,9 @@ struct cursor_context get_cursor_context(struct server *server); */ void cursor_set(struct seat *seat, const char *cursor_name); +uint32_t cursor_get_resize_edges(struct wlr_cursor *cursor, + struct cursor_context *ctx); + /** * cursor_update_focus - update cursor focus, may update the cursor icon * @server - server diff --git a/src/action.c b/src/action.c index 9eb81cf7..44564447 100644 --- a/src/action.c +++ b/src/action.c @@ -167,7 +167,7 @@ show_menu(struct server *server, struct view *view, const char *menu_name) static struct view * view_for_action(struct view *activator, struct server *server, - struct action *action) + struct action *action, uint32_t *resize_edges) { /* View is explicitly specified for mousebinds */ if (activator) { @@ -178,8 +178,15 @@ view_for_action(struct view *activator, struct server *server, switch (action->type) { case ACTION_TYPE_FOCUS: case ACTION_TYPE_MOVE: - case ACTION_TYPE_RESIZE: - return get_cursor_context(server).view; + case ACTION_TYPE_RESIZE: { + struct cursor_context ctx = get_cursor_context(server); + if (action->type == ACTION_TYPE_RESIZE) { + /* Select resize edges for the keybind case */ + *resize_edges = cursor_get_resize_edges( + server->seat.cursor, &ctx); + } + return ctx.view; + } default: return desktop_focused_view(server); } @@ -208,7 +215,8 @@ actions_run(struct view *activator, struct server *server, * Refetch view because it may have been changed due to the * previous action */ - view = view_for_action(activator, server, action); + view = view_for_action(activator, server, action, + &resize_edges); switch (action->type) { case ACTION_TYPE_CLOSE: diff --git a/src/cursor.c b/src/cursor.c index ef128300..60997a20 100644 --- a/src/cursor.c +++ b/src/cursor.c @@ -378,8 +378,8 @@ cursor_update_common(struct server *server, struct cursor_context *ctx, } } -static uint32_t -determine_resize_edges(struct wlr_cursor *cursor, struct cursor_context *ctx) +uint32_t +cursor_get_resize_edges(struct wlr_cursor *cursor, struct cursor_context *ctx) { uint32_t resize_edges = ssd_resize_edges(ctx->type); if (ctx->view && !resize_edges) { @@ -783,7 +783,7 @@ cursor_button_press(struct seat *seat, struct wlr_pointer_button_event *event) struct cursor_context ctx = get_cursor_context(server); /* Determine closest resize edges in case action is Resize */ - uint32_t resize_edges = determine_resize_edges(seat->cursor, &ctx); + uint32_t resize_edges = cursor_get_resize_edges(seat->cursor, &ctx); if (ctx.view || ctx.surface) { /* Store resize edges for later action processing */