User avatar
DavidS
Posts: 3096
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Truly portable lightweight GUI toolkit?

Mon Sep 10, 2018 4:37 pm

In having been given a concept for a front end type program that would help with writing SD/Disk images to SD cards (using dd on the back end), I am wondering if it is easily doable in C.

Is there a truly lightweight toolkit that is portable across all the commonly platforms today. One that is very easy to use (as easy as the GUI, mouse, and graphics, commands in AmigaBASIC are to use), that can be used from C89 standard ANSI C, and is truly open source (not limited like GPL is limited)?

It would be nice to be able to use a standardized language (ANSI C) to implement the concept. Though as it stands the only option I know of is to use a subset of FreeBASIC/QuickBASIC/AmigaBASIC that holds common across most platforms (and even then leaves out a few important ones). I would rather use C.

Platform Support:
Minimally would have to already be available on Win32/Win64, unixen with X (Linux, BSD, MiNIX, Solaris, Darwin, etc), RISC OS, TOS/MultiTOS + GEM, HaikuOS/BeOS, AROS, and Syllable. These are the most common OS's in use today, thus the choice of there requirement (or in the case of RISC OS one of the RPi native OS's). If the toolkit is also available for other systems that would be a plus.

Lightweight:
There is no reason for such a toolkit to consist of more than a single shared library, that is less than 512KB in size (preferably less than 128KB). It should also be available in a static linkable form, for systems that require hacks to use shared libraries (like RISC OS). Also it should require as little RAM memory usage as reasonably possible.

One important part of being lightweight:
it should not have any dependencies beyond what the base systems on which it is run provides in the minimal form of said systems. This is a very important one that many 'lightweight' libs ignore.

Open Source:
Non restrictive, in every reasonable way. A license that is at least as open as the 3 clause BSD license, licenses that are more open are acceptable as well (2 clause BSD, MIT, PD, Unlicense, etc).

The extreme open nature of the toolkit ensures that it is usable for all, not just open source movement supporters. I feel this is an important step in gaining more traction for Open Source, there are still many commercial entities that will not touch Open Source because of the popularity of the GPL and its restrictive nature.

One Possibility:
I know that Xlib implementations are available for all the mentioned platforms. In many cases operating synchronous as they do not need to use an actual X server, they just call out to the native Windowing System. i also know that many are under 256KB in size and very memory efficient.

Though it would be better if XCB were available, as it has many advantages over Xlib.

An Unknown about Xlib?:
Is there a decent small staticaly linkable Xlib implementation for Win32, that does NOT use an X server? And what about Darwin+Aqua (wrongly called macOS).

I know that the others are covered. And for some X is the native Windowing system.

Other Possibilities:
SDL: Is SDL available on TOS/MultiTOS+GEM, AROS, and Amiga OS? SDL would add support for a couple more platforms (FreeDOS etc) if it is available for all the required platforms.
Allegro: Is Allegro available on all required targets? Not as good of an option as SDL as it is bigger (SDL can be under 64KB in many cases, never seen bigger than 512KB).
Last edited by DavidS on Mon Sep 10, 2018 5:33 pm, edited 3 times in total.
26-Bit R15 to 32-bit. 16-bit addressing to 24-bit. ARM and 65xx two CPU's that continue on, and are better than ever. Assembly Language forever :) .

User avatar
DavidS
Posts: 3096
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Truly portable lightweight GUI toolkit?

Mon Sep 10, 2018 4:59 pm

One additional requirement:
Should be able to be compiled with TCC, GCC, BCC, and AHCC/Pure C.

Again thinking about maximum portability, among OS's still in common use that have a Graphical Windowing system.
26-Bit R15 to 32-bit. 16-bit addressing to 24-bit. ARM and 65xx two CPU's that continue on, and are better than ever. Assembly Language forever :) .

Heater
Posts: 9841
Joined: Tue Jul 17, 2012 3:02 pm

Re: Truly portable lightweight GUI toolkit?

Mon Sep 10, 2018 5:40 pm

DavidS,

I'm almost certain there is no such GUI toolkit that meets all your requirements.

If you really want to create a GUI program for writing SD/Disk images to SD cards that is usable by 99.9 percent of your fellow humans that have a computer then use electron. Oh wait, the resin.io guys already did that, it's called Etcher.

If you want to create that same GUI application for the remaining 0.01 percent of computer uses then you have some work to do.

I am confused by your statement:
The extreme open nature of the toolkit ensures that it is usable for all, not just open source movement supporters. I feel this is an important step in gaining more traction for Open Source, there are still many commercial entities that will not touch Open Source because of the popularity of the GPL and its restrictive nature.
Firstly supporters of the Open Source idea, not the capitalization there, are quite happy with source code licensed in such a way that commercial entities can use it, extend it, sell it with no feed back to the common good of open source.

See: https://en.wikipedia.org/wiki/Open_Source_Initiative

Secondly, the only way to make the software open to all, forever, is to use a Free Software license. Like the GPL.

User avatar
DavidS
Posts: 3096
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Truly portable lightweight GUI toolkit?

Mon Sep 10, 2018 5:52 pm

Heater wrote:
Mon Sep 10, 2018 5:40 pm
DavidS,

I'm almost certain there is no such GUI toolkit that meets all your requirements.

If you really want to create a GUI program for writing SD/Disk images to SD cards that is usable by 99.9 percent of your fellow humans that have a computer then use electron. Oh wait, the resin.io guys already did that, it's called Etcher.

If you want to create that same GUI application for the remaining 0.01 percent of computer uses then you have some work to do.
I think your percentages are a bit off. Within 15 miles of where I live I know for sure of 18 DOS users, 1 RISC OS user (me), 4 Atari ST users, 2 Amiga users, 6 Syllable users, and over 20 Anti JS Linux users. Of those about a third of them use or also use one or more RPi's.

And I live in a very small town in the middle of the Sonoran Desert (where I intend to stay for the next 40 years). So more tech inclined areas would likely have even more alternative users per capita. I could be wrong, though there are definitely a significant number of people being left out by your view.

I am confused by your statement:
The extreme open nature of the toolkit ensures that it is usable for all, not just open source movement supporters. I feel this is an important step in gaining more traction for Open Source, there are still many commercial entities that will not touch Open Source because of the popularity of the GPL and its restrictive nature.
Firstly supporters of the Open Source idea, not the capitalization there, are quite happy with source code licensed in such a way that commercial entities can use it, extend it, sell it with no feed back to the common good of open source.

See: https://en.wikipedia.org/wiki/Open_Source_Initiative

Secondly, the only way to make the software open to all, forever, is to use a Free Software license. Like the GPL.
You may note that three of the licenses I mention are Free Software Licenses and accepted by OSI.

Not going to get into that discussion again, I thought we agreed to disagree over 4 years ago on that issue.
26-Bit R15 to 32-bit. 16-bit addressing to 24-bit. ARM and 65xx two CPU's that continue on, and are better than ever. Assembly Language forever :) .

k-pi
Posts: 606
Joined: Sun Feb 12, 2017 1:46 pm
Location: Upper Hale, Surrey, UK.

Re: Truly portable lightweight GUI toolkit?

Mon Sep 10, 2018 5:59 pm

Just saw the thread title - (this may have been mentioned).

FLTK - Fast Light Tool Kit - http://www.fltk.org/index.php

Heater
Posts: 9841
Joined: Tue Jul 17, 2012 3:02 pm

Re: Truly portable lightweight GUI toolkit?

Mon Sep 10, 2018 6:44 pm

DavidS,
I think your percentages are a bit off. Within 15 miles of where I live I know for sure of 18 DOS users, 1 RISC OS user (me), 4 Atari ST users, 2 Amiga users, 6 Syllable users, and over 20 Anti JS Linux users. Of those about a third of them use or also use one or more RPi's.
I'm going to stick with my "finger in the air" percentage.

I have not met a DOS, RISC OS, Atari or Amiga user for over twenty years. It's not like I haven't traveled around and met a lot of computer nerds, commercial and otherwise in that time.

I have never even heard of Syllable.

Yeah, OK, there are JS haters everywhere. Usually I find it's because they don't know JS very well and/or they confuse JS the language with the platform it is mostly known to run it, the web browser. They attribute all the security problems and other annoyances of the web browser environment to the language. Really, if browsers used Pascal and allowed it all the same capabilities then Pascal would suffer the same hate.
You may note that three of the licenses I mention are Free Software Licenses and accepted by OSI.
Indeed. But note that the requirements of the Open Source Initiative are not as stringently demanding Free Software as the GPL and others.

Yes, I seem to recall we have this discussion before some years ago. Which is why I was surprised at your licensing requirements just now.

jahboater
Posts: 2939
Joined: Wed Feb 04, 2015 6:38 pm

Re: Truly portable lightweight GUI toolkit?

Mon Sep 10, 2018 6:50 pm

Heater wrote:
Mon Sep 10, 2018 6:44 pm
I have not met a DOS, RISC OS, Atari or Amiga user for over twenty years.
I think I would say at least 30 years for the last time I saw real DOS (not the DOSBOX emulator).
Very odd, I wonder what the 18 DOS users do with it?

DavidS,
The Sonoran Desert must be very beautiful - I envy you!

(I used to read Carlos Castaneda when I was young).

User avatar
DavidS
Posts: 3096
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Truly portable lightweight GUI toolkit?

Mon Sep 10, 2018 7:04 pm

jahboater wrote:
Mon Sep 10, 2018 6:50 pm
Heater wrote:
Mon Sep 10, 2018 6:44 pm
I have not met a DOS, RISC OS, Atari or Amiga user for over twenty years.
I think I would say at least 30 years for the last time I saw real DOS (not the DOSBOX emulator).
Very odd, I wonder what the 18 DOS users do with it?
FreeDOS version 1.2 is not nearly that old (Released November of 2016).
http://www.freedos.org/

FreeDOS is the current DOS for those that still use DOS as a primary OS. I have toyed with the idea of writing a super minimal OS for the RPI that just emulates an 586 CPU and the standard PC HW having 768MB of RAM with a SB16 sound card and a S3 Virge graphics adapter, just to run DOS on the RPi without having to have a complete OS under it. Though I am not good enough at supporting enough HW in bare metal on the RPi.

People do word processing, web browsing, E-Mail, graphics editing, 3D modeling, File transfer, Utility systems, File viewing, Multimedia, programming, cross development, emulation, etc. Or more simply put, everything you do with other systems, just as well in most cases (Ok DOS based Graphical Web Browsers are behind the curve, the best, that I know of, being Dillo).
DavidS,
The Sonoran Desert must be very beautiful - I envy you!
It is home. Yes it is great, makes living off grid a lot easier than some climates.
26-Bit R15 to 32-bit. 16-bit addressing to 24-bit. ARM and 65xx two CPU's that continue on, and are better than ever. Assembly Language forever :) .

Heater
Posts: 9841
Joined: Tue Jul 17, 2012 3:02 pm

Re: Truly portable lightweight GUI toolkit?

Mon Sep 10, 2018 7:28 pm

MS-DOS does not require an Intel 586 processor or make any use of it's features (other than speed). Nor even 486, 386 or 286.

Writing an emulator for the Intel 8086 is not so hard though I'm sure there are such things already.

Just need to marry such an emulator up with Free DOS to get DOS on the Pi.

I'm not sure how that would help with a Truly portable lightweight GUI toolkit though.

User avatar
DavidS
Posts: 3096
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Truly portable lightweight GUI toolkit?

Mon Sep 10, 2018 7:45 pm

Heater wrote:
Mon Sep 10, 2018 7:28 pm
MS-DOS does not require an Intel 586 processor or make any use of it's features (other than speed). Nor even 486, 386 or 286.

Writing an emulator for the Intel 8086 is not so hard though I'm sure there are such things already.

Just need to marry such an emulator up with Free DOS to get DOS on the Pi.
Many modern DOS applications require at least a 586, some even require processors supporting SSE, SSE2, etc, and even newer instructions in a few cases.

And there are many DPMI DOS applications that require at least 32MB of RAM, some that are able to take advantage of more than 512MB (if available).
I'm not sure how that would help with a Truly portable lightweight GUI toolkit though.
Not really related. Got a little bit off topic.
26-Bit R15 to 32-bit. 16-bit addressing to 24-bit. ARM and 65xx two CPU's that continue on, and are better than ever. Assembly Language forever :) .

User avatar
bensimmo
Posts: 3227
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: Truly portable lightweight GUI toolkit?

Mon Sep 10, 2018 8:02 pm

As with Heater, to cover portability you need Windows varients, MacOS varients, iOS Android's and then onto various Linux systems (which is a small number compared to the last four mentioned OS's)
After that it's minor OSs or server specific setups.

You have a oddly large number of people using different systems near you, especially if that is outside just and interest.
(Even Linux if only looking at the Desktop market, is less than 2% and FreeBSD which I think is the 6th largest is ~0.01% someone may know better, this was last time I had a look, there is a small but significant unknown, around the Linux size, probably hidden info from a mix of the large ones)


But it's not for me to tell you not to support the small interest groups. Why not, that's what cross platform is for.


As a side Etcher does not work on Raspbian, so it actually leaves out one of the OSs that champions its use.

P.S. nice to see you posting, always interesting to see a completely different view on things.
P.P.S. market share is probably of people that go online, so neglects people who do not of course.

User avatar
DavidS
Posts: 3096
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Truly portable lightweight GUI toolkit?

Mon Sep 10, 2018 9:49 pm

bensimmo wrote:
Mon Sep 10, 2018 8:02 pm
You have a oddly large number of people using different systems near you, especially if that is outside just and interest.
(Even Linux if only looking at the Desktop market, is less than 2% and FreeBSD which I think is the 6th largest is ~0.01% someone may know better, this was last time I had a look, there is a small but significant unknown, around the Linux size, probably hidden info from a mix of the large ones)
I think there are a lot more users than are realized with the other OS's. I believe that the line on what is known comes down to how much the users of these OS bother to talk about it online. Many of them are not into sharing much online (other than the occasional program they write for the given OS, hence why we still see a lot of new DOS software that seems to come from nowhere).

But it's not for me to tell you not to support the small interest groups. Why not, that's what cross platform is for.


As a side Etcher does not work on Raspbian, so it actually leaves out one of the OSs that champions its use.
Very true. I note that there are people that use Raspberry Pi systems as there primary systems (or in some cases only systems). I have finally gotten rid of all of my other desktop computers, replacing them by Raspberry Pi's, primarily do to the fact that the Raspberry Pi 3B combined with a 5 inch display a mouse and a keyboard almost never draws more than 10 watts of power, while being more than powerful enough for what I need, and having way more memory than I need. That means that all three of my desktop computers (RPi with 5 inch displays) if running full out would never use more than 30 watts, thus no more than 720 watt hours per day (though i usually only have 2 running at a time, so no more than 480 what hours per day).

As my power is 100% solar off grid, and my solar system produces between 2400 and 3200 watt hours per day, the energy savings help out a lot.
P.S. nice to see you posting, always interesting to see a completely different view on things.
P.P.S. market share is probably of people that go online, so neglects people who do not of course.
26-Bit R15 to 32-bit. 16-bit addressing to 24-bit. ARM and 65xx two CPU's that continue on, and are better than ever. Assembly Language forever :) .

User avatar
Gavinmc42
Posts: 2108
Joined: Wed Aug 28, 2013 3:31 am

Re: Truly portable lightweight GUI toolkit?

Tue Sep 11, 2018 1:12 am

The Sonoran desert must be like a retirement community for old and retro micro guys who don't like Florida ;)
Alternative lifestylers are probably also going to be alternative OS users?
I wish your community was typical of the Rest of the World, but burbanites are stuck in the trap of consumerism.

Noshbar had a free weekend and did some emulators :shock:
https://ultibo.org/forum/viewtopic.php?f=9&t=1179
SDL seems wide spread?

I am looking for something that uses acceleration OpenGLES/VG or OpenGL.
Mainly because these SOC Arm chips popping up everywhere rarely have open gpu drivers.
That situation is changing and in a few years Vulkan will probably be a player.

So is there a GUI toolkit that also allows hardware acceleration?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

Heater
Posts: 9841
Joined: Tue Jul 17, 2012 3:02 pm

Re: Truly portable lightweight GUI toolkit?

Tue Sep 11, 2018 3:56 am

Many modern DOS applications require at least a 586, some even require processors supporting SSE, SSE2, etc, and even newer instructions in a few cases.
That is no doubt true. At that point they are not really DOS applications any more. They are probably using the processors 32 bit protected mode (DOS is only a 16 bit OS). Basically they take over the machine almost bypassing DOS completely. DOS ends up as just a means of booting the program and accessing files.

You have reminded me of one of my most fun projects. Back in the day when the Intel 386 was new I worked on a program that was part of a schematic capture and PCB design suite, CADSTAR, on MS-DOS. You can still buy CADSTAR https://www.zuken.com/en/products/pcb-design/cadstar.

Anyway, that program required a lot of memory so I used the Watcom C compiler that could generate 32 bit code and access all the megabytes of the new 386 based PC's that were coming along. All in a flat address space, none of that old 64K segmented memory of the DOS world.

It was another 10 years before consumers got a 32 bit operating system with Windows 95.

User avatar
Gavinmc42
Posts: 2108
Joined: Wed Aug 28, 2013 3:31 am

Re: Truly portable lightweight GUI toolkit?

Tue Sep 11, 2018 5:11 am

Anyway, that program required a lot of memory so I used the Watcom C compiler that could generate 32 bit code and access all the megabytes of the new 386 based PC's that were coming along. All in a flat address space, none of that old 64K segmented memory of the DOS world.
It still lives :o
http://openwatcom.org/about.php
Compile Doom, Descent, Duke Nukem 3D?

An OS2 GUI? A very dusty memory.
https://ecsoft2.org/watcom-vx-rexx

Wow, even OS2 still lives, but not open source
https://www.arcanoae.com/arcaos/
Or is it http://www.osfree.org/
OS2 on Pi's ;)
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

bzt
Posts: 161
Joined: Sat Oct 14, 2017 9:57 pm

Re: Truly portable lightweight GUI toolkit?

Tue Sep 11, 2018 8:12 am

Just for the records, MacOSX supports Xlib since the BSD rewrite. Older versions needed a special X11.App to provide the Xserver (installed by default), but now it's totally integrated.

Back to your original question, the closest to your spec (that I know of) is nuklear

- written in ANSI C89
- no linking needed, single C header file
- no dependencies
- focuses on portability
- permissive MIT license
- works with all the systems you mentioned *

* Because this library implements GUI widgets only, you have to integrate it with those systems, by providing a framebuffer and an event dispatcher:
It is worth noting that no direct OS or window handling is done in nuklear.
Instead all input state has to be provided by platform specific code. This on one hand
expects more work from the user and complicates usage but on the other hand
provides simple abstraction over a big number of platforms, libraries and other
already provided functionality.
So for example if you want to use it over Xlib, then you have to convert XEvents to nuklear events. On DOS, you'd use BIOS calls to get the framebuffer and keyboard/mouse ISRs to get the events.
For portability, I'd suggest to use the low level SDL2 library, which provides a framebuffer and input events on all modern operating systems, most of the old systems, plus many of the hobby OSes you have mentioned, but does not have a GUI widget toolkit of it's own.

My second guess would be wxWidgets, which gives you common interface with native look-and-feel accross systems. But it is a more roboust library, that includes OS integration. That means you can use it out-of-the-box, but it's not supported by all the systems you want. For example on Linux, it depends on the GTK toolkit.

Cheers,
bzt

User avatar
Gavinmc42
Posts: 2108
Joined: Wed Aug 28, 2013 3:31 am

Re: Truly portable lightweight GUI toolkit?

Tue Sep 11, 2018 8:41 am

That Nuklear looks very interesting, modern flat style too.
https://rawgit.com/vurtun/nuklear/maste ... klear.html
Usage

To draw all draw commands accumulated over a frame you need your own render backend able to draw a number of 2D primitives. This includes at least filled and stroked rectangles, circles, text, lines, triangles and scissors. As soon as this criterion is met you can iterate over each draw command and execute each draw command in a interpreter like fashion:
Would I be right in saying the basic draw shapes could be done with OpenVG?
Interface to Nim?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

Heater
Posts: 9841
Joined: Tue Jul 17, 2012 3:02 pm

Re: Truly portable lightweight GUI toolkit?

Tue Sep 11, 2018 12:08 pm

That Nuklear is pretty cool.

You can transpile your Nuklear app to Javascript with Emscripten and run it the browser. Like this very slick demo: http://dexp.in/nuklear-webdemo/

Return to “General programming discussion”

Who is online

Users browsing this forum: No registered users and 4 guests