Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impossible to create a custom ConsoleDriver #1620

Closed
veeman opened this issue Feb 28, 2022 · 7 comments
Closed

Impossible to create a custom ConsoleDriver #1620

veeman opened this issue Feb 28, 2022 · 7 comments
Labels
bug design Issues regarding Terminal.Gui design (bugs, guidelines, debates, etc...) enhancement

Comments

@veeman
Copy link

veeman commented Feb 28, 2022

Hello guys, currently I need 24 bit color support for my console application.

In the past there was an attempt to bring this feature to Terminal.Gui (see pull #103).
But the code never get into the main branch.

So I thought I can just create my own ConsoleDriver with the source provided there and use the Application.Init to serve my class. However, this is impossible.

Although the abstract base class ConsoleDriver is public, you cannot derive it from outside the library because the Contents field is defined as internal abstract.

Moreover there are several such things where classes and field are defined internal making them inaccessible from outside.

To name some of them:

  • internal class NetDriver
  • internal class WindowsDriver
  • internal static View Application.mouseGrabView
  • internal static View Application.wantContinuousButtonPressedView

Due to the internality of the Application fields which also used by the ConsoleDriver
you get a second level of restriction which makes the whole thing unusable outside.

I would like to appreciate if the internal fields get defined as public as most as possible.
So everyone who wants a custom implementation of a class can access the required structures.
This would also improve feature testing and development outside the library more convenience.

@BDisp
Copy link
Collaborator

BDisp commented Feb 28, 2022

Why about implementing in the current ConsoleDriver and make available for all drivers and submit a pull request?

@veeman
Copy link
Author

veeman commented Feb 28, 2022

Im going to do this.

But im not sure what caused the already existing pull request to make it not into the main source code.
Are they any requirements to get a succesfull pull merge?
Or just no addaitional dependencies and running on all supported platforms?
Currently i can evaluate only on windows and mac machine.

Anyway the above issue persists. The implementation suggests an open interface that is not a real one.

@BDisp
Copy link
Collaborator

BDisp commented Feb 28, 2022

I think @migueldeicaza will not allowed that. The existing pull request was not an overall solution for all drivers. It's necessary creating the necessary abstracts properties and methods on the ConsoleDriver and implementing in each derived drivers. If you can evaluate on windows and mac machine, the WindowsDriver platform has solution and the mac machine, which probably you'll using ncurses, then the CursesDriver has solution too. If you can evaluate in both platforms, then the NetDriver will have a solution too. The best solution is using the RGB for all drivers.

@tig
Copy link
Collaborator

tig commented Feb 28, 2022

I am not sure @migueldeicaza had an issue with the PR in question. I think the PR just died because of a lack of interest (not from users, but the original PR author).

I looked at adding 24 bit way back when and found some things fairly deep in how color info was stored. I don't remember the details but I remember thinking "thar be dragons!".

think it's awesome @veeman is going to dive into this. Please let us know how we can help!.

@migueldeicaza
Copy link
Collaborator

Hello,

Generally I dislike exposing internal details because it ties our hands in the future.

I much rather incorporate true-color support directly into the library, which achieves the stated goal, but also gives us the freedom to change the internals in the future, without breaking any existing code.

@migueldeicaza
Copy link
Collaborator

Btw, I am liking this new notification system. I was overwhelmed by GitHub comments before and could not even keep up with anything. So this is great progress from the app/notification settings.

@tig tig added bug design Issues regarding Terminal.Gui design (bugs, guidelines, debates, etc...) enhancement labels Mar 3, 2022
@BDisp
Copy link
Collaborator

BDisp commented Jun 12, 2022

With the PR #1770 is now possible to create a custom ConsoleDriver that can enjoy all the Terminal.Gui features. I think this issue can be closed.

@tig tig closed this as completed Jun 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug design Issues regarding Terminal.Gui design (bugs, guidelines, debates, etc...) enhancement
Projects
None yet
Development

No branches or pull requests

4 participants