Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: christo on December 31, 2024, 05:40:45 am

Title: cbTerminal plugin to access terminal from the bottom panel for Linux ( wxGtk )
Post by: christo on December 31, 2024, 05:40:45 am
https://github.com/josephch/cbTerminal is a small plugin to show bash terminal using VTE Gtk widget. It might be useful for Linux users.
Title: Re: cbTerminal plugin to access terminal from the bottom panel for Linux ( wxGtk )
Post by: ollydbg on January 01, 2025, 02:47:18 am
Nice work.

My question is that can you bring such feature to Windows OS?

Thanks.
Title: Re: cbTerminal plugin to access terminal from the bottom panel for Linux ( wxGtk )
Post by: christo on January 01, 2025, 04:55:45 am
Nice work.

My question is that can you bring such feature to Windows OS?

Thanks.

@ollydbg, I've tried TerminalWx (https://github.com/jeremysalwen/TerminalWx), which I believe is cross-platform. I decided to go with VTE because it appears better in my Ubuntu. My work to integrate TerminalWx is available in https://github.com/josephch/cb-TerminalWx . For Windows, you can try changing cbTerminalView_TerminalWx.cpp to use the correct terminal.
Edit : Following link describes a psuedoterminal i think that can be used for windows https://devblogs.microsoft.com/commandline/windows-command-line-introducing-the-windows-pseudo-console-conpty/
Title: Re: cbTerminal plugin to access terminal from the bottom panel for Linux ( wxGtk )
Post by: ollydbg on January 24, 2025, 09:00:39 am
Hi, sorry for the late reply, I'm busy these days.

I have made a new fork of your repo: asmwarrior/TerminalWx: WxWidgets Terminal Widget (https://github.com/asmwarrior/TerminalWx), and try to build this library with the C::B and msys2.

I see some link errors

Code
[100.0%] g++.exe  -o bin\Debug\TestApp.exe obj\Debug\src\GTerm\actions.o obj\Debug\src\GTerm\gterm.o obj\Debug\src\GTerm\keytrans.o obj\Debug\src\GTerm\states.o obj\Debug\src\GTerm\utils.o obj\Debug\src\GTerm\vt52_states.o obj\Debug\src\taTelnet\wxterm.o obj\Debug\src\terminalinputevent.o obj\Debug\src\terminalwx.o obj\Debug\TestApp.o obj\Debug\TestMain.o  -LF:/code/msys2-64/mingw64/lib -pipe -lwx_mswu_xrc-3.2 -lwx_mswu_webview-3.2 -lwx_mswu_html-3.2 -lwx_mswu_qa-3.2 -lwx_mswu_adv-3.2 -lwx_mswu_core-3.2 -lwx_baseu_xml-3.2 -lwx_baseu_net-3.2 -lwx_baseu-3.2    -mwindows
F:/code/msys2-64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: obj\Debug\src\terminalwx.o: in function `__static_initialization_and_destruction_0':
F:\code\TerminalWx/src/terminalwx.cpp:76:(.text+0x518): undefined reference to `__imp_chEVT_TERMINAL_INPUT'
F:/code/msys2-64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: F:\code\TerminalWx/src/terminalwx.cpp:78:(.text+0x52a): undefined reference to `__imp_chEVT_TERMINAL_INPUT'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 8 second(s))
3 error(s), 101 warning(s) (0 minute(s), 8 second(s))

see the attachment txt log file for more details.


EDIT:

Quote
Edit : Following link describes a psuedoterminal i think that can be used for windows https://devblogs.microsoft.com/commandline/windows-command-line-introducing-the-windows-pseudo-console-conpty/

I'm not sure how difficult the windows conpty API is. I haven't tried it yet.


Title: Re: cbTerminal plugin to access terminal from the bottom panel for Linux ( wxGtk )
Post by: ollydbg on January 24, 2025, 09:16:38 am
OK, the linker error issue is fixed, I have pushed to my git fork.

Now, when I run the program, I see below screen shot, but I can't enter any chars to the terminal window.



Title: Re: cbTerminal plugin to access terminal from the bottom panel for Linux ( wxGtk )
Post by: christo on January 24, 2025, 04:42:32 pm
@ollydbg, by default nothing will be shown. You have to integrate a pseudo terminal, then only the widget will be useful. Also please refer https://github.com/josephch/cb-TerminalWx/blob/dfad6bd1922b70af7f9d33f09fbd51bf7608710f/cbTerminalView_TerminalWx.cpp , you can see how data is read and written to the terminal emulator.
Title: Re: cbTerminal plugin to access terminal from the bottom panel for Linux ( wxGtk )
Post by: ollydbg on January 25, 2025, 02:26:31 pm
I tried, and derived a new class named "TerminalWxWin", and it use the winpty library from msys2/mingw.

The final result is: some text is shown in the main frame, see below, but still far from usage, I can't enter any text, and the input text does not show fully.

See image shot below.

I have push my changes to my code repo: https://github.com/asmwarrior/TerminalWx

Title: Re: cbTerminal plugin to access terminal from the bottom panel for Linux ( wxGtk )
Post by: christo on January 25, 2025, 06:56:32 pm
@ollydbg, this is good progress. Could you please check my comment https://github.com/asmwarrior/TerminalWx/commit/3cd8578500ea91bc23b3c13f6e3865c9b87b42e4#r151768824 ?

Thanks, Christo
Title: Re: cbTerminal plugin to access terminal from the bottom panel for Linux ( wxGtk )
Post by: ollydbg on January 26, 2025, 03:01:32 am
@ollydbg, this is good progress. Could you please check my comment https://github.com/asmwarrior/TerminalWx/commit/3cd8578500ea91bc23b3c13f6e3865c9b87b42e4#r151768824 ?

Thanks, Christo

Thanks, actually, that code is created by some AI, and I know little about how the terminal works.

I create an issue about the reading of the console text here with some of by debug result.

Windows console text does not show correctly  Issue #1 asmwarrior/TerminalWx (https://github.com/asmwarrior/TerminalWx/issues/1)