Using glib_sys::g_io_channel_read_line(

Hi, how to get the id of the window obtained from call to g_io_channel_read_line, as shown below?
Thank you

let mut raw: *mut std::os::raw::c_char = std::ptr::null_mut();
                let size: *mut GType = std::ptr::null_mut();
                let terminator_pos: *mut GType = std::ptr::null_mut();
                let ptr_error = std::ptr::null_mut();
                    &mut raw,//HERE IS A WINDOW ID WRITTEN

Why are you doing …any of this?

@zbrown I’m porting this:

to rust.

That doesn’t really explain why your doing all this unsafe code?

There are far better ways to read …whatever your reading

Rust aside, writing an X11-only application in 2022 doesn’t sound like the best idea.

1 Like

I’m pretty certain that you are correct, I simply am not aware of those.
Could you please give examples how to port this to rust so there is no unsafe code?

retval=g_spawn_async_with_pipes(NULL, arg_v, NULL, G_SPAWN_DO_NOT_REAP_CHILD|G_SPAWN_SEARCH_PATH, NULL, NULL, &child_pid, NULL, &std_out, NULL, &error);


        g_io_add_watch(std_out_ch, G_IO_IN | G_IO_HUP, (GIOFunc)watch_out_channel, data);

        g_io_channel_read_line(channel, &string1, &size, NULL, NULL);

Thank you

That wasn’t my idea. Guys who started that app over a decade ago made that decision. Now X11 is a target and there is simply no chance of changing it in any near future.