
Photon Micro GUI - ingve
https://www.cycfi.com/2019/07/photon-micro-gui/
======
mwcampbell
Please, please, _please_ don’t use a GUI toolkit like this, that draws its own
widgets rather than using platform standard ones, when developing a plugin for
a digital audio workstation (e.g. VST or Audio Unit), as this author is
apparently doing. Unless someone puts in all the extra effort to implement
platform-specific accessibility APIs for said toolkit. Inaccessible DAW
plugins are a problem for blind musicians and audio engineers because of GUI
toolkits like this one. Maybe screen readers will eventually use some kind of
machine learning to provide access to otherwise inaccessible GUIs, but that’s
probably still a long way off. So for now, we need application developers to
do their part.

I don’t actually know what the best cross-platform solution is. Is wxWidgets
fully functional in a context where it doesn’t own the event loop? I suspect
not on Windows in particular. Yes, yes, I know it’s ugly 90s C++, but really,
what’s more important, code aesthetics or usability?

~~~
bsder
> Please, please, please don’t use a GUI toolkit like this, that draws its own
> widgets rather than using platform standard ones, when developing a plugin
> for a digital audio workstation (e.g. VST or Audio Unit), as this author is
> apparently doing.

Um, I have normal but aging sight, and I still can't get a DAW that actually
scales its widget to something other than 200% (or 150% if I'm _reaaaaally_
lucky).

I have no GUI that renders at useful speeds using OpenGL or Vulkan.

The Photon author didn't just create this to be contrary. Modern OS GUIs don't
work very well for things like DAWs because DAWs often operate much more like
a game wherein the screen is animated and has 60fps of stuff going on.

Rather than complaining, write us all an open source GUI that doesn't suck and
people will happily use that and then people will write the accessibility
hooks for it.

~~~
mwcampbell
> DAWs often operate much more like a game wherein the screen is animated and
> has 60fps of stuff going on.

This is puzzling to me. Do sighted DAW users really rely on such a high-
bandwidth, continuous flow of visual information? What kind of information?
Mainly volume meters, or other things as well?

FWIW, I'm just starting to dabble with a DAW myself. But I know that blind
people have successfully done all stages of music and other audio production
using a DAW. From what I understand, they do it by concentrating solely on the
audio itself during real-time playback and recording. But the UI does need to
be accessible for non-real-time work, e.g. plugin configuration, switching
tracks, switching instruments, or making precise edits.

~~~
bsder
> This is puzzling to me. Do sighted DAW users really rely on such a high-
> bandwidth, continuous flow of visual information?

Yes. Volume meters, equalizers, beat counters, loop counters, etc. I can go on
and on.

There is a reason why people use specific DAWs for specific purposes (Hip-hop
guys seem to gravitate to Ableton Live, for example).

------
reaperducer
Too many skeuomorphic elements.

He needs to take the controls people know and understand and replace them with
cryptic methods that require new learning, and are hidden from view by
default. Otherwise no one will take it seriously as a modern UI.

~~~
mankeysee
The mobile and web people are probably triggered at this ui lol

~~~
asutekku
To be fair, knobs as shown in the screenshot are afwul in an usability’s point
of view (how do i rotate this, how to fine tune the value), but they convey
the information in the context of music plugins really well for the person
most likely to use them.

~~~
mirimir
Yes, how _does_ one adjust the setting of a knob?

Gestures?

~~~
mastry
A lot of DAWs use these. With the ones I have used you click the knob and then
drag (up to turn the knob left, down for right). It's really horrible
actually.

~~~
mirimir
Ah, so a slider, posing as a knob.

~~~
royjacobs
Yes, except taking up much less space.

~~~
setr
Which is exactly the purpose of a knob in meatspace too :)

~~~
mirimir
Right. Physically, potentiometers are semicircular sliders.

But another advantage of knobs is the ability to turn them, quickly and yet
accurately, with thumb and first finger. Some even have push-pull gear
reduction, to go between fast and accurate.

So you'd think that a GUI knob would use some analogous two-finger twisting
gesture. With thumb and first finger.

------
tyingq
Was confused for a moment because the Photon UI for QNX is also called a
"Micro GUI".

[http://www.qnx.com/developers/docs/6.5.0/index.jsp?topic=%2F...](http://www.qnx.com/developers/docs/6.5.0/index.jsp?topic=%2Fcom.qnx.doc.neutrino_sys_arch%2Fphoton.html)

~~~
rbanffy
Same here. Such a shame I need to go into my car to run QNX...

~~~
djowel64
Hi I'm Joel, the the author of Photon. It seems I have to change the name.
Bummer :-) Anyway, I didn't know. Thanks for pointing it out.

~~~
rbanffy
All good names are taken

~~~
djowel64
Just a stupid mistake, really. I know QNX, but I haven't used it and I didn't
know the QNX Photon name. You guys are right. I should've done a 3 minute
Google. My bad.

------
FraKtus
From the author "Photon has its own HTML5 inspired canvas drawing engine using
Cairo underneath".

That means it should render nicely at any resolution, the author says,
"resolution independent and allows for HDPI displays".

But using Cairo means it should not have a good performance at high
resolutions. I have yet to find a fork of Cairo GPU accelerated that supports
all the API. So it may fit the bill if you are coding a simple interface, but
it will be too slow to render at 60FPS and at high resolution.

What comes closest for me is Dear ImGui, but I never saw an interface with
those nicely rendered buttons in real-time done with Dear ImGui.

~~~
srikz
I'm curious if you have come across (and recommend) any framework which lie in
between Photon (Cairo) and Dear ImGui.

I'm trying to follow all thr efforts in native desktop GUI tools and am
currently using Dear ImGui for something which will only be used internally.

~~~
elcritch
You might try Scenic. It’s more embedded oriented but does run on desktops
using OpenGL. Also it’s new so the component library is pretty small still.

~~~
srikz
Yes, have been excitedly following Scenic since Boyd Multerer's talk about his
experiments a couple of years back. Haven't tried it yet as I somehow kept
putting off wrapping my head around Elixir and FP

------
fasterdom
Funny how there are a few domains where the same problem is solved over and
over again. Probably an indication that a good solution is truly missing.

A long time ago I wrote a tiny audio synth. And yep, I wrote my own minimal
GUI which had stuff like sliders, and most importantly knobs which general
GUIs typically don't provide.

Now I'm working on a non-audio webapp, and I have a problem where a knob would
be the ideal solution. Searched far and wide for a Vue knob, and what I found
was not usable. It worked if you "rotated" it circularly, but it didn't work
if you pulled it up/down like a slider. You might say "use a slider then if
you want to pull it up/down". True, but a slider takes a lot of UI space which
sometimes is very precious. More importantly, the slider resolution is limited
to it's height, while a knob could for example use the whole screen height for
a full turn.

~~~
extra88
> minimal GUI which had stuff like sliders, and most importantly knobs which
> general GUIs typically don't provide.

They don't provide knobs because they're a bad idea for input. Holding
mousedown while drawing an invisible arc with the cursor is an awkward way to
change a value. Sliders are generally better but still not great on interfaces
with cursors (they're better on touchscreens). Skeuomorphism can be a useful
visual design cue but it needs to be secondary to the input capabilities of
the device.

Up and down arrow buttons(or plus/minus, or whatever makes sense for the
value) are very compact and operable with a variety of input methods. Buttons
need a way display the value but there are many options including putting them
in the center of a ring of numbers like a knob would use.

~~~
vbsteven
In a good knob it’s not an arc but just clicking and dragging straight up or
down that makes it move. A lot of VST audio plugins work like this and they
get a lot of controls into a small area like this.

~~~
extra88
But then the gesture doesn't correspond to the interface at all. You could get
the compactness plus a visual that corresponds by having something like a
vertical slider that appears when you mousedown on the spot.

~~~
jcelerier
> But then the gesture doesn't correspond to the interface at all.

I remember learning soft synths when I was 11 - 12 years old and back then it
maybe took me a few minutes to get it. Come on.

------
Razengan
My current fantasy is that Apple would open-source SwiftUI and the industry
converges around that for native UIs, adding support for custom third-party
skins/themes later.

If they can already do it for such distinct devices as Mac, iPhone, iPad, TV
and Watch, there's no reason it can' be adapted for Windows, Linux and Android
as well.

This is something that should have happened 5 years ago, before Electron etc.
had a chance to fill in a obviously much-needed need.

Really, why do we need anything more than "Button" to describe a button, or
"List" to describe a list, on any GUI? HTML solved this a trillion years ago,
it's a wonder it took so long to be wholeheartedly adopted for native UIs. I
know Microsoft tried with WPF/XAML but it didn't seem to catch on.

~~~
pjmlp
It certainly did catch on Windows, served as influence to JavaFX and QML
design, and the WPF grid layout landed on the Web as the initial CSS Grid
proposal.

~~~
Razengan
Are most Windows apps currently designed with WPF or something else?

I have always looked to things like the Calculator and Notepad as a signal of
confidence; I know there’s little _reason_ to rewrite them, but the proof of
the pudding would be if Microsoft updated something as “simple” as those
applets to their championed UI framework.

I know Visual Studio (and their abandoned Expression Studio) is/was built with
WPF, but what’s the score in the “wild”?

~~~
pjmlp
Most greenfield enterprise apps are WPF/UWP, some still insist on using Forms
though.

No one uses MFC/ATL for greenfield applications on Windows.

When C++ comes into play, it is plugged via DLLs or COM into .NET applications
(or even via C++/CX, C++/WinRT or C++/CLI).

As for pure Win32 C style, for greenfield apps, only if are feeling masochist.

Not counting 3rd party alternatives here like Qt, Delphi or C++ Builder.

~~~
Razengan
What's the distinction between WPF/UWP/WinRT/.NET?

What's the Windows' analogue of Swift+SwiftUI? i.e. telling someone new to the
platform about what to focus on.

------
amelius
Looks promising. Some things I'd like to see explained:

\- How does rendering work? Is it using retained mode or not?

\- Does the system prevent unnecessary work, such as repainting of certain
elements (even when scrolling, since scrolling can be implemented using a less
expensive bitblt)?

\- How easy (natural) is it to change the UI hierarchy once it is running?

\- Is memory management natural? Is there a form of garbage collection or
reference counting for UI elements? How easy is it to accidentally refer to
deleted UI elements?

\- Does it make use of a GPU if available?

~~~
djowel64
I'll do that in a follow up post. To be honest, I wasn’t ready to release this
yet, not in this form, so the info is very preliminary, as noted in the
introduction: "Let me tell you a bit about Photon… From my previous post about
Ascend, some folks noticed its existence and actually found the github
repository. The repository is rather underwhelming, I thought to myself,
devoid of any documentation of any sort, other than a very terse description:
“Photon Micro GUI library”. I figured perhaps it’s good to post preliminary
information about it, maybe starting with some history and basic architecture
and design principles and code snippets. Just enough to give it a bit of
justice that it deserves."

And then one of my Boost ([https://www.boost.org/](https://www.boost.org/))
peers twitted about it, and ended up being posted here.

It seems I have a lot of work to do...

~~~
zengid
Hey thank you for your work. Giving the world a permissive Plugin-capable GUI
library is a really special thing, so from us plugin developers I hope you
know we appreciate your efforts.

------
kazinator
Nice screenshots; but doesn't seem "FFI friendly", unfortunately.

~~~
tomcam
what does that mean? a google search proved fruitless

~~~
RussianCow
FFI = foreign function interface[0], a way to call functions written in one
language (generally C) from another. By "FFI friendly" I think the parent
meant that Photon Micro GUI isn't something you can easily use from languages
other than C++.

[0]:
[https://en.wikipedia.org/wiki/Foreign_function_interface](https://en.wikipedia.org/wiki/Foreign_function_interface)

~~~
squarefoot
Bummer. Higher level low footprint languages such as Nim and Crystal would
benefit a lot from bindings for this GUI. Probably Lua too, but that's a
different context and Lua already has Tekui and others.

~~~
gurkendoktor
You can still write Crystal wrappers for it, just not using FFI. This looks
like it might be polished enough:
[https://github.com/Papierkorb/bindgen](https://github.com/Papierkorb/bindgen)

The bigger issue is that Crystal really needs first-class Windows support
before people will use it for GUIs...

------
zengid
IDK about y'all but the main page
([https://www.cycfi.com/](https://www.cycfi.com/)) this post is on has a bunch
of interesting audio hardware/software posts. Pretty neat company!

------
srikz
NanoGUI[1] is another GUI framework which uses NanoVG underneath. Interested
to know if the author is familiar with that and what's their take on it.

[1]: [https://github.com/wjakob/nanogui](https://github.com/wjakob/nanogui)

~~~
ktpsns
This reminds me of the look of Blender's GUI, which is also OpenGL based.

~~~
djowel64
Hi I'm Joel, the the author of Photon. Yes, I know NanoGUI. I actually started
with NanoVG. I had problems embedding in a plugin, IIRC. GLFW is not
embeddable, IIRC.

------
hawski
No mention of accessibility makes it not enough for more generic applications.
That's my main pain point. I would love to have a modern alternative to
wxWidgets - something in higher level language than C++. Something that would
use GTK+ on GNOME, Qt on KDE, Cocoa on macOS, Cocoa Touch on iOS, Android APIs
on Android. Android is the trickiest probably, because I would like it to run
without NDK, so compiled down to Android JVM or DEX bytecode. Then it could
fit every environment just right. Could means, that it's a first step, because
those environments have different HIGs etc.

What's interesting is that Lasarus is closest to it, but I would prefer higher
level language. Is there a Tcl interpreter written in Java? Then Tcl/Tk could
be also an option.

Sorry for a bit off-topic rambling, but I would love to see something like it.

~~~
badsectoracula
Out of curiosity, why isn't Free Pascal high level enough?

Also FWIW my LIL scripting language, is sort of Tcl-like and has a Free Pascal
implementation (and also a C one) with a (optional) Lazarus drag-drop
component:
[http://runtimeterror.com/tech/lil/](http://runtimeterror.com/tech/lil/)

I also have a Lazarus component for FPLIL for exposing a Tk-ish (well, not
exactly, but on a similar spirit) API:
[https://i.imgur.com/G8hto0N.gif](https://i.imgur.com/G8hto0N.gif)

Though that last one isn't available anywhere... perhaps i should upload it at
the LIL site above. It is just that it hadn't had much testing (i mainly wrote
it for my 3D world editor so that scripts can expose simple UIs on the sidebar
or in dialog boxes but haven't used it much elsewhere).

EDIT: i decided to take a few minutes and upload the LILGUI stuff to the site
above.

~~~
skybrian
At first glance, LIL does look very similar to Tcl. Do you consider it a
stripped-down Tcl or are there other language features you added?

~~~
badsectoracula
Probably just a stripped down Tcl. Most of the code was written years ago in a
week or two, i've only added minor stuff (like a few new functions), improved
performance a bit and fixed bugs since then. And the Free Pascal
implementation, of course, but that was also done years ago. I've used it in a
bunch of my own projects and i've heard a couple of others using it too.

TBH i do not have much experience with Tcl itself outside of writing a few Tk
utilities to automate a few bits on my job some years ago. I followed its
approach mainly because it sounded like a good combination for being very
simple to implement and very flexible to work with, making it ideal for a
hosted scripting language (though it doesn't fit all tasks - far from it,
especially in places you want even a hint of performance).

So i can't really judge how exactly it differs from Tcl language-wise. It is
not compatible as it provides much fewer functions and those work in a
different manner. For example there isn't uplevel, but there is upeval which
works in a similar manner (though the depth is always one but they can be
nested) and there is also downeval (used through upeval to evaluate code back
at the environment from where upeval was called), topeval (like upeval but at
the toplevel environment), enveval (eval in a function-like environment with
optional variable passing in and out) and jaileval (eval in a new, optionally
clean, LIL context). Also there isn't much in terms of state notification
outside of watch (which i think it works like Tcl's trace but only for
variable writes).

I _think_ the syntax is compatible with Tcl (i haven't done any excessive
testing to be sure though, LIL was done mainly by "eyeballing" Tcl) so it
could be possible to write shims in LIL to be able to write code that works in
both, but TBH i wouldn't rely on that.

So i call it just "Tcl-like" in the same sense that JavaScript is a C-like
language.

------
qwerty456127
Photon was the best I've ever seen. Not the most brilliant desktop environment
UI (clearly modern Win7/Unity/Mac-like panels + Mac/Ubuntu-like keyboard
features are better, let alone tiling WMs but these are only good with big
displays) but the most cozy controls look&feel styling and a great C++Builder-
like visual RAD IDE.

------
stabbles
Awesome, that looks like an attempt to replace QML by native C++. Would be
great if there was a SwiftUI inspired C++ UI framework (well, of course C++
might not lend itself so well for the job, but I'm just very curious what it
would look like if someone makes a real attempt).

------
torgoguys
Name collision--QNX's gui was/is also named "Photon MicroGUI" and that is what
I thought this post was going to be about:
[http://www.qnx.com/developers/docs/6.5.0/index.jsp?topic=%2F...](http://www.qnx.com/developers/docs/6.5.0/index.jsp?topic=%2Fcom.qnx.doc.neutrino_sys_arch%2Fphoton.html)

~~~
asark
Can confirm. Came in expecting the other Photon MicroGUI ("now there's a name
I've not heard in a long time"), was surprised/disappointed. Man QNX+Photon
made for a nice GUI operating environment. Rivaled only by BeOS on my "GUI
environments/systems I wish had made a bigger splash" scale.

~~~
octetta
Totally agree with you. While I've been away from QNX for a long time, I did
enjoy this API and system design. When I saw it go EOL, I made an appeal for
them to open source it. Never heard a peep.

~~~
nineteen999
QNX is EOL? Really? The last release was only in 2017. I hadn't heard this was
happening and I can't seem to find any reference to it.

