aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2021-11-19 14:08:46 +0000
committerJonas Ådahl <jadahl@gmail.com>2021-11-29 15:26:40 +0000
commit38741baf9afc2697c7e508cb87c3b2983de9f0af (patch)
tree18ff10e6abcc20a14dcde8dcf2a1ab736a3b95ca
parentinput: Update mouse x/y coordinates on wl_pointer_enter (diff)
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.
-rw-r--r--input.c10
-rw-r--r--render.c9
-rw-r--r--render.h9
3 files changed, 20 insertions, 8 deletions
diff --git a/input.c b/input.c
index 35baf3d4..7e0cde75 100644
--- a/input.c
+++ b/input.c
@@ -1924,6 +1924,16 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
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) {
diff --git a/render.c b/render.c
index 46cc0f75..76fe7c95 100644
--- a/render.c
+++ b/render.c
@@ -1521,14 +1521,7 @@ render_worker_thread(void *_ctx)
return -1;
}
-struct csd_data {
- int x;
- int y;
- int width;
- int height;
-};
-
-static struct csd_data
+struct csd_data
get_csd_data(const struct terminal *term, enum csd_surface surf_idx)
{
xassert(term->window->csd_mode == CSD_YES);
diff --git a/render.h b/render.h
index 1179a5dc..145aaba8 100644
--- a/render.h
+++ b/render.h
@@ -24,3 +24,12 @@ struct render_worker_context {
struct terminal *term;
};
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);