CppCast - WxWidgets
Episode Date: January 30, 2020Rob and Jason are joined by Vadim Zeitlin one of the maintainers of WxWidgets. They first talk about a blog post describing a fantastic bug and another responding to the changes announced by Qt. Then ...Vadim tells them about how he got involved contributing to WxWidgets, the cross platform C++ GUI library. News Fantastic Bugs and Where to Find Them C++ Modules conformance improvements with MSVC in VS 2019 16.5 Concepts merged to clang trunk About Qt Offering Changes 2020 Links WxWidgets WxWidgets on GitHub Sponsors Backtrace Software Crash Management for Embedded Devices and IOT Projects Announcing Visual Studio Extension - Integrated Crash Reporting in 5 Minutes
Transcript
Discussion (0)
Episode 232 of CppCast with guest Vad at backtrace.io.cppcast.
In this episode, we talk about fantastic bugs and changes to Qt.
Then we talk to Vadim Zeitlin.
Vadim talks to us about WX Widgets, the first podcast for C++ developers by C++ developers.
I'm your host, Rob Irving.
Joining me, my co-host, Jason Turner.
Jason, how's it going today?
I'm all right, Rob. How are you doing?
Doing good.
Don't really have any news to share myself.
Anything going on with you?
Well, I do have some classes and stuff coming up,
but that'll just be a sneak peek.
We'll talk about that more next week.
Okay, sounds good.
Well, at the top of every episode,
I'd like to read a piece of feedback.
We got this
tweet from uh jan willmans who we've had on the show before and uh he says weird things happening
on spotify and i guess he listens to the podcast on spotify we are there if you are not aware
and uh apparently in addition to all these other bands he listens to, like Rush, where it's recommending, you know, listen to the best of Rush.
It's saying listen to the best of Phil Nash, which is interesting.
Well, it also said that Phil has like 200,000 followers, too.
Yeah.
Yeah.
I don't.
Does Phil have other stuff on Spotify besides being on a couple of our episodes?
I don't know.
No.
I think Phil Nash is a singer, although I'm I don't know. No. I think
Phil Nash is a singer, although
I'm not getting that at the moment.
Not a different Phil Nash.
Convusing our Phil Nash
with a different Phil Nash?
Artist Phil Nash, yes.
Okay. I guess that would explain it.
Okay.
Well, we'd love to hear your thoughts about the show.
You can always reach out to us on Facebook,
Twitter, or email us at feedback at
cpcast.com. And don't forget to leave us a
review on iTunes or subscribe on YouTube.
Joining us today is
Vadim Zitlin. Vadim Adventures
in Programming started with BASIC on an
8-bit microcomputer with a whopping 4
kilobytes of RAM when he was 10 years old
in the mid-80s and continued with Pascal
C at the beginning of the 90s, Discovery of C++ that he has been using since then. What started as a hobby became a job
when after finishing his PhD in mathematics in 2002, he founded the TT Solutions Company,
providing support for open source software, and in particular, WX widgets. Almost 20 years,
one marriage and three children later, Vadim still remains enthusiastic about programming
in general and open source in particular, and tries to contribute to open source projects whenever
possible, even if his primary focus remains on WX widgets.
Vadim, welcome to the show. Thank you for having me here and
great to take place in it.
So I'm curious, you say an 8-bit microcomputer with 4K of RAM,
I'm curious exactly which computer that was.
Nobody has heard about this one because that was one from the Soviet Russia.
Oh, no, that makes it twice as interesting to actually have a small list of Soviet Russian and Polish computers that I've learned about from other guests.
It must not be a very long list because there were just a couple of them.
Some of them, they tend to be clones of Western computers, several of them have.
Undoubtedly they were, but as we didn't know anything about Western computers,
we didn't know about that. It cost an awful amount of money, and I badgered my parents into
buying it even though they couldn't afford it, really. I really needed it.
It was a question of life and death.
I had to have my own.
I thought it was worth the investment, though.
Well, I didn't think about it as an investment back
then, but yes.
Like that.
From a parent's perspective, yeah.
Okay, well, Vadim,
we've got a couple news articles to discuss,
and then we'll start talking more about WX Widgets, okay? Sure. Okay, well, Vadim, we got a couple news articles to discuss, and then we'll start talking more about WX Widgets, okay?
Sure.
Okay, so this first one was a really long article.
It was.
Fantastic bugs and where to find them.
And I'll be honest, I started skimming a little bit towards the end when I started seeing just how long this article was. was, but it was interesting. It talked about just a very, very odd error where
the debugger
was claiming to be
having an access violation
at executing location
zero, like 0, 0, 0 in memory.
And it
wound up being related to this
custom coroutines library
since we don't actually have official
coroutines yet. And the stack't actually have official coroutines yet, and
the stack being corrupted somehow.
Right, Jason? Yeah.
Yes. I've seen
this one. They had trouble with
exception fending, actually, which was
incompatible with their coroutines
implementation.
The advantage of using custom
stuff like custom coroutine libraries is that you
get a chance to discover very interesting bugs yeah this is a little bit of a ride for me because
at first i'm like well min gw has enough random bugs around threading and stuff that and i know
like some people try to defend it but it really does like i have bugs that i just can't support
and so i'm like yeah it's probably just a bug in MinGW.
And then I see that it involves exceptions specifically.
I'm like, I hope they realize that
there's two different exception models for MinGW
and then get to the end. Oh, okay, they just had
to switch to exception. Okay.
It's a little bit of a rollercoaster ride.
Yeah, a little bit.
Okay, this next one is an
update from the Visual Studio C++
blog. C++ blog,
C++ modules conformance improvements with the latest upcoming build,
which is 2019 16.5.
And, yeah, we haven't talked about modules in a while,
but I think Visual Studio is one of the first compilers to have module support,
and they are continuing to update it.
The new things they're adding are header units,
which I don't believe we've talked about before, Jason, right?
I don't know.
We've covered so many articles on modules.
Honestly, I don't know if header units came up.
Yeah.
Well, the new things are, though, header units,
context-sensitive module and import keywords,
global module fragments, and module partitions.
So a lot of changes coming in.
We really should maybe do a deeper dive in modules, especially when it's official in C++20 and released.
Yeah, they have Gabby back on or something.
Yeah.
Okay, next thing we have is a follow-up from our talk with Sar Raz from a few weeks ago.
And this is him announcing that Concepts was officially merged into Clang Trunk.
Eight days ago.
Yeah.
So do we know which version it'll be available in?
Is it Clang 10 or Clang 11?
Do we know that yet?
It is 10.
It is 10.
Yeah, it got ported to 10, yeah.
Okay, and then last thing we have to talk about, and I'm sure our guests will have some comments on this one, Yeah, it got ported, so yeah. developer who has been using it for over 20 years, and it's kind of their response to what the Qt Foundation or company is doing.
To summarize, it looks like they're trying to put some restrictions
on the open source version of Qt.
Is that a good way to describe it?
Like you now are going to need to have an account in order to log on
and download the libraries before you didn't have to.
Right. And binaries are only available to paying customers.
Right. So if you want to use open source Qt, you're going to have to have an account and then download the source yourself and build it yourself.
Yes. Or use Conan.
That's true. That's a good point. It's quite bad, but it's not my place and Qt, but actually they do allow to download binaries. You just have to use their website.
I mean, I don't usually follow the development of Qt exactly closely, but I couldn't escape this thought because it was everywhere in all the places, in all the communities related to public switches recently. So I saw it and basically I really don't think
it's the end of the world. I don't think it's going to change that much in practice, but it does
show that Qt is a company, you know, they have to do their stuff and they have to monetize their
users in some way. There is one thing that surprised me is that it took so long.
You're surprised they didn't make this type of change years ago?
Well, I could be wrong,
but I don't think it's going to be the last change in Qt licensing and marketing, whatever model.
Yeah, so the article that we are linking to, Rob,
does seem to overstate that.
The official Qt article just says
you have to have an account to download binaries.
It does not say you have to have a commercial account,
which is what the article you're linking to says.
Okay, so they might have it wrong.
But some of these things like LTS binaries are only available...
Oh, and offline installers are available commercial online.
Yeah, they basically want all open source users
to use their latest version.
And I understand why.
We as W3D developers, we want
to do the same thing, of course. We want all
our users to use the
latest version to find the bugs as quickly as
possible. The only thing is that we
don't force people to do it because, well,
we can't.
But if they can,
I understand why we want to.
And to your point that Qt has to monetize their users somehow
and you expect more changes to come in the future.
It's been a long ride.
Like, I remember when KDE first came out
and people are like, well, I'm not going to support that
because Qt is partially closed source or whatever.
Like, way back in the day on Linux.
It was closed source. It wasn't always Qt. It came so much later. Yeah, well, you know,
in the beginning, WXVidgets and Qt were really competitors. And this hasn't been really the
case since many more years because Qt has just become dominant. It's one of the main
WXVidgets, of course, I'm not at all blind to that.
But the thing is that
when I saw pictures from QT 3.0
I believe released,
I was pretty impressed
because there were like
several hundred people
working on QT.
And compared with W2G's
there are maybe a dozen of people
working on it more or less
frequently enough.
And only just half of really important core contributors. So you know, all this amount of people working on it more or less frequently enough. And only just half of really important core contributions.
So you know, all this amount of people, you have to fund it somehow.
So again, I am sure that the world just can't have the same business model, if you can call
it that, as W3D does when we just give away everything that we have without any compensation,
whether it's monetary or account creation
and ad serving or whatever,
they are going to use these accounts for.
We can allow that because, well, we don't need any money.
We don't have any costs.
We just do it in our own free time.
And they have to find money somewhere.
Right, right.
Okay, well, since you just started talking
a little bit about WXWidgets,
why don't you, I guess, first tell us a little bit
more about what WXWidgets is
in case our listeners aren't too familiar with the library.
Yeah, so WXWidgets
teaches that it's
write once, compile
anywhere framework.
So this allows you to write
your C++ code for once and then
compile it on all the supported platforms and have it run as a native
desktop application on different platforms. Currently the main platforms are
Windows, it's always Linux and different desktop environments, and MacOS. So there
is some limited support for mobile platforms, but the focus has always been on the desktop.
And the main difference between WSWidgets and almost all the other graphical frameworks for C++ or even other languages is that WSWidgets tends to be native.
That is, we always use native widgets and we always try to integrate into the native desktop
as much as possible. So we don't do our own stuff. We try to provide the common API on top of the
native API of the various platforms, which hides the difference between them, while still allowing
you to access them. It's true. And provides common, high-level, much higher-level API that maps to the different APIs from the developer.
And that's actually the fun part of developing.
You have to sometimes get quite creative
to marry different APIs from different platforms
that do things sometimes in a very different way.
It can be interesting. It can be challenging.
And when you manage to do it nicely,
it can be also very easy.
So how much does that limit you?
Like, you want to add a new feature, but
then say, oh, oops, it's like, you know,
difficult to impossible to add this
on Mac OS,
but easy on Windows, so we have to
leave the feature out for an hour or something like
that. This is a concern.
So our typical rule of thumb is that if we can implement the feature on more than or something like that? This is a concern. So our typical rule of thumb
is that if we can implement the feature
on more than one platform, we're going to do it.
So we're not going to implement the features
which are only available on just a single.
Basically, all people who use W3D
don't necessarily use the same platforms
on all four sides, or many there could be.
Some people only use one platform.
It's true, but it's related in a minority.
But people quite often use it only on a couple of platforms.
So we believe that if we can provide a feature on more than one,
on strictly more than one platform, it's worth doing that.
Although there are some features that we just can't provide at all.
For example, if you compare that with widgets with Electron,
all this web-based stuff which supports theming and arbitrary customizations of
colors and whatever. Something that is not supported on the traditional desktop. So this, for example,
this is something that we can't do at all. So we don't. So yeah, this approach definitely has its own
limitations. But as a user, I really appreciate programs that use WXWidgets, and I think it's
much nicer to have something that fits into your desktop and doesn't stand out like a software.
I think it's worth pointing out that Rob and I always use Audacity for recording audio here,
and if I understand correctly, that is a WXWidgets project as well. You can use WXWidgets, yes.
I've never participated in the development of the project,
but I have been constantly with developers
to resolve some of the issues.
And by the way, if you're listening to this podcast,
I've always welcomed people working on WXWidgets applications
to contact us and ask us if they have any problems with WXWidgets.
Because WXWidgets on its own is not very useful.
It's the applications that are really the things that we are working for.
I want to interrupt the discussion for just a moment
to bring you a word from our sponsors.
Backtrace is the only cross-platform crash and exception reporting solution
that automates all the manual work needed to capture,
symbolicate, dedupe, classify, prioritize,
and investigate
crashes in one interface.
Backtrace customers reduced engineering team time spent on figuring out what crashed, why,
and whether it even matters by half or more.
At the time of error, Backtrace jumps into action, capturing detailed dumps of app environmental
state.
It then analyzes process memory and executable code to classify errors and highlight important
signals such as heap corruption, malware, and much more.
Whether you work on Linux, Windows, mobile, or gaming platforms,
Backtrace can take pain out of crash handling.
Check out their new Visual Studio extension for C++ developers.
Companies like Fastly, Amazon, and Comcast use Backtrace to improve software stability.
It's free to try, minutes to set up, with no commitment necessary.
Check them out at backtrace.io slash cppcast.
So you're talking about some APIs that are very difficult to implement. You might only
put them on the platforms you can support them on. How, as a developer, do you know this API
only works on Windows and Linux, but not on Mac?
And is there a way to query that or to write your code in such a way?
Like, do you wind up having to if-def it for platforms, things like that?
That's slightly complicated because it depends.
It actually depends on the size of the feature.
If it's a huge feature and you can't really provide any reasonable fallback, we disable it at compile time.
Okay.
So we just, some compile time. So we just
some compile time symbol which tells you if the feature is available or not. Sometimes when it's
just part of a bigger class and just some part of its functionality can't be implemented,
it's just a function that is tapped out to always return false. For example, say that it didn't do
anything. And again, it's a judgment that we have to make on case-by-case basis and it's not always
obvious. I hope that we get it right more case-by-case basis, and it's not always obvious.
I hope that we get it right more often than not,
but we probably make some mistakes about this.
But that's the interesting part of the work.
So you have to make your judgments in each case.
Right.
So do you want to go over the full list of platforms that are available?
I think you just said Windows, Linux, Mac.
Are there any other ones worth noting?
Those are the three major ones.
We actually have, well, there was, again,
W3D development is not really guided by anybody,
so people just do things that they want to do.
And so there was a company which contributed significant development time
on improving WXQT 4.
So it's a kind of double interaction, you know.
So it's WXQT API implemented on top of Qt.
And this project exists since several years.
It was a Google Summer of Code project in New York.
But as quite often with Google Summer of Code projects,
it wasn't really finished during the summer. And so it wasn't really usable. But since last year,
I think it is. And so for people who really want, for example, to transition from W3 to W3,
or maybe from W3 to W3, that may be an interesting port to use. Then there are some legacy ports like
Motif port, because apparently there are still legacy ports like MotifPort, because apparently
there are still some people using Motif.
Wow, oh, okay.
So these two, and there are some experimental ports which we used for some particular applications
like Direct Frame Buffer, VFX, VFB, but again, it's in a very, very basic state, so it was
written for a particular application, so, all the features needed by this application were implemented.
So things like that.
We used to have more ports.
We used to have plenty of other ports.
We used to have DOS port.
We used to have OS2 port.
But we have finally got rid of those a few years ago.
And there is also WX-Control-4,
which is pretty basic and which, I don't know,
can actually be used
for right-maining
non-toy applications.
And there is iOS-Port,
which is slightly more useful
because there are applications
in Disney on Apple Store.
Well, not many,
but I know at least a couple.
So it's also rather basic,
but it does work and it does support. it's also rather basic, but it does
work and it does support. It's useful
enough to allow you to use
quite large amounts of code between your desktop
and mobile versions. That's pretty
cool. Yeah. So that's about it.
How much effort is
involved in
bringing a new platform into the
WX widgets family? Like if
some new desktop operating system comes out,
like how many APIs do you need to go and write
to make WX widgets work on that platform?
It's not that difficult to have something very basic.
Okay.
You have to create a window.
But to implement the full WX widgets API for a platform,
it's a lot of work.
The API is huge.
I haven't counted the number of classes and functions in it since quite some time.
That's nothing.
So there are some things that are due to it on the low level,
but on the benefit of that,
there are also some things that you don't have to write for every platform.
But even the low-level parts, there are still quite a lot of things there.
So yeah, I don't want to discourage people, but it's not that easy to write for each of them.
Not really, not to try, of course. But we haven't had any new ports since quite a long time. For
example, I think that we'd like to have a port to Windows Runtime. We used to be called Metro and it is now called Windows Runtime, but it requires, I think,
at least several person-market work to get to some usable stage, and so far nobody has had time to do
it. Because again, that was rigid. No school opens those projects, so nobody's paid to work on this,
so you have time to do something you do, but it's difficult to have
six months of your time to spend on
WX.
I have
started working on WX Widgets when I was a student.
So basically only students have so many.
And we are not.
None of us are students anymore,
unfortunately.
Do you want to tell us a little bit more about how you first got involved
in WX Widgets?
Yeah, it was actually pretty simple.
I just wanted to write a program.
I had a modem, which used some proprietary crack software that was required to work with this.
And I was using Linux, of course, and for the proprietary software was Windows only.
And so I wanted to write a program to work with this modem, which would work on Linux.
But as long as it worked on Linux, I wanted it to work on Linux too.
So I started looking for some library that would allow me to do that.
Qt back then was closed source and pretty expensive.
Much too expensive for a student back then.
So it wasn't really an option. There were a couple of other options which I explored.
But finally I chose WPGITS because, and it wasn't really an option. There were a couple of other options which I explored, but finally I chose W3GITS because of its excellent documentation. Excellent compared to
other open source projects. So I really appreciate that it had documentation because that was
a rarity back then. I don't think it changed that much since then. So I started working with
W3GITS and of course I quickly found that a lot of things could be
improved. And so I started
submitting patches, sending them to the
mailing list, because we didn't have
Git back then.
And somehow I got
pulled in, and finally I have never
written an application for this modem.
But I did improve public switches.
That was back in 1996
or thereabouts.
Oh, wow.
Are there any particular areas of WXWidgets that you've made a significant amount of contributions?
Or have you kind of worked all over the whole library?
Well, I guess I'm officially considered, as much as there is an official,
not an official in WXWidgets, but I am semi-officially maintainer of the Windows core and basically everything
that is low-level OS specific, but not necessarily new specific stuff.
So basically there are other developers who maintain Mac and GTK ports and I try to take care of most of their things.
But to be honest, I spend much less time on the Blitzkrieg nowadays because there are
just too many other things to do.
And there are other people who still...
We get used to these things all the time, so that's great.
I don't know where they come from, but people just
view and start making good prices and continue making good prices.
It's very easy to conclude that.
I think that we really try to do our best to
barrier the answer as much as possible. We do have our standards.
So basically, you submit a new feature,
you have to submit documentation,
for instance.
And if you can submit some tests,
that's very much appreciated.
But basically,
if you make a good patch,
you can be pretty sure
that it's going to be accepted.
I think it may be different
from other more corporate-backed
open-source projects.
So we really try to keep the spirit of pioneersed open-source projects. We really try to
keep the spirit of pioneers
of open-source.
Along those lines of
development and accepting contributions from other people,
is WXWidgets
evolving as C++
evolves?
What version of C++ do I need?
What compiler do I need to compile with right now?
It evolves but it evolves flash-to-listen. Like, what version of C++ do I need? What compiler do I need to compile with it right now? Evolve, C++, because again, it turns out that not so many people are really motivated
in just writing the code for the writer's name.
So W3 just still uses compiles using C++98.
Okay.
All files in C++, C++11, 14++14, C++17, I could regularly fix warnings or errors, errors are rare, warnings are frequent, if they arise during the compilation of the library.
But the focus is not really on making the library itself use more than C++. The focus is making the applications using more than C++ work well with the library. And so since many years, for example,
we support using Lambda as an event handler in the library. So this doesn't actually require using
any C++ 11 inside the library itself, but we do allow to do this if your application is C++ 11.
And using Lambda as an event handler is really the light thing. So for me, C++11 really changed a lot of things.
And it was really great to use.
Also for some historical reasons that nobody cares about any longer,
but back when WSWidgets was found in 1992,
C++ was really C with classes and not C with two faves.
And you couldn't really count on having standard library implementation.
Many of the platforms that were supported by WSWidgets. So historically, WSWidgets used its own string,
container classes, well, you know, all that stuff. And this hasn't fully changed yet,
even though since 20 years you can compile WSWidgets using standard library classes instead,
if you want. But the thing that matters is that you can use standard library classes in your
application.
WSWidgets does its best to transparently interoperate with them.
So you can pass std string to WSWidgets even if internally it uses its own WX string.
And you can fill some combo box with the elements of std vector even if internally it serves in some bespoke WX. So again, when people look at the WX3 distortion,
they may sometimes be horrified
by all this amount of slush.
But actually, it's not that bad.
And yes, we probably will get rid of them one of these days.
But actually, what counts is that your application
can use the latest C++ features,
and my own applications do so.
Again, I'm motivated creative than this because I use
it myself. And so your
application can use normal
C++ and later C++ features,
and it works well with WXWidgets.
So our focus is on that.
Okay. Makes sense.
Definitely makes sense.
Do you have anything on the roadmap for WXWidgets?
How often do you release
new versions, and is there anything you're
planning in the future to add
to it?
That's a thing for me.
WXWidgets is notorious for
releases.
Well, I guess I should maybe
say that I'm notorious for things, because I'm
making the releases,
and I'm a perfectionist,
so I hate
leaving things not working badly in the release. I try to do this one basically
business that can be no releases for years and years, which is not ideal
either. So right now the focus is on 3.2 release, and the main
feature is finishing high DPI display support,
which is already not too bad in Geek Master,
but there are still things remaining to do.
And we basically just need to finish and make this release.
That's right now.
We hope to make it this year.
To be completely honest, we hope to make it last year as well.
Okay.
But this year is for real.
Okay. Jason, do you have any other questions?
No, I don't think so.
Okay.
Vadim, is there anything else you wanted to go over before we let you go?
No, it was nice
talking to you guys, and
thanks for inviting me
once again, and your podcast and and
going to resume my work from wx which is 3.2 released thanks for coming on i guess one more
question i have sorry i know we just did that but i guess one more question would be um if you're
just getting started in wx widgets you want to make a new GUI application, what's that process look like?
Basically, I'm a believer in example-based
learning. So what I would do
is just take our
Hello World example and basically
compile it, change it, build it
successfully, and then just start hacking on it
and modifying it to add the things that you need.
So
WX widgets a decent documentation,
but what is great about it is that it has almost hundreds of examples. So, in the samples directory,
there are a lot of examples that, and basically, if you want to know how to use some particular
API element, be it a class or a function, you just can grab the samples sub directory and find an example showing how to use it.
And so this is how I operate. And I was surprised that not all people are trying to do it like this,
but I've tried to go from examples again, and I think that W2D is great if you work like this.
If not, well, there is documentation which is not always perfect perfect. There are all the usual community support channels
like forums,
IRC, mailing lists,
Stack Overflow. There are quite a few
WX widgets, so if you type your
question, ask Stack Overflow
WX widgets, chances are I will see
them. I'll try
to answer the questions there.
Awesome. Okay, sounds good.
Thanks, Vadim. Thanks again.
Thank you.
Bye.
Bye.
Thanks so much for listening in as we chat about C++.
We'd love to hear what you think of the podcast.
Please let us know if we're discussing the stuff you're interested in,
or if you have a suggestion for a topic, we'd love to hear about that too.
You can email all your thoughts to feedback at cppcast.com.
We'd also appreciate if you can like CppCast on Facebook and follow CppCast on Twitter.
You can also follow me at Rob W. Irving and Jason at Lefticus on Twitter.
We'd also like to thank all our patrons who help support the show through Patreon.
If you'd like to support us on Patreon, you can do so at patreon.com slash cppcast.
And of course, you can find all that info and the show notes on the podcast website at cppcast.com.
Theme music for this episode is provided by podcastthemes.com.