Which portable GUI and graphic library are supported to develop on Haiku (C library if possible)

Hi,

Can you give me a list of Libraries Gui ** Portables ** Gui that work on the Haiku system if possible in C language?
I thought that QT and KDE are there, but I am looking for something as light as possible and portable.
I thought about something similar to IUP library, see here: https://www.tecgraf.puc-rio.br/iup/

For graphic libraries, I know SDL and Allegro are supported by Haiku and if I remind well, SDL have a better support than Allegro on Haiku.

Thanks for reply.

Take a look here:

IUP is there, gtk, fltk…

I don’t know how well supported/mature they all are.

You can also search in haiku depot for which libraries are available to install.

2 Likes

I wrote the IUP port a few years ago, it is mostly working but not complete and now very out of date. There were several crashes and I think I did not complete all the widgets. And then I spent time on other projects and didn’t manage to get back to this one…

2 Likes

Okay, I don’t find the library in HaikuDepot about IUP development and based on what you said I choose to not work with IUP. But I find GTK3 library in Haiku Depot and it work in C as I can see. So that’s seem a good alternative. I think IUP is based on GTK on Linux also and on Windows it use the native API and seem more simple to learn and lightweight, that’s why it interested me.

Graphics:

  • No. They use OpenGL. They are more likely to a framework (i.e. construction kit using OpenGL as a graphic library component).

GUI:

  • FLTK, Dear ImGUI, WxWidgets, Tk (Tcl/Tk), CEGUI (heavier)…

Are you guys sure about fltk?
pkgman search fltk
gives me nothing…
(the recipe is into haikuports, though)

Yes, IUP uses the native widgets on all platforms and the Haiku version also did. I will get back to it… someday… but I have so much things to do, it could take a few years before I do :frowning:

2 Likes

If I understand your answer these graphics libraries use OpenGL for rendering in Haiku? Or I make a mess. But Allegro in Haiku Depot is in version 4 and Allegro 4 as I know don’t integrate OpenGL functions. So do you mean that the rendering in Haiku passing throught OpenGL (or mesa) for SDL 1,2 and Allegro 4? Thanks for your reply.

I don’t see fltk too, I find WxWidgets, tk and CEGUI in haiku depot…I specialy search a GUI for C language if possible.

  • Look at GTK (GTK3).

FLTK support was disabled (sorry). I was trying to lean away from GNOME/KDE GUIs - but GTK is widely supported and portable between Haiku and BSD/Linux/others.

  • Allegro4 - mostly 2D setup (older versions)
  • Allegro 4.4.3 - OpenGL (i.e. Mesa (i.e. Haiku GL (HGL/EGL))
  • Allegro5 - OpenGL (i.e. Mesa (i.e. Haiku GL (HGL/EGL))
1 Like

Recipe is disabled but you could build it yourself with haikuporter if your up to it, tried it a few times, but had not much luck working with it on other builds.

1 Like

I have trying wxWidget apparently the port on Haiku are wxgtk_devel or wxqt_devel, i don’t find an issue to create an app with theses libraries. :melting_face:

I have also find it today in Haiku Depot Xlibe: a Xlib implementation for Haiku that use the Haiku API
(if I understand correctly).
See a post here about it:

I have try it and I can code in C with it, it’s interesting, and seem more simple to use/understand than gtk and maybe more lightweight.

1 Like

Every project that I’ve come across that uses wxWidgets has quickly ended up wanting to switch away from wxWidgets.

1 Like

Thanks, I think 1.3 makes sense due to the large application base already there, even though for the time being, I feel it exciting going with branch 1.4.x (or trying to).

Of course it is lighter than GTK, but be aware that xlibe was created as a wrapper layer around haiku, not as a graphic server itself, as wine needs X and xlibe pretends to be X above haiku, so today we can run wine. But I don’t think xlibe was born with the aim to provide full X features: in this case you may end up needing some features it doesn’t provide (while real Xorg does).

Edit: see List of platform-independent GUI libraries - Wikipedia
the first table is for C and C++

1 Like

I built FLTK 1.3~git-4 on hrev56976 x64. There are docs (i.e. in html/PDF) as well.

I have try to quit a software propely with Xlibe but don’t find the way.

Here is the source of the X11 program:

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <X11/Xlib.h>



void expose (Display *display,Window win,GC gc)
{
    XDrawString (display, win, gc, 10, 30, "Hello, world !", 20);
}

int main()
{
	Display	*display;
	Window	win;
	GC	gc;
	int	running=1;
	
    display = XOpenDisplay (NULL);
    win = XCreateSimpleWindow (display, RootWindow( display, 0 ),
    					0, 0,
    					120, 90,
    					1, BlackPixel(display,0), WhitePixel(display,0));

    gc = XCreateGC( display, win, 0, 0 );
	Atom wmDeleteMessage = XInternAtom(display, "WM_DELETE_WINDOW", False);
    XSelectInput (display, win, ExposureMask);

    XStoreName (display, win, "xsimple");
    XMapWindow (display, win);

    while (running) {
		XEvent ev;
		char c;

		XNextEvent (display, &ev);

		switch (ev.type) {
			case Expose:
	    		expose (display,win,gc);
	    		break;
	    		
	    	case ClientMessage:
           		 if (ev.xclient.data.l[0] == wmDeleteMessage){
            		XDestroyWindow(display,win);
            		printf("Hello");
                	running = 0;
           		 }
            	break;
	    		
	    	default :
				break;

		}
    }
    XCloseDisplay(display);
    return 0;
}

Also I returned to GTK+, that work but I signal this message I have in terminal when I launch a GTK app:

 GLib-GIO-WARNING **: 15:57:03.018: Failed to create file monitor for /boot/home/config/settings/glib-2.0/settings/keyfile: Impossible de trouver le type de moniteur de fichier local par défaut

“Not possible to find the kind of local file monitor by default”

1 Like

Your example is pretty close to working, but you didn’t set the WM_PROTOCOLS on the window, so you will never get the client message you are looking for. The missing line you need is:

    XSetWMProtocols (display, win, &wmDeleteMessage, 1);

After that it works, I get Hello printed to the terminal and the application exits cleanly.

But I don’t recommend using Xlibe directly, it’s meant for porting Linux applications. Best to use some other toolkit. I recommend Qt, not GTK, for cross-platform development, but I just spent some time today getting FLTK to work with Xlibe, so that should appear in the depots before too long.

7 Likes

Thank you! that work perfectly now :slight_smile:

> hello

was just for testing the switch case ^^. For now I try to learn GTK+ and it’s a good news about FLTK.

What about an offcial graphic library for Haiku. It’s exists?

Haiku’s GUI library is in C++, not C.