mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-04 01:40:21 -05:00
commit
544cd823d7
2 changed files with 12 additions and 0 deletions
11
ime.c
11
ime.c
|
|
@ -26,6 +26,7 @@ enter(void *data, struct zwp_text_input_v3 *zwp_text_input_v3,
|
||||||
|
|
||||||
/* The main grid is the *only* input-receiving surface we have */
|
/* The main grid is the *only* input-receiving surface we have */
|
||||||
xassert(seat->kbd_focus != NULL);
|
xassert(seat->kbd_focus != NULL);
|
||||||
|
seat->ime.focused = true;
|
||||||
ime_enable(seat);
|
ime_enable(seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -41,6 +42,7 @@ leave(void *data, struct zwp_text_input_v3 *zwp_text_input_v3,
|
||||||
term_ime_reset(term);
|
term_ime_reset(term);
|
||||||
|
|
||||||
ime_disable(seat);
|
ime_disable(seat);
|
||||||
|
seat->ime.focused = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -334,6 +336,9 @@ ime_send_cursor_rect(struct seat *seat, struct terminal *term)
|
||||||
if (unlikely(seat->wayl->text_input_manager == NULL))
|
if (unlikely(seat->wayl->text_input_manager == NULL))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!seat->ime.focused)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!term->ime.enabled)
|
if (!term->ime.enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -367,6 +372,9 @@ ime_enable(struct seat *seat)
|
||||||
struct terminal *term = seat->kbd_focus;
|
struct terminal *term = seat->kbd_focus;
|
||||||
xassert(term != NULL);
|
xassert(term != NULL);
|
||||||
|
|
||||||
|
if (!seat->ime.focused)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!term->ime.enabled)
|
if (!term->ime.enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -397,6 +405,9 @@ ime_disable(struct seat *seat)
|
||||||
if (unlikely(seat->wayl->text_input_manager == NULL))
|
if (unlikely(seat->wayl->text_input_manager == NULL))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!seat->ime.focused)
|
||||||
|
return;
|
||||||
|
|
||||||
ime_reset(seat);
|
ime_reset(seat);
|
||||||
|
|
||||||
zwp_text_input_v3_disable(seat->wl_text_input);
|
zwp_text_input_v3_disable(seat->wl_text_input);
|
||||||
|
|
|
||||||
|
|
@ -271,6 +271,7 @@ struct seat {
|
||||||
} pending;
|
} pending;
|
||||||
} surrounding;
|
} surrounding;
|
||||||
|
|
||||||
|
bool focused;
|
||||||
uint32_t serial;
|
uint32_t serial;
|
||||||
} ime;
|
} ime;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue