mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-30 11:10:23 -04:00
input: Add support for xdg_toplevl.show_window_menu()
This makes, if the compositor supports it, the window menu appear when right clicking on the title bar.
This commit is contained in:
parent
c0ce131f1a
commit
38741baf9a
3 changed files with 20 additions and 8 deletions
10
input.c
10
input.c
|
|
@ -1924,6 +1924,16 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (button == BTN_RIGHT && tll_length(seat->mouse.buttons) == 1) {
|
||||||
|
struct csd_data info;
|
||||||
|
info = get_csd_data(term, CSD_SURF_TITLE);
|
||||||
|
xdg_toplevel_show_window_menu(
|
||||||
|
win->xdg_toplevel,
|
||||||
|
seat->wl_seat,
|
||||||
|
seat->pointer.serial,
|
||||||
|
seat->mouse.x + info.x, seat->mouse.y + info.y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (state == WL_POINTER_BUTTON_STATE_RELEASED) {
|
else if (state == WL_POINTER_BUTTON_STATE_RELEASED) {
|
||||||
|
|
|
||||||
9
render.c
9
render.c
|
|
@ -1521,14 +1521,7 @@ render_worker_thread(void *_ctx)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct csd_data {
|
struct csd_data
|
||||||
int x;
|
|
||||||
int y;
|
|
||||||
int width;
|
|
||||||
int height;
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct csd_data
|
|
||||||
get_csd_data(const struct terminal *term, enum csd_surface surf_idx)
|
get_csd_data(const struct terminal *term, enum csd_surface surf_idx)
|
||||||
{
|
{
|
||||||
xassert(term->window->csd_mode == CSD_YES);
|
xassert(term->window->csd_mode == CSD_YES);
|
||||||
|
|
|
||||||
9
render.h
9
render.h
|
|
@ -24,3 +24,12 @@ struct render_worker_context {
|
||||||
struct terminal *term;
|
struct terminal *term;
|
||||||
};
|
};
|
||||||
int render_worker_thread(void *_ctx);
|
int render_worker_thread(void *_ctx);
|
||||||
|
|
||||||
|
struct csd_data {
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct csd_data get_csd_data(const struct terminal *term, enum csd_surface surf_idx);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue