aboutsummaryrefslogtreecommitdiff
path: root/terminal.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-02-24 21:38:35 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-02-24 21:38:35 +0000
commit7f270a9f01f8c2674a29a1fcd1b91c8ea67cf6ea (patch)
tree081744977ec0e47241e4839d192c222aa220d584 /terminal.c
parentrender: csd: render all borders and the title bar (diff)
term: add term_surface_kind(), and track currently active surface
This is needed to handle pointer motion and button events correctly, since mouse actions in e.g. CSD surfaces are very different from mouse actions in the main window.
Diffstat (limited to 'terminal.c')
-rw-r--r--terminal.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/terminal.c b/terminal.c
index 3977caae..d97354cd 100644
--- a/terminal.c
+++ b/terminal.c
@@ -2133,3 +2133,24 @@ term_print(struct terminal *term, wchar_t wc, int width)
else
term->cursor.lcf = true;
}
+
+enum term_surface
+term_surface_kind(const struct terminal *term, const struct wl_surface *surface)
+{
+ if (surface == term->window->surface)
+ return TERM_SURF_GRID;
+ else if (surface == term->window->search_surface)
+ return TERM_SURF_SEARCH;
+ else if (surface == term->window->csd.surface[0])
+ return TERM_SURF_TITLE;
+ else if (surface == term->window->csd.surface[1])
+ return TERM_SURF_BORDER_LEFT;
+ else if (surface == term->window->csd.surface[2])
+ return TERM_SURF_BORDER_RIGHT;
+ else if (surface == term->window->csd.surface[3])
+ return TERM_SURF_BORDER_TOP;
+ else if (surface == term->window->csd.surface[4])
+ return TERM_SURF_BORDER_BOTTOM;
+ else
+ return TERM_SURF_NONE;
+}