summaryrefslogtreecommitdiff
path: root/src/wayland/ime.c
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-10-11 23:40:57 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-10-11 23:40:57 +0300
commit6eac0a5f2c552728efca420b1129fae7d4fea773 (patch)
tree27fc9dc013de80787525696897771acec22c0f0c /src/wayland/ime.c
parent8d9f7c7cb39359d62bf28ef1775b944a7dddd6fb (diff)
feat: backend selection (Wayland, X11, Cocoa)
Diffstat (limited to 'src/wayland/ime.c')
-rw-r--r--src/wayland/ime.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/wayland/ime.c b/src/wayland/ime.c
index 9da019c..74db53f 100644
--- a/src/wayland/ime.c
+++ b/src/wayland/ime.c
@@ -2,7 +2,7 @@
#define IME_TEXT_MAX (256u * 1024)
-static void show_preedit(struct yasl_surface *w, char *text, int begin, int end)
+static void show_preedit(struct wayland_surface *w, char *text, int begin, int end)
{
bool changed = (text || w->ime_shown) &&
(!text || !w->ime_shown || strcmp(text, w->ime_shown) ||
@@ -12,10 +12,10 @@ static void show_preedit(struct yasl_surface *w, char *text, int begin, int end)
w->ime_shown_begin = begin;
w->ime_shown_end = end;
if (changed)
- yasl_surface_schedule_redraw(w);
+ wayland_surface_schedule_redraw(w);
}
-void ime_reset(struct yasl_surface *w)
+void ime_reset(struct wayland_surface *w)
{
free(w->ime_preedit);
w->ime_preedit = NULL;
@@ -24,7 +24,7 @@ void ime_reset(struct yasl_surface *w)
show_preedit(w, NULL, -1, -1);
}
-void ime_send_caret(struct yasl_surface *w)
+void ime_send_caret(struct wayland_surface *w)
{
struct seat *seat = w->ime_seat;
if (!seat || !seat->text_input)
@@ -38,12 +38,12 @@ void ime_send_caret(struct yasl_surface *w)
zwp_text_input_v3_commit(seat->text_input);
}
-const char *yasl_surface_ime_preedit(const struct yasl_surface *w)
+const char *wayland_surface_ime_preedit(const struct wayland_surface *w)
{
return w ? w->ime_shown : NULL;
}
-bool yasl_surface_ime_preedit_cursor(const struct yasl_surface *w, int *begin, int *end)
+bool wayland_surface_ime_preedit_cursor(const struct wayland_surface *w, int *begin, int *end)
{
if (!w || !w->ime_shown || w->ime_shown_begin < 0)
return false;
@@ -52,7 +52,7 @@ bool yasl_surface_ime_preedit_cursor(const struct yasl_surface *w, int *begin, i
return true;
}
-void yasl_surface_set_ime_caret(struct yasl_surface *w, struct yasl_rect2i caret)
+void wayland_surface_set_ime_caret(struct wayland_surface *w, struct yasl_rect2i caret)
{
if (!w || (w->ime_caret.x == caret.x && w->ime_caret.y == caret.y &&
w->ime_caret.width == caret.width && w->ime_caret.height == caret.height))
@@ -65,7 +65,7 @@ static void text_input_enter(void *data, struct zwp_text_input_v3 *text_input,
struct wl_surface *surface)
{
struct seat *s = data;
- struct yasl_surface *w = surface_root(conn_surface_for(s->conn, surface));
+ struct wayland_surface *w = surface_root(conn_surface_for(s->conn, surface));
s->ime_focus = w;
if (!w) return;
zwp_text_input_v3_enable(text_input);
@@ -81,7 +81,7 @@ static void text_input_leave(void *data, struct zwp_text_input_v3 *text_input,
{
(void)surface;
struct seat *s = data;
- struct yasl_surface *w = s->ime_focus;
+ struct wayland_surface *w = s->ime_focus;
s->ime_focus = NULL;
if (!w) return;
zwp_text_input_v3_disable(text_input);
@@ -96,7 +96,7 @@ static void text_input_preedit_string(void *data,
int32_t cursor_begin, int32_t cursor_end)
{
(void)text_input;
- struct yasl_surface *w = ((struct seat *)data)->ime_focus;
+ struct wayland_surface *w = ((struct seat *)data)->ime_focus;
if (!w) return;
free(w->ime_preedit);
w->ime_preedit = text ? strndup(text, IME_TEXT_MAX) : NULL;
@@ -111,7 +111,7 @@ static void text_input_commit_string(void *data,
struct zwp_text_input_v3 *text_input, const char *text)
{
(void)text_input;
- struct yasl_surface *w = ((struct seat *)data)->ime_focus;
+ struct wayland_surface *w = ((struct seat *)data)->ime_focus;
if (!w) return;
free(w->ime_commit);
w->ime_commit = (text && text[0]) ? strndup(text, IME_TEXT_MAX) : NULL;
@@ -128,12 +128,12 @@ static void text_input_done(void *data, struct zwp_text_input_v3 *text_input,
uint32_t serial)
{
(void)text_input; (void)serial;
- struct yasl_surface *w = ((struct seat *)data)->ime_focus;
+ struct wayland_surface *w = ((struct seat *)data)->ime_focus;
if (!w) return;
if (w->ime_commit) {
struct yasl_input_event ev = {
.kind = YASL_INPUT_TEXT,
- .surface = w,
+ .surface = &w->base,
.text = { .text = w->ime_commit, .len = strlen(w->ime_commit) },
};
input_queue_push(&w->input, &ev);