Boksi is a C89 cross platform library for putting a message box on the screen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dirkson c461f355ff Upped to partial -w standard 1 month ago
include Refocused on xcb instead of xlib 6 months ago
meson Updated to new osmia build 1 month ago
src Upped to partial -w standard 1 month ago
.gitignore Updated to new osmia build 1 month ago
.lvimrc Various minor improvements generated while working on liblob 6 months ago
LICENSE Initial commit 2 years ago
README.md Refocused on xcb instead of xlib 6 months ago
build Updating osmia 1 month ago
meson.build Upped to partial -w standard 1 month ago

README.md

boksi

Hi. My name is boksi. I am a C89 cross platform library for putting a message box on the screen.

What is it?

  • C89
  • MIT licensed
  • Cross-Platform - Windows/OSX/Linux/BSD/POSIX

What is it not?

  • It’s not a logging/error reporting library, although it could be implemented as part of one. (See: ‘lob’)
  • It does not provide anything but basic message boxes. (See: ‘tinyfiledialogs’)

Why?

On Windows and OSX, native guis exist that boksi takes advantage of to put a message box on the screen. On other posix operating systems, however, life is more difficult - We don’t know if we’ll have access to X11, Wayland, GTK, QT, etc. etc. Therefore, on operating systems like bsd and linux, boksi uses libdynload to attempt to find a usable library.

Boksi, by default, will exhaustively try every method it’s been compiled with. It will create a message box if one is at all possible.

Putting a message box on-screen can be extremely useful when attempting to communicate some clearly-understood error message to a non-highly-technical user. For example, a game that fails to get a valid rendering context due to lack of a graphics card can pop up an error message explaining this to the user.

Example

#include <boksi.h>

int main()
{
	return boksi(BOKSI_INFO, "Here's a fun message to display");
}

For more complex usage, see src/example/complex.c

Dependencies

To build, you will need the following dependencies:

  • Meson
  • Ninja or Samu
  • Clang or GCC
  • ldconfig
  • git

Optionally, you may want some of the following dev packages:

  • gtk2/3
  • libui
  • ncurses
  • X11
  • glfw
  • sdl
  • xcb

“Dynload” is also required to build, but it is automatically grabbed by the build script and statically compiled in.

Building

By default, boksi will output as a .a file. It’s recommended to use this to statically link against boksi for simplicity. Boksi’s permissive MIT license should allow that with basically any software.

To build:

./build -r libboksi.a

The output file will be in lib/libboksi.a

To build the examples, just leave off the ‘libboksi.a’.

You may want to cross compile for Windows or OSX. Windows cross compilation assumes ‘MXE’, OSX assumes ‘osxcross’.

./build -w libboksi.a
./build -w64 libboksi.a
./build -o libboksi.a

Meson can also generate a .so if you really need one.

Supported methods

  • Windows “MessageBox”
  • GTK3
  • Libui
  • GTK2
  • Xaw/xt
  • Ncurses
  • Stdout/err

TODO

  • Add XCB
  • Add actual support for OSX.
  • Add support for Wayland
  • Add glfw/nuklear
  • Add sdl/nuklear
  • Add gdi/nuklear
  • Add x11/nuklear
  • Add Zenity
  • Add kdialog
  • Add linux’s “dialog”
  • Add Applescript
  • It may be useful and within-scope to add yes/no or other question dialogs
  • Expand to C++
    • FLTK
    • WxWidget
    • Qt

Other options

  • TinyFileDialogs ( https://github.com/native-toolkit/tinyfiledialogs )
    • TinyFileDialogs is useful if you need something slightly more advanced than basic message boxes.
    • It has roughly 10x the lines of code of boksi.
    • It lacks any dynload mechanism, relying exlusively on command line tools like ‘zenity’ and ‘dialog’ on linux, and being unable to use gtk2/3, X11, etc. Your linux might not have command line dialog tools. It probably does though.
  • Libui ( https://github.com/andlabs/libui )
    • This is a fully featured UI library for cross platform use.
    • It can do much, much more than create a message box.
    • In the future, it may not be as reliable on linux for creating a message box.
    • Boksi actually uses libui as one potential method to create a message box.