libui icon indicating copy to clipboard operation
libui copied to clipboard

Why GUI lib on top of Gtk, when Gtk itself is a GUI lib?

Open memoryleakno1 opened this issue 7 years ago • 8 comments

Just wonder what do you bring to the table?

I am currently looking for a small and non-obtrusive gui library for a new project, but I never perceived Gtk for either small or non-obtrusive :-( (nor Qt for that matter).

memoryleakno1 avatar Mar 12 '17 04:03 memoryleakno1

GTK+ and Qt are the closest things to a "platform-native GUI library" that you can get on a Unix system, as Unix systems have no "native" widget toolkit, and these two are used by a disproportionate amount of programs.

What are you looking for, requirements-wise? What graphics engine does your program use already?

andlabs avatar Mar 13 '17 06:03 andlabs

@memoryleakno1, while i'm also interested in hearing about lightweight alternatives, the one thing that makes libui interesting is that it's easy to bind with any language.

what you might be missing is that libui is not drawing anything, it just forwards your requests to the underlying widgets toolkit (the default native ones on os x and windows; gtk on linux... because linux does not have a native widget toolkit).

this is similar to what wxwidgets does (also on top of gtk on linux). but wxwidgets is c++ and therefore harder to create bindings for other languages.

i'm still missing a few important (to me) features in libui for using it in production, but my first tries where successful.

aoloe avatar Mar 22 '17 16:03 aoloe

@aoloe feel free to make those suggestions known so they can be added =P

andlabs avatar Mar 23 '17 05:03 andlabs

#105 : - )

aoloe avatar Mar 24 '17 13:03 aoloe

Ok, thank you very much for clarifications. I haven't tested libui prior to question so that is why I asked. As I understand it is a wrapper around native gui, just like wxWidget, AWT or SWT.

I am looking for something I can use with OpenGL without heavy dependancies. I could have used GTK directly since it is platform independent or Qt as well, or wxWidgets but all of those have intestine trail of needed dependencies and are far cray from being small. Much smaller FLTK might be something, but I am not sure yet.

About Linux and what is native gui, jsut as a side note, yes there is no THE "platform-native GUI library", but you could have maybe wrapped (and built on) Xt instead. But that would be considerably more work and no Wayland (I leave it to reader to decide if that is advantage or dissadvantage :-)).

memoryleakno1 avatar Mar 25 '17 03:03 memoryleakno1

i think you would rather need something like https://github.com/wjakob/nanogui ...

aoloe avatar Mar 26 '17 16:03 aoloe

Or have a look at immediate mode GUI libraries like imgui, I believe libui is just awesome for what it intended, native looking GUI.

ebraminio avatar Sep 10 '17 11:09 ebraminio

As I understand it is a wrapper around native gui, just like wxWidget, AWT or SWT.

Well, while this may be the case, think about it from another point of view - top-down language design. For example, I am a ruby guy (obviously). I use ruby as a glue language for just about everything. I already use ruby-gtk and while I can do well with it (in particular GTK3 is really nice; I love CSS support, hopefully libui can have that too one day), getting it to run on windows is not so easy, in particular when you deal with elderly people. And in particular for these people, libui could be REALLY nifty. Just getting it all installed, up and running, perhaps even with that one-click executable on windows. So if that is one design goal for libui, then we can also think about libui less so about "restricted to this or that toolkit", but simply as a general purpose (small) wrapper library that you can target (in different languages) to "make things work". It's like a DSL for a meta-GUI in that case, if you know what I mean there. I already use web-related stuff (sinatra mostly, a bit of javascript too) and I also already use ruby-gtk, so I have a LOT of UI. Most of this can be easily adjusted to make it possible to work with libui as well, so I'd get an almost "free" additional set of bindings that I can use in my own projects.

To me that is a huuuuge potential sell. Note also how other custom bindings, such as ruby-wxwidgets or ruby-qt bindings, died. And one reason in particular for the latter was how much work it ended up being to maintain ever-changing qt. (With ruby-wxwidgets it was a bit different but the main dev had to work full-time on C++ projects so there is that...)

rubyFeedback avatar Jan 18 '21 18:01 rubyFeedback