6 ms·
Little Forms – an open source minimalistic GUI widget library written in plain C
- fizixer 11y agoJust. Amazing! As someone who is Gtk, Qt, C++ averse, I thought I'll have to settle on something like FLTK. This is another option in my basket. Is it tied to X or fairly independent? Because Wayland is an upcoming standard which aims to be a lot more cruft-free.
- pzone 11y agoLooks like it supports X and W32. Unless it's using a lot of the crufty "draw a stippled line" sort of functionality that X provides it would be pretty easy to port. That is, if all it does is construct a bitmap in memory and hand it off to the compositor, it's practically Wayland-ready.
- RightWingRabble 11y agoWhy are you Qt averse? Is it the C++ or something to have to do with Qt itself?
- LukeShu 11y agoI'm not the user you're asking, but: - It used to be that Qt was massive; because it existed before ubiquitous, usable STL implementations, Qt had to essentially also ship its own C++ standard library. Which meant that you couldn't use standard C++ strings, you had to use QString, and so on. This is less true with Qt 4 & 5, but reputations stick around. - Often-times C++ APIs are a pain, even if you are using C++, many people have the opinion that the API exposed should be C.
- prewett 11y agoSTL strings are also next to useless. startsWith(), endsWith(), split(), case-insensitive find, stringify a number, numericify a string, easily construct a formated string, properly handles unicode (wstring does not), all require extra code. QString has a function for each of those. And the STL data structures are sometimes kind of unwieldy: if (dict.find(key) != dict.end()) { ... } is lame compared to the easily understood: if (dict.contains(key)) { ... } Not to mention all the stupid inconsistencies: // std::vector has no sort function, haha! std::sort(std_vector.begin(), std_vector.end()); // std::sort doesn't work on std::list, haha! std_list.sort(); And my favorite annoyance, the fact that std::vector::size() returns unsigned int, despite the fact that for practical purposes you aren't going to get anywhere near even 2 billion elements without running out of memory (or other performance problems), so I'm stuck writing for (unsigned int idx = 0; idx < v.size(); ++idx) {...} or omitting the "unsigned" and getting lots of compiler warnings. I get why they would have done it; I would have done it too. Until I used Qt, then I like how everything is simply int. I suppose if you are doing physics simulations or something you might need something different, but it's the rare GUI program that needs unsigned int for size.
- okasaki 11y ago2 billion chars = 2G of data, so not that big.
- imron 11y agoYou're unlikely to have a std::vector containing 2 billion single byte elements however. Even being conservative, say you had a struct of size 24 bytes (e.g. 3 doubles x, y and z) then now you're up to 48G. So yes, there are very few situations where you'll have meaningful data that would fill a vector indexed by signed ints without running out of memory first.
- blt 11y agoBut... Sometimes you do. Can you imagine how stupid it would feel if you had to abandon all your std::vector-using code the moment you need to deal with an array bigger than 2 billion elements?
- imron 11y agoActually, thinking about it a bit more, the only thing you could store in a std::vector indexed by signed ints where you would have a problem would be single bytes. If you have 2 billion 2 byte elements then that's 4gb which is the total addressable space on a 32-bit system - leaving no room for program code or any other data meaning you couldn't run anything. You could go 64bit, but then signed ints go up to (2^63)-1 and you have the same problem - elements more than a single byte in size will cause you to run out of addressable memory before you exhaust available signed ints.
- x1798DE 11y agoAlso not the op, but I personally tend to avoid Qt if I can help it because I prefer to release software under MIT/Apache/BSD style licenses, which is incompatible with GPL style licenses (in that direction), or makes things more complicated at the very least.
- mappu 11y agoFor me it's the `moc`. Is it even possible to use Qt with only standard C++?
- prewett 11y agoAs long as you don't use anything derived from QObject, but that pretty much defeats the purpose... The moc is to effectively extend C++ with signals and slot at a language level. I'm not crazy about the moc, but I love signals and slots. The only alternative is slow-compiling templates like boost signals and slots, which also have less than compelling syntax.
- fizixer 11y agoSimilar to what LukeShu said. - I'm in the camp that thinks widget libraries for C++ should be workable in C. - I'm big on minimalism, and being strongly aware of "90% of programs out there are bloated", and was horrified when I had to install a tiny Qt based program in ubuntu, and it required me to install a gazillion packages that looked like they belonged to Qt. (I don't remember the details). - I always keep looking for C programs that can do in a couple thousand lines, what takes tens of thousands of non-C code for other programs to accomplish. I'm fairly aligned with the suckless philosophy, although I may not 100% agree with them. (suckless website would give you a good idea of what I'm talking about).
- simplicio 11y agoIt looks like the x11 specific stuff is sectioned off in four source files, so I doubt it would be that hard to port to a different display server.
- mwcampbell 11y agoA toolkit like this is only another option in your basket if you can ignore real-world considerations like: - Internationalization: The edit control doesn't support input method editors. On Windows, wide-character functions aren't used; that means Unicode isn't supported. - Accessibility: Here I'm talking about the ability for users with disabilities, most notably blind users but also users with mobility impairments, to access a UI via assistive technologies such as screen readers or alternative types of input. This requires the GUI toolkit to implement an accessibility API such as Microsoft Active Accessibility or UI Automation on Windows, or AT-SPI for X11-based environments. This is something that practically everyone who sets out to implement a lean, mean, simple toolkit just doesn't pay attention to. - Native look: The toolkit doesn't attempt to mimic the look of the rest of the system at all. On my Windows 10 machine, the demo looks like a throwback to Windows 95. This is also an accessibility issue, for low-vision users that need a different color scheme. And there are probably other considerations I've forgotten or am unaware of. You'd probably be better off using one of those big, bloated C++ toolkits, like Qt or (better yet, IMO) wxWidgets. Not GTK, since that doesn't cover accessibility except under X11 via GNOME.
- eschaton 11y agoIt looks like a throwback to Windows 95 because it actually appears to clone the NEXTSTEP look and feel, which is what Windows 95 also cloned.
- BruceM 11y agoBlendish (https://bitbucket.org/duangle/oui-blendish/overview https://bitbucket.org/duangle/oui-blendish/overview) is pretty amazing and lightweight (by itself). It works with NanoVG, so it is useful in environments where you're already running OpenGL.
- buserror 11y agoThats a very nice find, thanks for the link. I'm not entirely sure about putting everything into a header file -- and marking load of pretty big functions as 'inline' but well, it simplifies the build a lot it seems!
- phoogathrw 11y agoI really like this guy's approach to open source projects: http://runtimelegend.com/abitopen.txt http://runtimelegend.com/abitopen.txt Assuming this approach would relieve a lot of the stress I've experienced on my more popular projects. I'm seriously considering it.
- chei0aiV 11y agoMost of the benefit of open source projects is that they are open to collaboration, I would avoid even using a project with policies like that if I knew about them.
- placeybordeaux 11y agoThats what you get from it, it doesn't mean that how other people feel. I think one of the major advantages of open source is that you can fix a bug or add a feature that you want.
- wbond 11y agoThat seems to be in line with what the author wants. Plenty of people prefer open source to mean "you can copy my code," and not "let's build something together". You using, or not using, the author's code will likely have no impact on him. I have a variety of open source projects, and some fall towards each end of the spectrum.
- em3rgent0rdr 11y agounderstandable, athough I can also understand his position. Actually I think he himself just wants to not collaborate, but I don't see anything saying that you can't copy his code and then collaborate with others. There are also other benefits of open source other than collaboration, such as security from being able to review the code, and being able to run in a totally free system.
- kjf5091 11y ago>If you prefer a more traditional open source collaborative project, feel free to fork one of mine that combines and accepts other people's contributions. http://runtimelegend.com/abitopen.txt http://runtimelegend.com/abitopen.txt
- Gracana 11y agoI wanted something like this and was reading about GUI toolkits when I decided to take a moment to check HN. Talk about good timing! On the other hand... I kind of want vector graphics, and cairo would be really great for that, and if I use cairo, well I might as well use gtk, and... hmm. I see why these things end up with lots of features.
- _RPM 11y agoPlan C is just great. I always can get excited about software if its written in C. I still havent figured out why though.
- frik 11y agoC syntax is simple and elegant. Same can be said to Go and Lua, the later two have additionally very good inbuilt string support. The BNF of these languages fits on one page
- joejoint 11y agowow, I dreamed I was in 2015 with powerful pocket size computers showing flashing GUIs with multitouch support. Darn.. I just woke up, I'm back in the 80's
- vurtun 11y agoAnother lightweight ANSI C library is https://github.com/vurtun/zahnrad https://github.com/vurtun/zahnrad. It is platform and render backend independent, has no dependencies and is configurable.