mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
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.
This commit is contained in:
parent
2798807853
commit
7f270a9f01
2 changed files with 36 additions and 0 deletions
21
terminal.c
21
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;
|
||||
}
|
||||
|
|
|
|||
15
terminal.h
15
terminal.h
|
|
@ -185,6 +185,17 @@ struct sixel {
|
|||
struct coord pos;
|
||||
};
|
||||
|
||||
enum term_surface {
|
||||
TERM_SURF_NONE,
|
||||
TERM_SURF_GRID,
|
||||
TERM_SURF_SEARCH,
|
||||
TERM_SURF_TITLE,
|
||||
TERM_SURF_BORDER_LEFT,
|
||||
TERM_SURF_BORDER_RIGHT,
|
||||
TERM_SURF_BORDER_TOP,
|
||||
TERM_SURF_BORDER_BOTTOM,
|
||||
};
|
||||
|
||||
struct terminal {
|
||||
struct fdm *fdm;
|
||||
const struct config *conf;
|
||||
|
|
@ -312,6 +323,7 @@ struct terminal {
|
|||
struct wayland *wl;
|
||||
struct wl_window *window;
|
||||
bool visual_focus;
|
||||
enum term_surface active_surface;
|
||||
|
||||
struct {
|
||||
bool refresh_needed; /* Terminal needs to be re-rendered, as soon-as-possible */
|
||||
|
|
@ -477,3 +489,6 @@ bool term_spawn_new(const struct terminal *term);
|
|||
|
||||
void term_enable_app_sync_updates(struct terminal *term);
|
||||
void term_disable_app_sync_updates(struct terminal *term);
|
||||
|
||||
enum term_surface term_surface_kind(
|
||||
const struct terminal *term, const struct wl_surface *surface);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue