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

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.

The overall sentiment is that C++ is good enough and that you are lazy if you don’t want to use it. Because of that, fewer and fewer people will care about writing native code.

The overall sentiment is that C++ is good enough and that you are lazy if you don’t want to use it. Because of that, fewer and fewer people will care about writing native code.

There are posts on this board where members of the core dev team give indication on how to potentially do python/C/other bindings (using swig for example), so you may be jumping a bit quickly to conclusions.

Moreover assuming said developers consider everybody not familiar with C++ as lazy looks like a gratuitous attack. Do you have proof to back-up this bold claim?

Lastly, the numbers of Haiku contributors to the Haiku code base is increasing, that code base is mostly C++ code. So no worries,more and more people are caring.

While I do not agree with the wording, I do agree that a sort of C binding library would be nice, allowing even more developers to create native apps.

2 Likes

With any language chosen, there will always be people who do not know it, or prefer others. That doesn´t mean the language is bad, just that some people prefer another one. If one tries to accomodate too many individual preferences, the result is one of those "designed by comittee " situations …

4 Likes

That’s your own interpretation.

My personal sentiment is that C++ is good enough for me and I already have a hard time keeping my own apps working. So I don’t plan to work on bindings to some other language to help other people. Not because I think they are lazy, but because I have no time and motivation to maintain it.

If someone thinks this is really important, maybe they can write the bindings? We will gladly accept them. In fact, we have selected a port of C# as one of the mentored projects in this year Google Summer of Code, and I sure hope we will see at least some experiments in GUI binding over the summer. Why C#? Because someone thought it was an interesting language to use. Now they’re getting paid by Google to do it. That doesn’t seem lazy at all to me…

6 Likes

No. It´s just the reality that the native Haiku API currently is accessible from C++ and YAB. (and Python2 on 32bit systems IIRC). Anybody who wants to use other languages can either develop the bindings themselves or wait until somebody else does it. Quite simple, really :wink: I mean the situation, not the development of the bindings.

2 Likes