mirror of
https://github.com/labwc/labwc.git
synced 2026-04-12 08:21:13 -04:00
action: place menu at topleft of window when opened by leftmost button
It will be more natural to place the menu at the topleft of the window
when opened by the leftmost button just like before 8b1831c7.
Suggested by @johanmalm.
This commit is contained in:
parent
04a145f89a
commit
3d022f08c0
1 changed files with 12 additions and 2 deletions
14
src/action.c
14
src/action.c
|
|
@ -617,6 +617,16 @@ action_list_free(struct wl_list *action_list)
|
|||
}
|
||||
}
|
||||
|
||||
static enum ssd_part_type
|
||||
get_leftmost_button_type(void)
|
||||
{
|
||||
struct title_button *b;
|
||||
wl_list_for_each(b, &rc.title_buttons_left, link) {
|
||||
return b->type;
|
||||
}
|
||||
return LAB_SSD_NONE;
|
||||
}
|
||||
|
||||
static void
|
||||
show_menu(struct server *server, struct view *view, struct cursor_context *ctx,
|
||||
const char *menu_name, bool at_cursor,
|
||||
|
|
@ -659,8 +669,8 @@ show_menu(struct server *server, struct view *view, struct cursor_context *ctx,
|
|||
x = view->current.x;
|
||||
y = view->current.y;
|
||||
/* Push the client menu underneath the button */
|
||||
if (is_client_menu && ssd_part_contains(
|
||||
LAB_SSD_BUTTON, ctx->type)) {
|
||||
if (is_client_menu && ssd_part_contains(LAB_SSD_BUTTON, ctx->type)
|
||||
&& ctx->type != get_leftmost_button_type()) {
|
||||
assert(ctx->node);
|
||||
int ly;
|
||||
wlr_scene_node_coords(ctx->node, &x, &ly);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue