mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-13 08:21:03 -04:00
input: rearm IME once after keyboard focus enter
This commit is contained in:
parent
c291194a4e
commit
202fa4c3c8
2 changed files with 29 additions and 0 deletions
28
input.c
28
input.c
|
|
@ -29,6 +29,7 @@
|
||||||
#include "keymap.h"
|
#include "keymap.h"
|
||||||
#include "kitty-keymap.h"
|
#include "kitty-keymap.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
#include "ime.h"
|
||||||
#include "quirks.h"
|
#include "quirks.h"
|
||||||
#include "render.h"
|
#include "render.h"
|
||||||
#include "search.h"
|
#include "search.h"
|
||||||
|
|
@ -717,6 +718,10 @@ keyboard_enter(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial,
|
||||||
term_kbd_focus_in(term);
|
term_kbd_focus_in(term);
|
||||||
seat->kbd_focus = term;
|
seat->kbd_focus = term;
|
||||||
seat->kbd.serial = serial;
|
seat->kbd.serial = serial;
|
||||||
|
|
||||||
|
#if defined(FOOT_IME_ENABLED) && FOOT_IME_ENABLED
|
||||||
|
seat->ime.rearm_pending = true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
|
@ -780,6 +785,11 @@ keyboard_leave(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial,
|
||||||
);
|
);
|
||||||
|
|
||||||
struct terminal *old_focused = seat->kbd_focus;
|
struct terminal *old_focused = seat->kbd_focus;
|
||||||
|
|
||||||
|
#if defined(FOOT_IME_ENABLED) && FOOT_IME_ENABLED
|
||||||
|
seat->ime.rearm_pending = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
seat->kbd_focus = NULL;
|
seat->kbd_focus = NULL;
|
||||||
|
|
||||||
stop_repeater(seat, -1);
|
stop_repeater(seat, -1);
|
||||||
|
|
@ -1860,6 +1870,8 @@ keyboard_modifiers(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial,
|
||||||
uint32_t mods_locked, uint32_t group)
|
uint32_t mods_locked, uint32_t group)
|
||||||
{
|
{
|
||||||
struct seat *seat = data;
|
struct seat *seat = data;
|
||||||
|
(void)wl_keyboard;
|
||||||
|
(void)serial;
|
||||||
|
|
||||||
mods_depressed &= ~seat->kbd.virtual_modifiers;
|
mods_depressed &= ~seat->kbd.virtual_modifiers;
|
||||||
mods_latched &= ~seat->kbd.virtual_modifiers;
|
mods_latched &= ~seat->kbd.virtual_modifiers;
|
||||||
|
|
@ -1904,6 +1916,22 @@ keyboard_modifiers(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial,
|
||||||
: false;
|
: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(FOOT_IME_ENABLED) && FOOT_IME_ENABLED
|
||||||
|
/*
|
||||||
|
* KWin can leave text-input in a non-committing state after focus switches.
|
||||||
|
* Rearm IME once on the first post-focus modifiers event.
|
||||||
|
*/
|
||||||
|
if (seat->ime.rearm_pending &&
|
||||||
|
seat->kbd_focus != NULL &&
|
||||||
|
seat->ime_focus == seat->kbd_focus &&
|
||||||
|
seat->ime_focus->ime_enabled)
|
||||||
|
{
|
||||||
|
seat->ime.rearm_pending = false;
|
||||||
|
ime_disable(seat);
|
||||||
|
ime_enable(seat);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (seat->kbd_focus && seat->kbd_focus->active_surface == TERM_SURF_GRID)
|
if (seat->kbd_focus && seat->kbd_focus->active_surface == TERM_SURF_GRID)
|
||||||
term_xcursor_update_for_seat(seat->kbd_focus, seat);
|
term_xcursor_update_for_seat(seat->kbd_focus, seat);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -256,6 +256,7 @@ struct seat {
|
||||||
} surrounding;
|
} surrounding;
|
||||||
|
|
||||||
uint32_t serial;
|
uint32_t serial;
|
||||||
|
bool rearm_pending;
|
||||||
} ime;
|
} ime;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue