aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-01-02 15:06:35 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-01-02 15:06:35 +0000
commiteb1ea2d80dd71c2799a961ca636722b74eb32286 (patch)
treed63ee3ddc8605baf33dd0a083a890f2c18d99c2c
parentwayland: rename focused/moused to kbd_focus/mouse_focus (diff)
term: add visually focused attribute to terminal struct
-rw-r--r--terminal.h1
-rw-r--r--wayland.c17
2 files changed, 14 insertions, 4 deletions
diff --git a/terminal.h b/terminal.h
index a1c01942..e4eafe77 100644
--- a/terminal.h
+++ b/terminal.h
@@ -276,6 +276,7 @@ struct terminal {
struct wayland *wl;
struct wl_window *window;
+ bool visual_focus;
struct {
int scrollback_lines;
diff --git a/wayland.c b/wayland.c
index 380cc526..80300aba 100644
--- a/wayland.c
+++ b/wayland.c
@@ -411,12 +411,21 @@ xdg_toplevel_configure(void *data, struct xdg_toplevel *xdg_toplevel,
{
LOG_DBG("xdg-toplevel: configure: %dx%d", width, height);
- if (width <= 0 || height <= 0)
- return;
-
struct wayland *wayl = data;
struct terminal *term = wayl_terminal_from_xdg_toplevel(wayl, xdg_toplevel);
- render_resize(term, width, height);
+
+ bool is_focused = false;
+ enum xdg_toplevel_state *state;
+ wl_array_for_each(state, states) {
+ if (*state == XDG_TOPLEVEL_STATE_ACTIVATED) {
+ is_focused = true;
+ }
+ }
+
+ term->visual_focus = is_focused;
+
+ if (width >= 0 && height >= 0)
+ render_resize(term, width, height);
}
static void