mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-27 10:41:58 +02:00
DRYer
This commit is contained in:
@@ -80,8 +80,8 @@ active_window(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_ime_position(OSWindow *os_window, Window* w, Screen *screen) {
|
update_ime_position(Window* w, Screen *screen) {
|
||||||
unsigned int cell_width = os_window->fonts_data->cell_width, cell_height = os_window->fonts_data->cell_height;
|
unsigned int cell_width = global_state.callback_os_window->fonts_data->cell_width, cell_height = global_state.callback_os_window->fonts_data->cell_height;
|
||||||
unsigned int left = w->geometry.left, top = w->geometry.top;
|
unsigned int left = w->geometry.left, top = w->geometry.top;
|
||||||
left += screen->cursor->x * cell_width;
|
left += screen->cursor->x * cell_width;
|
||||||
top += screen->cursor->y * cell_height;
|
top += screen->cursor->y * cell_height;
|
||||||
@@ -130,7 +130,7 @@ on_key_input(GLFWkeyevent *ev) {
|
|||||||
|
|
||||||
switch(ev->ime_state) {
|
switch(ev->ime_state) {
|
||||||
case GLFW_IME_PREEDIT_CHANGED:
|
case GLFW_IME_PREEDIT_CHANGED:
|
||||||
update_ime_position(global_state.callback_os_window, w, screen);
|
update_ime_position(w, screen);
|
||||||
screen_draw_overlay_text(screen, text);
|
screen_draw_overlay_text(screen, text);
|
||||||
debug("updated pre-edit text: '%s'\n", text);
|
debug("updated pre-edit text: '%s'\n", text);
|
||||||
return;
|
return;
|
||||||
@@ -145,7 +145,7 @@ on_key_input(GLFWkeyevent *ev) {
|
|||||||
// for macOS, update ime position on every key input
|
// for macOS, update ime position on every key input
|
||||||
// because the position is required before next input
|
// because the position is required before next input
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
update_ime_position(global_state.callback_os_window, w, screen);
|
update_ime_position(w, screen);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user