[dev] An update about my gtk2 fork

From: stefan11111 <stefan11111_AT_shitposting.expert>
Date: Mon, 22 Jul 2024 15:44:36 +0000

Hi suckless enjoyers. Beware, this is quite a long mail.
I have come with an update 6 months after this thread:
https://lists.suckless.org/dev/2401/35517.html

To those who can't open that link in their mailer, it's the thread where
I
presented my fork of gtk2:
https://github.com/stefan11111/gtk2

After 6 months, I made quite a bit of progress with it.
Since it's been quite some time, I might forget to mention everything
important I
improved/fixed. If someone's interested, everything is in the git
history.

Since I first wrote here about this, quite a few things have changed:
A few bugfixes.
Cleaning up the code with a linter.
Made compiling print backends optional.
Fixing all warnings when building with gcc14 with -flto and with cups
support disabled.
Adding 64-bit time support(needs kernel 64-bit time_t).
Also removed all the code for Windows and apple since I can't test on
those platforms
and I don't plan to support those. Doing this made the code considerably
easier to maintain.

I mentioned -flto above, because without lto, gcc doesn't see that doing
init_func(&var);
initializes the var variable in some cases.
Also, I left 2 deprecation warnings in, because they aren't really
warnings but bugs in glib.
they provide a file which contains something like this:
struct foo{
...
deprecated_pointer *bar; /* backwards compatibility */
...
}
And this isn't really me using deprecated functionality, but upstream's
implementation being buggy.

I didn't fix the cups code because I don't have a way of testing it.

I'll emphasize a bit more the "no warnings" part.
There were literal hundreds of warnings I had to fix, and even void*
arithmetic mixed in between.

Also, as an example of glib suck, glib makes heavy use of storing
function pointers in void*'s,
making it unportable.

I also cleaned up and tested the DirectFB backend of gtk and I tried my
best to preserve it.
I know someone was interested in this backed 6 months ago when I send
the first mail about this.
However, gtk2 on directfb is very different from gtk2 on X.
A lot of functions aren't implemented for directfb, and some can't be
implemented on directfb.
Notably, the gdkx.h header is missing entirely for obvious reasons.

I will try to keep supporting the directfb backend, especially given
that directfb is actively developed:
https://github.com/directfb2/DirectFB2

I decided that all this warrants finally making a release:
https://github.com/stefan11111/gtk2/releases/download/gtk%2B-2.24.34/gtk+-2.24.34.tar.gz

And for those of you running gentoo or another distro that uses portage
as it's package manager,
I have a gentoo overlay with all these and plenty of other stuff I found
interesting/useful:
https://github.com/stefan11111/stefan_overlay

Also, I have tried to write a compatibility library to translate gtk3
calls to gtk2 calls,
to give gtk3 apps the gtk2 look:
https://github.com/stefan11111/gtk3-to-gtk2/

I've had limited success with this.
So far, I've managed to build and run 2 gtk3 apps with this, l3afpad and
something else, I forgot what.
I have also tried to build the gtk3 version of codeblocks with this,
which is a wxGTK app.
I could build it, but it segfaults before even spawning a window.
if know of other gtk3 apps I should test this with, let me know.

I also wrote this, but didn't invest much time in it:
https://github.com/stefan11111/gtk2-makefile
It's not ready to be used, but it's meant to be a couple of Makefiles
and a C configure parser to replace
the shell script generated by autoconf.
I abandoned the idea pretty quick since even if I succeeded in making it
work, the end result would
likely be worse that what autotools already does, and I didn't want to
make a worse end product just
because of my preference for simpler tools.
I linked to this mostly so it could serve as inspiration for someone
else and see what other
people think of this.

And with this, the mail is finally over. Thanks for taking the time for
reading it.
I would like to read your thoughts on this.
After these 6 months, I feel like I learned a bit more about C and glib,
which is always a good thing.

Have a nice day and happy hacking and creating suckless software.
-- 
Linux-gentoo-x86_64-Intel-R-_Core-TM-_i5-7400_CPU__AT__3.00GHz
COMMON_FLAGS="-O3 -pipe -march=native -fno-stack-protector 
-ftree-vectorize -ffast-math -funswitch-loops -fuse-linker-plugin -flto 
-fdevirtualize-at-ltrans -fno-plt -fno-semantic-interposition 
-falign-functions=64 -fgraphite-identity -floop-nest-optimize"
USE="-* git verify-sig rsync-verify man alsa X grub ssl ipv6 lto 
libressl olde-gentoo asm native-symlinks threads jit jumbo-build minimal 
strip system-man"
INSTALL_MASK="/etc/systemd /lib/systemd /usr/lib/systemd 
/usr/lib/modules-load.d /usr/lib/tmpfiles.d *tmpfiles* /var/lib/dbus 
/lib/udev /usr/share/icons /usr/share/applications 
/usr/share/gtk-3.0/emoji"
Received on Mon Jul 22 2024 - 17:44:36 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 22 2024 - 17:48:09 CEST