Skip to content

Commit

Permalink
IME: show composition text
Browse files Browse the repository at this point in the history
From @JaeHeyK part of #172
  • Loading branch information
david-vanderson committed Jan 10, 2025
1 parent 974ed4c commit ef44876
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 1 addition & 2 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@ fn addDvuiModule(
sdl_options.addOption(bool, "from_system", true);
backend_mod.linkSystemLibrary("SDL3", .{});
} else {
// SDL2 compiled from source
sdl_options.addOption(std.SemanticVersion, "version", .{ .major = 2, .minor = 0, .patch = 0 });
if (target.result.os.tag == .linux) {
// SDL2 from system
const sdl_dep = b.lazyDependency("sdl", .{
.target = target,
.optimize = optimize,
Expand All @@ -252,7 +252,6 @@ fn addDvuiModule(
backend_mod.linkLibrary(sd.artifact("SDL2"));
}
} else {
// SDL2 compiled from source
const sdl_dep = b.lazyDependency("sdl", .{ .target = target, .optimize = optimize });
if (sdl_dep) |sd| {
backend_mod.linkLibrary(sd.artifact("SDL2"));
Expand Down
5 changes: 3 additions & 2 deletions src/backends/sdl_backend.zig
Original file line number Diff line number Diff line change
Expand Up @@ -693,10 +693,11 @@ pub fn addEvent(self: *SDLBackend, win: *dvui.Window, event: c.SDL_Event) !bool
return try win.addEventText(txt);
},
if (sdl3) c.SDL_EVENT_TEXT_EDITING else c.SDL_TEXTEDITING => {
const strlen: u8 = @intCast(c.SDL_strlen(&event.edit.text));
if (self.log_events) {
std.debug.print("sdl event TEXTEDITING {s} start {d} len {d}\n", .{ event.edit.text, event.edit.start, event.edit.length });
std.debug.print("sdl event TEXTEDITING {s} start {d} len {d} strlen {d}\n", .{ event.edit.text, event.edit.start, event.edit.length, strlen });
}
return try win.addEventTextEx(event.text.text[0..@intCast(event.edit.length)], true);
return try win.addEventTextEx(event.edit.text[0..strlen], true);
},
if (sdl3) c.SDL_EVENT_MOUSE_MOTION else c.SDL_MOUSEMOTION => {
const touch = event.motion.which == c.SDL_TOUCH_MOUSEID;
Expand Down

0 comments on commit ef44876

Please sign in to comment.