• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

Build/H23-Apr-2020-10368

xputty/H23-Apr-2020-16,99510,541

.gitignoreH A D23-Apr-2020430 5344

DoxyfileH A D23-Apr-2020106.5 KiB2,5011,946

LICENSEH A D23-Apr-2020773 2018

MakefileH A D23-Apr-2020356 189

README.mdH A D23-Apr-20202.9 KiB9167

README.md

1# libxputty
2
3A damn tiny abstraction Layer to create X11 window/widgets with cairo surfaces
4
5This repository contain only the library files to allow easily and lightweight
6embedding into other projects.
7
8For check out some examples go here:
9[Examples](https://github.com/brummer10/Xputty)
10
11## Features
12
13- easy creation of widgets and windows within the xlib windows system
14- easy handling of multiple windows including multiple widgets
15- easy memory managment by the xputty main struct
16- easy to use main struct to handle the lifetime of all widgets and windows
17    - Xputty main;
18    - main_init(&main);
19    - create_windows();
20    - main_run(&main);
21    - main_quit(&main);
22- easy embedding XWindows into other native windows
23- all events been handled by function pointers, thus allow
24    - easy connection to event handlers by simply overwriting the defaults with you own handlers
25    - implement you own events by add a function pointer and connect to it
26    - block free connection between dialog boxes and the main window
27- easy to use x/y adjustments to create your own controller widgets like sliders, knobs, buttons or trackballs
28- double buffered cairo surfaces to enable transparent drawing on child widgets
29- handle child widgets via childlist
30- multiple implemented resizing options
31- a couple of defined Widgets and Dialogs ready to use
32- full documented API [Documentation](https://brummer10.github.io/Xputty/html/index.html)
33- static linking to create position independent applications
34
35
36Here is the usual hello world:
37
38![simple-example](https://github.com/brummer10/Xputty/raw/master/examples/simple-example.png)
39
40produced  by this code:
41
42```C
43
44#include "xputty.h"
45
46/** your own expose function */
47static void draw_window(void *w_, void* user_data) {
48    Widget_t *w = (Widget_t*)w_;
49    cairo_set_source_rgb (w->crb, 1, 1, 1);
50    cairo_paint (w->crb);
51}
52
53int main (int argc, char ** argv)
54{
55    /** acces the main struct */
56    Xputty app;
57    /** init the main struct */
58    main_init(&app);
59    /** create a Window on default root window */
60    Widget_t *w = create_window(&app, DefaultRootWindow(app.dpy), 0, 0, 300, 200);
61    /** acces Xlib function */
62    XStoreName(app.dpy, w->widget, "Hello world");
63    /** overwrite event handler with your own */
64    w->func.expose_callback = draw_window;
65    /** map the Window to display */
66    widget_show_all(w);
67    /** run the event loop */
68    main_run(&app);
69    /** clean up after the event loop is finished */
70    main_quit(&app);
71    return 0;
72}
73
74```
75
76Here are a bit more advanced examples:
77
78![Theme-example](https://github.com/brummer10/Xputty/raw/master/examples/Theme-example.png)    ![xgain](https://github.com/brummer10/Xputty/raw/master/examples/xgain.png)
79
80
81![midikeyboard](https://github.com/brummer10/Xputty/raw/master/examples/midikeyboard.png)
82
83
84![File-selector](https://github.com/brummer10/Xputty/raw/master/examples/File-selector.png)
85
86
87## License
88
89         0BSD
90BSD Zero Clause License
91