river
river copied to clipboard
river: Implement imput_method and text_input
So currently I have a panic (river.log and gdb.log) when adding an imput method, probably messed up in my pointers, but can't find where yet, if someone have time to make a first review to see how the implementation looks overall I woud be thankful.
The idea is a Relay is used to handle converstaions between a wlr_input_method and wlr_text_input on a given seat, Only one input_method can be bound to a Relay but multiple text_input can be bound, although only one can receive events at time.
Okay so the use of null value is fixed but now I get a segfault instead, and still can't find where it's wrong
EDIT: https://0x0.st/-t4g.txt
I don't know where exactly you encounter an issue. I tried looking at your code and seem to have encountered two separate issues.
- You code does not compile on my machine, I was able to "fix" this by removing line 82 from
TextInput.zig
(no clue if this is a good idea or not) - The newly compiled version of river works fine but crashes with a segfault when I try to start an input manager (in my case wlpinyin)
Segmentation fault at address 0x21
???:?:?: 0x256934 in ??? (???)
???:?:?: 0xffffa402b177 in ??? (???)
???:?:?: 0xffffa402a867 in ??? (???)
???:?:?: 0xffffa4529817 in ??? (???)
???:?:?: 0xffffa4524073 in ??? (???)
???:?:?: 0xffffa45275d7 in ??? (???)
???:?:?: 0xffffa45248a3 in ??? (???)
???:?:?: 0x2377d7 in ??? (???)
err: wayland.c:1612: failed to flush wayland socket: Broken pipe
info: main.c:579: goodbye
I would assume something weird is going on with these two lines in TextInput.zig:
const node = util.gpa.create(std.TailQueue(TextInput).Node) catch return;
errdefer util.gpa.destroy(node);
Maybe this is of any help to you, my apologies if I've wasted your time.
@user18130814200115-2 Hey you never gonna waste my time testing my PR :)
You code does not compile on my machine, I was able to "fix" this by removing line 82 from TextInput.zig (no clue if this is a good idea or not)
That's weird, it compiles without problem for me, maybe if you can show me what errors you have I can find what's wrong.
Would you mind sharing your setup, config file and what you have installed please? I don't really use input method usually so I'm not really an expert, currently I have fcitx5, which start without any problem, but when I tried to start anthywl I do have a segfault too.
Okay as far as the compile failing went, that seemed to be a fluke (though I remember testing it multiple times ¯_(ツ)_/¯). It seems I simply ran out of ram wile compiling, I tried again and your code works just fine.
One thing to note is that anthywl and wlpinyin both require virtual-keyboard-unstable-v1-client-protocol.h
, I am not sure whether this is implemented yet.
wlpinyin
is really "just" a front-end for the rime engine and it has no config of its own.
I use rime's minimal example config though I doubt you will become any wiser from reading it. Really it is just character mappings from pinyin to jianhuazi (Chinese).
Lastly, running wlpinyin does not result in any error messages, but here is the output anyways.
I tested you simply invoking river -c wlpinyin
so that no further configuration was loaded.
info: initializing server
info(wlroots): [libseat] [libseat/backend/seatd.c:79] Could not connect to socket /run/seatd.sock: No such file or directory
info(wlroots): [libseat] [libseat/libseat.c:76] Backend 'seatd' failed to open seat, skipping
info(wlroots): [libseat] [libseat/libseat.c:73] Seat opened with backend 'logind'
info(wlroots): [backend/session/session.c:110] Successfully loaded libseat session
info(wlroots): [backend/backend.c:223] Found 1 GPUs
info(wlroots): [backend/drm/backend.c:182] Initializing DRM backend for /dev/dri/card1 (rockchip)
info(wlroots): [backend/drm/drm.c:259] Found 2 DRM CRTCs
info(wlroots): [backend/drm/drm.c:186] Found 6 DRM planes
info(wlroots): [render/egl.c:312] Using EGL 1.4
info(wlroots): [render/egl.c:313] Supported EGL client extensions: EGL_EXT_device_base EGL_EXT_device_enumeration EGL_EXT_device_query EGL_EXT_platform_base EGL_KHR_client_get_all_proc_addresses EGL_EXT_client_extensions EGL_KHR_debug EGL_EXT_platform_device EGL_EXT_platform_wayland EGL_KHR_platform_wayland EGL_EXT_platform_x11 EGL_KHR_platform_x11 EGL_MESA_platform_xcb EGL_MESA_platform_gbm EGL_KHR_platform_gbm EGL_MESA_platform_surfaceless
info(wlroots): [render/egl.c:314] Supported EGL display extensions: EGL_ANDROID_blob_cache EGL_EXT_buffer_age EGL_EXT_image_dma_buf_import EGL_EXT_image_dma_buf_import_modifiers EGL_KHR_cl_event2 EGL_KHR_config_attribs EGL_KHR_create_context EGL_KHR_create_context_no_error EGL_KHR_fence_sync EGL_KHR_get_all_proc_addresses EGL_KHR_gl_colorspace EGL_KHR_gl_renderbuffer_image EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_3D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_image EGL_KHR_image_base EGL_KHR_image_pixmap EGL_KHR_no_config_context EGL_KHR_partial_update EGL_KHR_reusable_sync EGL_KHR_surfaceless_context EGL_EXT_pixel_format_float EGL_KHR_wait_sync EGL_MESA_configless_context EGL_MESA_drm_image EGL_MESA_image_dma_buf_export EGL_MESA_query_driver EGL_WL_bind_wayland_display
info(wlroots): [render/egl.c:316] Supported EGL device extensions: EGL_EXT_device_drm
info(wlroots): [render/egl.c:318] EGL vendor: Mesa Project
info(wlroots): [render/gles2/renderer.c:784] Creating GLES2 renderer
info(wlroots): [render/gles2/renderer.c:785] Using OpenGL ES 3.1 Mesa 21.2.1
info(wlroots): [render/gles2/renderer.c:786] GL vendor: Panfrost
info(wlroots): [render/gles2/renderer.c:787] GL renderer: Mali T860 (Panfrost)
info(wlroots): [render/gles2/renderer.c:788] Supported GLES2 extensions: GL_EXT_blend_minmax GL_EXT_multi_draw_arrays GL_EXT_texture_compression_s3tc GL_EXT_texture_compression_dxt1 GL_EXT_texture_compression_rgtc GL_EXT_texture_format_BGRA8888 GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth24 GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_mapbuffer GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_stencil8 GL_OES_texture_3D GL_OES_texture_float GL_OES_texture_float_linear GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_half_float GL_EXT_draw_instanced GL_EXT_texture_sRGB_decode GL_OES_EGL_image GL_OES_depth_texture GL_OES_packed_depth_stencil GL_EXT_texture_type_2_10_10_10_REV GL_NV_conditional_render GL_OES_get_program_binary GL_APPLE_texture_max_level GL_EXT_discard_framebuffer GL_EXT_read_format_bgra GL_EXT_frag_depth GL_NV_fbo_color_attachments GL_OES_EGL_image_external GL_OES_EGL_sync GL_OES_vertex_array_object GL_ANGLE_pack_reverse_row_order GL_ANGLE_texture_compression_dxt3 GL_ANGLE_texture_compression_dxt5 GL_EXT_occlusion_query_boolean GL_EXT_texture_rg GL_EXT_unpack_subimage GL_NV_draw_buffers GL_NV_read_buffer GL_NV_read_depth GL_NV_read_depth_stencil GL_NV_read_stencil GL_EXT_draw_buffers GL_EXT_map_buffer_range GL_KHR_debug GL_KHR_texture_compression_astc_ldr GL_NV_pixel_buffer_object GL_OES_depth_texture_cube_map GL_OES_required_internalformat GL_OES_surfaceless_context GL_EXT_color_buffer_float GL_EXT_sRGB_write_control GL_EXT_separate_shader_objects GL_EXT_shader_framebuffer_fetch GL_EXT_shader_implicit_conversions GL_EXT_shader_integer_mix GL_EXT_compressed_ETC1_RGB8_sub_texture GL_EXT_draw_buffers_indexed GL_EXT_draw_elements_base_vertex GL_EXT_primitive_bounding_box GL_EXT_shader_io_blocks GL_EXT_texture_border_clamp GL_EXT_texture_buffer GL_EXT_texture_view GL_KHR_blend_equation_advanced GL_KHR_blend_equation_advanced_coherent GL_KHR_context_flush_control GL_NV_image_formats GL_OES_draw_buffers_indexed GL_OES_draw_elements_base_vertex GL_OES_primitive_bounding_box GL_OES_shader_io_blocks GL_OES_texture_border_clamp GL_OES_texture_buffer GL_OES_texture_stencil8 GL_OES_texture_storage_multisample_2d_array GL_OES_texture_view GL_EXT_blend_func_extended GL_EXT_float_blend GL_EXT_texture_sRGB_R8 GL_EXT_texture_sRGB_RG8 GL_KHR_no_error GL_KHR_texture_compression_astc_sliced_3d GL_OES_EGL_image_external_essl3 GL_OES_shader_image_atomic GL_EXT_multisampled_render_to_texture GL_EXT_multisampled_render_to_texture2 GL_EXT_texture_compression_s3tc_srgb GL_MESA_shader_integer_functions GL_EXT_color_buffer_half_float GL_EXT_texture_compression_bptc GL_KHR_parallel_shader_compile GL_EXT_EGL_image_storage GL_EXT_shader_framebuffer_fetch_non_coherent GL_INTEL_blackhole_render GL_MESA_framebuffer_flip_y GL_EXT_depth_clamp GL_MESA_bgra
info(wlroots): [backend/noop/backend.c:59] Creating noop backend
info(wlroots): [wayland] unable to lock lockfile /run/user/1000/wayland-1.lock, maybe another compositor is running
info(wlroots): [backend/drm/drm.c:1297] Scanning DRM connectors on /dev/dri/card1
info(wlroots): [backend/drm/drm.c:1355] Found connector 'eDP-1'
info(wlroots): [backend/drm/drm.c:1391] 'eDP-1' connected
info(wlroots): [backend/drm/drm.c:1403] Physical size: 309x174
info(wlroots): [backend/drm/drm.c:1434] Detected modes:
info(wlroots): [backend/drm/drm.c:1456] 1920x1080@60000 (preferred)
info(wlroots): [backend/drm/drm.c:1355] Found connector 'DP-1'
info(wlroots): [backend/drm/drm.c:1391] 'DP-1' connected
info(wlroots): [backend/drm/drm.c:1403] Physical size: 540x300
info(wlroots): [backend/drm/drm.c:1434] Detected modes:
info(wlroots): [backend/drm/drm.c:1456] 1920x1080@60000 (preferred)
info(wlroots): [backend/drm/drm.c:1456] 1920x1080@74973
info(wlroots): [backend/drm/drm.c:1456] 1920x1080@60000
info(wlroots): [backend/drm/drm.c:1456] 1920x1080@59940
info(wlroots): [backend/drm/drm.c:1456] 1920x1080@50000
info(wlroots): [backend/drm/drm.c:1456] 1600x1200@60000
info(wlroots): [backend/drm/drm.c:1456] 1680x1050@59883
info(wlroots): [backend/drm/drm.c:1456] 1280x1024@75025
info(wlroots): [backend/drm/drm.c:1456] 1280x1024@60020
info(wlroots): [backend/drm/drm.c:1456] 1440x900@74984
info(wlroots): [backend/drm/drm.c:1456] 1440x900@59901
info(wlroots): [backend/drm/drm.c:1456] 1280x960@60000
info(wlroots): [backend/drm/drm.c:1456] 1152x864@75000
info(wlroots): [backend/drm/drm.c:1456] 1280x720@60000
info(wlroots): [backend/drm/drm.c:1456] 1280x720@60000
info(wlroots): [backend/drm/drm.c:1456] 1280x720@59940
info(wlroots): [backend/drm/drm.c:1456] 1280x720@50000
info(wlroots): [backend/drm/drm.c:1456] 1024x768@75029
info(wlroots): [backend/drm/drm.c:1456] 1024x768@60004
info(wlroots): [backend/drm/drm.c:1456] 832x624@74551
info(wlroots): [backend/drm/drm.c:1456] 800x600@75000
info(wlroots): [backend/drm/drm.c:1456] 800x600@60317
info(wlroots): [backend/drm/drm.c:1456] 720x480@60000
info(wlroots): [backend/drm/drm.c:1456] 720x480@60000
info(wlroots): [backend/drm/drm.c:1456] 720x480@59940
info(wlroots): [backend/drm/drm.c:1456] 720x480@59940
info(wlroots): [backend/drm/drm.c:1456] 640x480@75000
info(wlroots): [backend/drm/drm.c:1456] 640x480@60000
info(wlroots): [backend/drm/drm.c:1456] 640x480@59940
info(wlroots): [backend/drm/drm.c:1456] 640x480@59940
info(wlroots): [backend/drm/drm.c:1456] 720x400@70082
info(wlroots): [backend/drm/drm.c:1508] connector eDP-1: Requesting modeset
info(wlroots): [backend/drm/drm.c:808] connector eDP-1: Modesetting with '1920x1080@60000mHz'
info(wlroots): [backend/drm/drm.c:1508] connector DP-1: Requesting modeset
info(wlroots): [backend/drm/drm.c:808] connector DP-1: Modesetting with '1920x1080@60000mHz'
info: running init executable 'wlpinyin'
info: running server
[../pinyin_engine.c:24] context_obj: 0xaaaad6173f10, sess: 0, msgtype: deploy, msg: start
[../pinyin_engine.c:24] context_obj: 0xaaaad6173f10, sess: 0, msgtype: deploy, msg: success
[../pinyin_engine.c:102] schema_name: 朙月拼音, id: luna_pinyin
[../pinyin_engine.c:24] context_obj: 0xaaaad6173f10, sess: 187650713057296, msgtype: option, msg: _auto_commit
[../pinyin_engine.c:24] context_obj: 0xaaaad6173f10, sess: 187650713057296, msgtype: option, msg: !ascii_mode
[../pinyin_engine.c:24] context_obj: 0xaaaad6173f10, sess: 187650713057296, msgtype: option, msg: zh_trad
[../pinyin_engine.c:24] context_obj: 0xaaaad6173f10, sess: 187650713057296, msgtype: option, msg: !zh_tw
[../pinyin_engine.c:24] context_obj: 0xaaaad6173f10, sess: 187650713057296, msgtype: option, msg: !zh_simp
[../pinyin_engine.c:24] context_obj: 0xaaaad6173f10, sess: 187650713057296, msgtype: schema, msg: luna_pinyin/朙月拼音
Segmentation fault at address 0xff2d
???:?:?: 0x256920 in ??? (???)
???:?:?: 0xffff9d0e5177 in ??? (???)
???:?:?: 0xffff9d0e4867 in ??? (???)
???:?:?: 0xffff9d5e3817 in ??? (???)
???:?:?: 0xffff9d5de073 in ??? (???)
???:?:?: 0xffff9d5e15d7 in ??? (???)
???:?:?: 0xffff9d5de8a3 in ??? (???)
???:?:?: 0x2377d7 in ??? (???)
Shouldn't really do something since keyboard_grab is not inplemented yet but at least it should not segfault anymore
I did some more testing, here are the results:
When building without -Dxwayland
, the error I get is:
thread 467370 panic: attempt to use null value
which is not much more useful than the segfault as far as errors go.
Interestingly enough, when building with -Dxwayland
, the segfault still happens as before.
Furthermore, on the xwayland build, I get a lot of xkbcomp errors.
Particularly, xkbcomp does not seem to have able to resolve the XF86*
keys.
The general error is:
> Warning: Unsupported maximum keycode 708, clipping.
> X11 cannot support keycodes above 255.
...
Errors from xkbcomp are not fatal to the X server
I suspect this is a problem with my setup, not with river nor this PR, but it may be the reason the segfault is happening on my build.
I did some more testing, here are the results: When building without
-Dxwayland
, the error I get is:thread 467370 panic: attempt to use null value
which is not much more useful than the segfault as far as errors go.Interestingly enough, when building with
-Dxwayland
, the segfault still happens as before.
What I have found is that if I tried it in a nested river session, I have a panic or segfault but if I launch it in a new TTY it works fine. Right now I can launch anthywl without problem, but I have a integer overflow when closing it, which is probably caused by keyboard_grab but I'm not sure yet.
I don't have any difference between xwayland or not though.
Furthermore, on the xwayland build, I get a lot of xkbcomp errors. Particularly, xkbcomp does not seem to have able to resolve the
XF86*
keys.The general error is:
> Warning: Unsupported maximum keycode 708, clipping. > X11 cannot support keycodes above 255. ... Errors from xkbcomp are not fatal to the X server
I suspect this is a problem with my setup, not with river nor this PR, but it may be the reason the segfault is happening on my build.
This is somthing that will always happens with xwayland and it's not an error, more a warning. It doesn't cause any bugs in river.
To resume a bit where am I:
- I have a hard time, focusing the surface, can't find a good way to call the function in
Seat.zig
, currently causing river to crash sometime. - keyboard grab doen't works yet, I'm not sure how to add it to the current river
Keyboard
inplementation. - Integer overflow when closing the input method (anthywl for me). I think it's caused by the keyboard modifiers but I'm really not sure about that.
- Overall a lot of needed optimization in memory, null value...
Here a comparaison of anthywl with WAYLAND_DEBUG=1
on river and sway
river:
[1884945.170] -> [email protected]_input_method(wl_seat@8, new id zwp_input_method_v2@10)
[1884945.211] -> [email protected]_virtual_keyboard(wl_seat@8, new id zwp_virtual_keyboard_v1@11)
[1884945.247] -> [email protected]_keyboard(new id zwp_input_method_keyboard_grab_v2@12)
[1884945.273] -> [email protected]_surface(new id wl_surface@13)
[1884945.301] -> [email protected](nil, 0, 0)
[1884945.342] -> [email protected]()
[1884945.357] -> [email protected]_input_popup_surface(new id zwp_input_popup_surface_v2@14, wl_surface@13)
[1884945.394] -> [email protected]_surface(new id wl_surface@15)
[1884960.681] [email protected]("default")
[1884960.745] [email protected](3)
[1884960.795] -> [email protected]_pointer(new id wl_pointer@16)
[1884960.838] [email protected](0, 0, 290, 170, 0, "Unknown", "0x412D", 0)
[1884960.978] [email protected](1, 1920, 1080, 60049)
[1884961.098] [email protected](1)
[1884961.126] [email protected]()
[1884961.179] -> [email protected]()
[1884961.251] -> [email protected]_pool(new id wl_shm_pool@17, fd 5, 2304)
[1884961.441] -> [email protected](5568)
[1884961.518] -> [email protected](12096)
[1884994.800] [email protected]_id(3)
[1884994.872] [email protected]()
[1884994.897] [email protected]_change_cause(0)
[1884994.928] [email protected]_type(0, 13)
[1884994.972] [email protected]()
sway:
[321077.211] -> [email protected]_input_method(wl_seat@8, new id zwp_input_method_v2@10)
[321077.231] -> [email protected]_virtual_keyboard(wl_seat@8, new id zwp_virtual_keyboard_v1@11)
[321077.250] -> [email protected]_keyboard(new id zwp_input_method_keyboard_grab_v2@12)
[321077.263] -> [email protected]_surface(new id wl_surface@13)
[321077.277] -> [email protected](nil, 0, 0)
[321077.298] -> [email protected]()
[321077.306] -> [email protected]_input_popup_surface(new id zwp_input_popup_surface_v2@14, wl_surface@13)
[321077.325] -> [email protected]_surface(new id wl_surface@15)
[321087.762] [email protected]("seat0")
[321087.807] [email protected](3)
[321087.827] -> [email protected]_pointer(new id wl_pointer@16)
[321087.849] [email protected](0, 0, 290, 170, 0, "Unknown", "0x412D", 0)
[321087.924] [email protected](1, 1920, 1080, 60049)
[321087.965] [email protected](1)
[321087.981] [email protected]()
[321088.014] -> [email protected]()
[321088.059] -> [email protected]_pool(new id wl_shm_pool@17, fd 6, 2304)
[321088.167] -> [email protected](5568)
[321088.209] -> [email protected](12096)
[321088.248] [email protected](1, fd 5, 66115)
[321088.292] -> [email protected](1, fd 7, 66115)
[321093.763] [email protected]_info(25, 600)
[321093.805] [email protected](49, 0, 0, 0, 0)
[321093.859] -> [email protected](0, 0, 0, 0)
[321093.900] [email protected](50, 0, 0, 0, 0)
[321093.949] -> [email protected](0, 0, 0, 0)
[321114.016] [email protected]_id(3)
[321114.064] [email protected](1, fd 5, 66115)
[321128.451] [email protected]()
[321128.499] [email protected]_change_cause(0)
[321128.521] [email protected]_type(0, 13)
[321128.579] [email protected]()
EDIT: @ifreund I know it's a draft PR but if you have some time to look at it, to at least fix integer overflow, null value, segfault. Or any idea on how to implement focusing surface and keyboard grab, I'd appreciate that, thanks.
Just rebased to master
I still don't understand why handleNewInputMethod()
segfault
EDIT: or doing something like this, give me a panic: attempt to use a null value
fn handleNewInputMethod(
listener: *wl.Listener(*wlr.InputMethodV2),
input_method: *wlr.InputMethodV2,
) void {
const self = @fieldParentPtr(Self, "new_input_method", listener);
const seat = @intToPtr(*Seat, input_method.seat.data);
var relay = seat.relay;
// Only one input_method can be bound to a seat.
if (relay.input_method != null) {
log.debug("attempted to connect second input method to a seat", .{});
input_method.sendUnavailable();
return;
}
relay.input_method = input_method;
// Error here
input_method.events.commit.add(&relay.input_method_commit);
input_method.events.grab_keyboard.add(&relay.grab_keyboard);
input_method.events.destroy.add(&relay.input_method_destroy);
log.debug("new input method on seat {s}", .{relay.seat.wlr_seat.name});
const text_input = relay.getFocusableTextInput() orelse return;
if (text_input.pending_focused_surface) |surface| {
text_input.wlr_text_input.sendEnter(surface);
text_input.setPendingFocusedSurface(null);
}
}
@novakne I believe the problem is on this line:
var relay = seat.relay
This copies the relay field of seat into a stack variable. Instead you want to take a pointer to that field:
const relay = &seat.relay;
@ifreund you're right, but then I still have a segfaul https://0x0.st/-5xH.log
Got this from valgrind:
debug(input_manager): new text input on seat default
debug(wlroots): [types/wlr_surface.c:743] New wlr_surface 0x15bdf8e0 (res 0x15bdfd50)
debug(wlroots): [types/wlr_surface.c:743] New wlr_surface 0x15be0110 (res 0x15be0580)
debug(wlroots): [types/xdg_shell/wlr_xdg_surface.c:465] new xdg_surface 0x15be0e70 (res 0x15be0ff0)
debug(wlroots): [types/wlr_xdg_decoration_v1.c:210] new xdg_toplevel_decoration 0x15be1750 (res 0x15be1860)
debug(server): new xdg_toplevel
==23414== Warning: set address range perms: large range [0x1618e000, 0x3618e000) (defined)
debug(view): view 'foot' mapped
debug(layout): starting layout demand 'rivertile' on output 'WL-1'
debug(layout): layout 'rivertile' on output 'WL-1' pushed view dimensions: 6 6 1122 1015
debug(layout): layout 'rivertile' on output 'WL-1' commited
debug(transaction): started transaction with 1 pending configure(s)
==23414== Warning: set address range perms: large range [0x3660e000, 0x5660e000) (defined)
==23414== Warning: set address range perms: large range [0x1618e000, 0x3618e000) (noaccess)
debug(cursor): focused client set cursor
==23414== Invalid read of size 8
==23414== at 0x235240: .wayland.wayland_server_core.list.Head(.wayland.wayland_server_core.Listener(*.wlroots.types.input_method_v2.InputMethodV2),"link").append (wayland_server_core.zig:382)
==23414== by 0x22CA4C: .wayland.wayland_server_core.Signal(*.wlroots.types.input_method_v2.InputMethodV2).add (wayland_server_core.zig:510)
==23414== by 0x22F33C: InputManager.handleNewInputMethod (InputManager.zig:331)
==23414== by 0x22C2E0: .wayland.wayland_server_core.struct:490:17.wrapper.164 (wayland_server_core.zig:492)
==23414== by 0x4A46A6D: wlr_signal_emit_safe (in /usr/lib/libwlroots.so.9)
==23414== by 0x4E400E5: ??? (in /usr/lib/libffi.so.8.1.0)
==23414== by 0x4E3F496: ??? (in /usr/lib/libffi.so.8.1.0)
==23414== by 0x48D1302: ??? (in /usr/lib/libwayland-server.so.0.1.0)
==23414== by 0x48CC59B: ??? (in /usr/lib/libwayland-server.so.0.1.0)
==23414== by 0x48CF159: wl_event_loop_dispatch (in /usr/lib/libwayland-server.so.0.1.0)
==23414== by 0x48CCC36: wl_display_run (in /usr/lib/libwayland-server.so.0.1.0)
==23414== by 0x219AE4: main.0 (main.zig:123)
==23414== Address 0x15c463b8 is 8 bytes before a block of size 128 alloc'd
==23414== at 0x483F7C5: malloc (vg_replace_malloc.c:380)
==23414== by 0x48CD2D7: wl_resource_create (in /usr/lib/libwayland-server.so.0.1.0)
==23414== by 0x4A30199: ??? (in /usr/lib/libwlroots.so.9)
==23414== by 0x4E400E5: ??? (in /usr/lib/libffi.so.8.1.0)
==23414== by 0x4E3F496: ??? (in /usr/lib/libffi.so.8.1.0)
==23414== by 0x48D1302: ??? (in /usr/lib/libwayland-server.so.0.1.0)
==23414== by 0x48CC59B: ??? (in /usr/lib/libwayland-server.so.0.1.0)
==23414== by 0x48CF159: wl_event_loop_dispatch (in /usr/lib/libwayland-server.so.0.1.0)
==23414== by 0x48CCC36: wl_display_run (in /usr/lib/libwayland-server.so.0.1.0)
==23414== by 0x219AE4: main.0 (main.zig:123)
==23414== by 0x24F827: std.start.callMain (start.zig:471)
==23414== by 0x21CF87: std.start.initEventLoopAndCallMain (start.zig:413)
==23414== by 0x21CF87: std.start.callMainWithArgs (start.zig:368)
==23414==
thread 23414 panic: attempt to use null value
/home/daniel/src/river-ime/zig-cache/zig-wayland/wayland_server_core.zig:382:31: 0x235255 in .wayland.wayland_server_core.list.Head(.wayland.wayland_server_core.Listener(*.wlroots.types.input_method_v2.InputMethodV2),"link").append (river)
head.link.prev.?.insertAfter(link);
^
/home/daniel/src/river-ime/zig-cache/zig-wayland/wayland_server_core.zig:510:40: 0x22ca4c in .wayland.wayland_server_core.Signal(*.wlroots.types.input_method_v2.InputMethodV2).add (river)
signal.listener_list.append(listener);
^
/home/daniel/src/river-ime/river/InputManager.zig:331:35: 0x22f33c in InputManager.handleNewInputMethod (river)
input_method.events.commit.add(&relay.input_method_commit);
^
/home/daniel/src/river-ime/zig-cache/zig-wayland/wayland_server_core.zig:492:25: 0x22c2e0 in .wayland.wayland_server_core.struct:490:17.wrapper (river)
@call(.{ .modifier = .always_inline }, notify, .{ listener, @intToPtr(T, @ptrToInt(data)) });
^
???:?:?: 0x4a46a6d in ??? (???)
Doesn't really add any information. FWIW, this is the first "invalid access" reported by valgrind. All I have before that is tons of Iris DRI "possibly lost" warnings.
The InputMethodV2 Zig wrapper is incorrect; the keyboardGrab member should be a pointer:
diff --git a/src/types/input_method_v2.zig b/src/types/input_method_v2.zig
index 8fcfb41..0f2d101 100644
--- a/src/types/input_method_v2.zig
+++ b/src/types/input_method_v2.zig
@@ -76,7 +76,7 @@ pub const InputMethodV2 = extern struct {
client_active: bool,
current_serial: u32,
- keyboard_grab: KeyboardGrab,
+ keyboard_grab: *KeyboardGrab,
link: wl.list.Link,
Also, heads up, the struct has changed in wlroots master. The above patch works (as in, doesn't crash river) with wlroots-0.14.1.
Also, heads up, the struct has changed in wlroots master. The above patch works (as in, doesn't crash river) with wlroots-0.14.1.
Yes I'm aware of this, but zig-wlroots follow stable release so this is a problem for later, anyway thanks for the fix.
Looks like it fixes segfault/null value errors, it's easier for review/testing and so now it needs:
- ~~Fix
sendPreeditString()
using directly zig-wayland~~ - The keyboard_grab implementation which is tha hard part, to me at least
As far as I can tell, with WAYLAND_DEBUG=1
all IME events are here as expected, more or less the same log that I have with sway. Without keyboard_grab
events of course, which for now I have no idea how to integrate it with the current code.
Just rebasing from latest master.
I still havn't found a good way to implement keyboard grab, without adding to much complexity to the code. I think it needs a list of pressed key id/code to only send pressed/released events we want, especially not sending the released to the IM grab.
Any thoughts on this?
hi,
any update on this pr?
Unfortunately I couldn't make it works, and tbh I have lost the motivation to works on this, I'll would gladly help if someone want to keep working on it but I'll probably don't have the knowledge to finish this alone
Superseded by #859