Allow forcing IME update
This commit is contained in:
parent
8c0111cb08
commit
5561aa1d37
4 changed files with 10 additions and 8 deletions
|
|
@ -1336,5 +1336,5 @@ def set_os_window_title(os_window_id: int, title: str) -> None:
|
|||
pass
|
||||
|
||||
|
||||
def update_ime_position_for_window(window_id: int) -> bool:
|
||||
def update_ime_position_for_window(window_id: int, force: bool = False) -> bool:
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -763,7 +763,7 @@ restore_overlay_line(struct SaveOverlayLine *sol) {
|
|||
debug("Received input from child (%s) while overlay active. Overlay contents: %s\n", sol->func_name, PyUnicode_AsUTF8(sol->overlay_text));
|
||||
screen_draw_overlay_text(sol->screen, PyUnicode_AsUTF8(sol->overlay_text));
|
||||
Py_DECREF(sol->overlay_text);
|
||||
update_ime_position_for_window(sol->screen->window_id);
|
||||
update_ime_position_for_window(sol->screen->window_id, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -570,7 +570,7 @@ send_pending_click_to_window_id(id_type timer_id UNUSED, void *data) {
|
|||
}
|
||||
|
||||
bool
|
||||
update_ime_position_for_window(id_type window_id) {
|
||||
update_ime_position_for_window(id_type window_id, bool force) {
|
||||
for (size_t o = 0; o < global_state.num_os_windows; o++) {
|
||||
OSWindow *osw = global_state.os_windows + o;
|
||||
for (size_t t = 0; t < osw->num_tabs; t++) {
|
||||
|
|
@ -578,13 +578,14 @@ update_ime_position_for_window(id_type window_id) {
|
|||
for (size_t w = 0; w < qtab->num_windows; w++) {
|
||||
Window *window = qtab->windows + w;
|
||||
if (window->id == window_id) {
|
||||
if (window->render_data.screen && osw->is_focused) {
|
||||
if (window->render_data.screen && (force || osw->is_focused)) {
|
||||
OSWindow *orig = global_state.callback_os_window;
|
||||
global_state.callback_os_window = osw;
|
||||
update_ime_position(window, window->render_data.screen);
|
||||
global_state.callback_os_window = orig;
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -618,8 +619,9 @@ update_ime_position_for_window(id_type window_id) {
|
|||
|
||||
PYWRAP1(update_ime_position_for_window) {
|
||||
id_type window_id;
|
||||
PA("K", &window_id);
|
||||
if (update_ime_position_for_window(window_id)) Py_RETURN_TRUE;
|
||||
int force = 0;
|
||||
PA("K|p", &window_id, &force);
|
||||
if (update_ime_position_for_window(window_id, force)) Py_RETURN_TRUE;
|
||||
Py_RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -323,4 +323,4 @@ bool draw_window_title(OSWindow *window, const char *text, color_type fg, color_
|
|||
uint8_t* draw_single_ascii_char(const char ch, size_t *result_width, size_t *result_height);
|
||||
bool is_os_window_fullscreen(OSWindow *);
|
||||
void update_ime_position(Window* w, Screen *screen);
|
||||
bool update_ime_position_for_window(id_type window_id);
|
||||
bool update_ime_position_for_window(id_type window_id, bool force);
|
||||
|
|
|
|||
Loading…
Reference in a new issue