Skip to content

A library providing an object oriented C++ API wrapper for parts of the X11 API

License

Notifications You must be signed in to change notification settings

gerstner-hub/libxpp

Repository files navigation

Introduction

This is libxpp, a library providing an object oriented C++ API wrapper for parts of the X11 API. It is intended for low level programming against the X server on Linux systems.

Design Goals

This library aims to provide a thin object oriented wrapper on top of libX11 and some other parts of the X11 client libraries. The library is implemented using modern C++ features similar to the style found in libcosmos, which is also a dependency of libxpp.

Scope

The scope of libxpp is currently not well defined. This stems from the fact that it has only been expanded so far as to enable a few specific applications and was extracted from xwmfs to make this code reusable. I don't plan to cover all of libX11 just for the fun of it. If you need a few extra features to make libxpp useful for you, I'm open for pull requests or feature requests for expanding the feature set.

Key Features

The library currently supports a variety of different API areas, the most notable being:

  • Handling of window properties.
  • Type safe property handling using templates.
  • Creation of windows.
  • Window event handling.
  • Clipboard/selection handling.
  • To some extent input device handling, primitive graphic operations and colors.

Installing the Library

The SCons based build system only supports a simple installation routine that is invoked by building the install target. The instroot setting allows to specify a custom installation directory. By default files are installed in an install sub directory.

libxpp depends on libcosmos, which is integrated using a git submodule. Git submodules can be a bit non-intuitive for people not experienced with them. For building and installing it is important to clone all submodules together with libxpp, like this:

git clone --recurse-submodules https://github.com/gerstner-hub/libXpp.git

If you already cloned the repository without the submodule(s) then you can get them to the correct state this way:

git submodule update --init

Hints for Library Users

Regarding building against libxpp, the buildsystem features and ABI stability refer to libcosmos's README. It's the same for libxpp.

I guess it is no secret that the libX11 API is not that much fun to work with. Its documentation is somewhat lacking. The error handling model is special since there is synchronous and asynchronous error reporting, based on the X protocol. Many synchronous error returns in libX11 are actually constant and never report an error. libxpp cannot really improve these shortcomings.

What libxpp does add is a more convenient object oriented interface and type safety for a wide range of the types found in libX11.

Currently libxpp mostly operates on the default Screen, default Visual and the default Colormap. To use different instances for any of them, the API will need to be adjusted in spots, this is not currently fully possible.

API documentation

libxpp uses Doxygen inline source comments that can either be viewed as plaintext directly in the headers or can be generated by building scons doxygen, provided you have the Doxygen program installed on your system.

Otherwise you can find the generated HTML version of the API documentation on the related GitHub Page.

Future Directions

I'm not currently planning to extend the library's scope without a specific need for it, see above.

Contributing

Any bugfixes and improvements are welcome as pull requests. Please refer to the coding style for a rough style guide. Before working on larger changes it might be helpful to contact me first to reach some common ground regarding the design etc.

By contributing you accept the same licensing conditions as the rest of the library for your contribution. Your name will be added to an authors list in the repository.

About

A library providing an object oriented C++ API wrapper for parts of the X11 API

Resources

License

Stars

Watchers

Forks

Packages