Live data from Hacker News

Libui: GUI library in C

github.com

141–150 of 186 posts

Re: Libui: GUI library in C

#141
post #139

Can it handle printing too? That's a cross platform PITA too.

That's planned, yes. (I have to do it anyway, because in most cases it's the print dialog that gives you the printer device cntext...) This is also why it's uiDrawContext, not uiAreaDrawContext.

Re: Libui: GUI library in C

#142

Earlier quoted context omitted.

My personal reason is that GTK 3+ lost his track in what constitutes a desktop widget set. It's also getting slower at each release, it keeps breaking visual consistency and basic features get removed or heavily deprecated in favor of a "dumbed down" approach. So if the non-technical users are actually migrating to dumb web-apps and couldn't care less, the technical crowd which demand power features and efficiency ar…

> It's also getting slower at each release, it keeps breaking visual consistency and basic features get removed or heavily deprecated in favor of a "dumbed down" approach. This is simply not true. We are closer to hitting 60 fps (or whatever your EDID actually presents) than ever before, and staying locked to that. The more complex of an interface you create, the harder that is, but that is no different today than ev…

There is some great info in this post. The draining of the swamp is really good work, and seems to be starting to pay off.

I hope for the CSS theme changes there is some sort of migration, or warning - was trying gnome-staging on Ubuntu and lots of things broke with the change.

Fingers crossed that GL will bring GL Enabled cairo at the same time.

Re: Libui: GUI library in C

#143

Why would anyone write a GUI app in C? Almost every alternative is better for the job.

You wouldn't write the app in C at all, most likely. You would write the library in C, because every one of those alternatives can call a C library.

Re: Libui: GUI library in C

#144

This is a very good approach for the current times! As far as I understand from the source code, libui is a thin C wrapper that makes calls to each platform native ui framework. For instance, to create a window on OSX it calls the corresponding Cocoa function, for Linux the corresponding GTK function, etc. So, unlike Qt and GTK which are heavy cross-platform libraries because they can "draw" their own widgets themsel…

[deleted]

Re: Libui: GUI library in C

#145
post #16

I was recently thinking that operating systems should ditch their custom desktops in favor of a browser based UI. Microsoft tried this idea out and it didn't work a few years back but it still seems to me that a browser based OS UI would be far more effective than things like Gnome and KDE and all that stuff. Edit: well I guess Google had the same idea long ago and called it ChromeOS - browser as OS interface.

> I was recently thinking that operating systems should ditch their custom desktops in favor of a browser based UI. Here's the really funny thing though, if you just think about it for a second: Whether browsers become as powerful as operating systems, or operating systems become as convenient (for users and developers) as browsers, The end result will be exactly the same. Yep. Consider how we use browsers vs. native…

> Now obviously what browsers are missing is the UI responsiveness, efficient hardware performance, and OS integration.

> It will take far less work to make the discoverability and acquisition of native apps as convenient as typing in a web address.

I don't see that as the case at all. The UI libraries are just the tip of the iceberg.

In fact, I think CSS is better suited to hardware acceleration with modern GPUs than these native libraries, which date back to the '90s, are. That's because they're declarative instead of based on imperative systems like GDI that were designed for rendering on old CPUs.

Re: Libui: GUI library in C

#146

These APIs are notoriously hard to get right and coherent, and releasing at such an early stage will make it hard to change anything when building up on this. That said I do not know of any cross platform library in C, so this does seem to fill a niche.

Plus it's MIT licensed. You can fork this easily and maintain its behavior the way it suits whatever you're building even if the upstream changes in breaking ways.

Re: Libui: GUI library in C

#147
post #3

Finally. I'm hoping that a native UI toolkit that can be used via FFI from nearly any language might take a chunk out of the Web-as-application-delivery-platform mindset. I don't blame anyone for making non-native apps with Electron and HTML5, because it's so difficult to make them work on every platform. But here's to hoping someone finally got it right, and that native applications can take back some ground. Death…

I actually think that CSS is better for drawing with modern GPUs than native UI frameworks are. CSS is declarative, which enables global optimizations--very important on GPUs, where state changes are expensive and overdraw hurts. By contrast, native UI frameworks were designed for slow CPU rendering in the '90s via legacy APIs like GDI.

Re: Libui: GUI library in C

#148
post #60

Why would anyone write a GUI app in C? Almost every alternative is better for the job.

Me, because I don't want any of: - huge binaries (or dependencies) - slow compiles - slow runtime - garbage collection - non-portability - C++ (I just don't like it) ...pretty much every popular language other than C falls into one or more of the above. Yeah, I know I'm fussy.

It's odd to see you saying this, given your security focus. But I suppose implicitly you're referring to UI apps that don't expose remote attack surface.

Anyhow, I used to be the same way (perhaps surprisingly given what I work on now), but I stopped once I realized that it just takes so long to do basic things in C compared to other languages. The downside of slow compilation, for example, pales in comparison to the downside of it taking a lot more code to do basic things like string manipulation.

I'd also mention that, on Windows, C has big dependencies as well (msvcrt), unless you cheat like MinGW does and use the unsupported system msvcrt.

Re: Libui: GUI library in C

#149
post #96
post #65

Nice work, but I wish SWT had picked up more steam outside the Java community. It's the same idea, but with a decade+ of banging on the corner cases for the use cases of the Eclipse IDE. In addition to all the standard controls, it's also got OpenGL and browser embedding since before Electron was cool. Using it on the JVM is very easy, but there was a short-lived attempt to maintain a C++ API. - How it looks: https:/…

Wouldn't you have to embedd JVM to use SWT? Reminds me of a quote by Joe Armstrong, creator of Erlang, on OO programming: "You wanted a banana but what you got was a gorilla holding the banana and the entire jungle."

Pure-native was a full C++ port. The Java part of SWT uses manual memory management, and is written very simply. I think you could autoconvert it to C++ and present the API that way.
Post reply on HN