|
ginnOS
The reference: libc, the libraries and the kernel
|
idunn: the app loop and windows on the window server. More...
#include "idunn_internal.h"#include <errno.h>#include <heimdall.h>#include <poll.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/input.h>#include <time.h>Macros | |
| #define | FONT_DIR "/usr/share/fonts" |
Functions | |
| idunn_app_t * | idunn_app_new (const char *name) |
| connect to the window server and read the theme. | |
| void | idunn_app_quit (idunn_app_t *app) |
| heim_conn_t * | idunn_app_conn (const idunn_app_t *app) |
| the connection to the window server, for calls idunn does not wrap (the shell's heim_shell_start, for example). | |
| void | idunn_app_on_event (idunn_app_t *app, void(*on_event)(idunn_app_t *app, const heim_msg_t *msg, void *data), void *data) |
| get the events that are about no window of the app (the shell's HEIM_EV_WINDOW, HEIM_EV_WINDOW_APP, HEIM_EV_WINDOW_GONE), and HEIM_EV_SETTINGS (after idunn applied a new theme). | |
| void | idunn_app_every (idunn_app_t *app, uint32_t period, void(*every)(void *data), void *data) |
| call every(data) each period ms while the app runs (a clock). | |
| void | idunn_app_watch (idunn_app_t *app, int fd, void(*ready)(int fd, void *data), void *data) |
| call ready(fd, data) when fd can be read (or has hung up) while the app runs: a pty, a pipe. | |
| void | idunn_window_set_title (idunn_window_t *win, const char *title) |
| a new title in the window's title bar (and the shell's window list). | |
| const idunn_theme_t * | idunn_app_theme (const idunn_app_t *app) |
| void | idunn_app_set_theme (idunn_app_t *app, const idunn_theme_t *theme) |
| use another theme in all windows of the app (they are drawn again). | |
| bool | idunn_app_save_theme (idunn_app_t *app, const char *key, const char *value) |
| change a theme setting (mode, accent, radius, font_size, scale, motion) in the user's theme file. | |
| idunn_window_t * | idunn_window_new (idunn_app_t *app, const char *title, int32_t width, int32_t height) |
| a window with a title bar; it shows when the app runs. | |
| idunn_window_t * | idunn_screen_window_new (idunn_app_t *app, const gfx_buffer_t *backdrop) |
| a window as large as the screen with no title bar (a login screen). | |
| idunn_window_t * | idunn_panel_new (idunn_app_t *app, int32_t height) |
| a panel of the desktop shell: no title bar, at the bottom of the screen, as wide as the screen, above the windows (HEIM_WINDOW_PANEL). | |
| void | idunn_window_close (idunn_window_t *win) |
| close and free the window (and its widgets). | |
| int | idunn_app_run (idunn_app_t *app) |
| run until the last window is closed or idunn_app_quit. | |
| void | idunn_app_paste (idunn_app_t *app, void(*got)(const char *text, size_t length, void *data), void *data) |
| ask for the clipboard's text for the program itself (not a widget): got gets it when it comes ("" when the clipboard is empty). | |
| void | idunn_window_on_close (idunn_window_t *win, bool(*on_close)(idunn_window_t *win, void *data), void *data) |
| the close button (or the shell's Close): on_close returns true to let the window close, false to keep it (to ask about unsaved changes first, and close it later with idunn_window_close). | |
idunn: the app loop and windows on the window server.
a window is drawn only when its last frame is on the screen (after HEIM_EV_FRAME), so it is never drawn twice before it shows, and a transition draws one step per frame.
| #define FONT_DIR "/usr/share/fonts" |
| idunn_app_t * idunn_app_new | ( | const char * | name | ) |
connect to the window server and read the theme.
| name | the program's id, the name of its .app file ("idunn-gallery"): the shell shows its icon with its windows. |
| void idunn_app_quit | ( | idunn_app_t * | app | ) |
| heim_conn_t * idunn_app_conn | ( | const idunn_app_t * | app | ) |
the connection to the window server, for calls idunn does not wrap (the shell's heim_shell_start, for example).
| void idunn_app_on_event | ( | idunn_app_t * | app, |
| void(* | on_event )(idunn_app_t *app, const heim_msg_t *msg, void *data), | ||
| void * | data ) |
get the events that are about no window of the app (the shell's HEIM_EV_WINDOW, HEIM_EV_WINDOW_APP, HEIM_EV_WINDOW_GONE), and HEIM_EV_SETTINGS (after idunn applied a new theme).
| void idunn_app_every | ( | idunn_app_t * | app, |
| uint32_t | period, | ||
| void(* | every )(void *data), | ||
| void * | data ) |
call every(data) each period ms while the app runs (a clock).
one per app; a new call replaces it, period 0 stops it.
| void idunn_app_watch | ( | idunn_app_t * | app, |
| int | fd, | ||
| void(* | ready )(int fd, void *data), | ||
| void * | data ) |
call ready(fd, data) when fd can be read (or has hung up) while the app runs: a pty, a pipe.
at most IDUNN_WATCH_MAX at a time; ready NULL stops watching fd.
| void idunn_window_set_title | ( | idunn_window_t * | win, |
| const char * | title ) |
a new title in the window's title bar (and the shell's window list).
| const idunn_theme_t * idunn_app_theme | ( | const idunn_app_t * | app | ) |
| void idunn_app_set_theme | ( | idunn_app_t * | app, |
| const idunn_theme_t * | theme ) |
use another theme in all windows of the app (they are drawn again).
| bool idunn_app_save_theme | ( | idunn_app_t * | app, |
| const char * | key, | ||
| const char * | value ) |
change a theme setting (mode, accent, radius, font_size, scale, motion) in the user's theme file.
every app and the window decorations change.
| idunn_window_t * idunn_window_new | ( | idunn_app_t * | app, |
| const char * | title, | ||
| int32_t | width, | ||
| int32_t | height ) |
a window with a title bar; it shows when the app runs.
| width | the size of its content, in design pixels. |
| idunn_window_t * idunn_screen_window_new | ( | idunn_app_t * | app, |
| const gfx_buffer_t * | backdrop ) |
a window as large as the screen with no title bar (a login screen).
| backdrop | the picture under the widgets, as large as the screen (or NULL: the surface colour). it must stay until the app ends. |
| idunn_window_t * idunn_panel_new | ( | idunn_app_t * | app, |
| int32_t | height ) |
a panel of the desktop shell: no title bar, at the bottom of the screen, as wide as the screen, above the windows (HEIM_WINDOW_PANEL).
| height | in design pixels. |
| void idunn_window_close | ( | idunn_window_t * | win | ) |
close and free the window (and its widgets).
| int idunn_app_run | ( | idunn_app_t * | app | ) |
run until the last window is closed or idunn_app_quit.
| void idunn_app_paste | ( | idunn_app_t * | app, |
| void(* | got )(const char *text, size_t length, void *data), | ||
| void * | data ) |
ask for the clipboard's text for the program itself (not a widget): got gets it when it comes ("" when the clipboard is empty).
| void idunn_window_on_close | ( | idunn_window_t * | win, |
| bool(* | on_close )(idunn_window_t *win, void *data), | ||
| void * | data ) |
the close button (or the shell's Close): on_close returns true to let the window close, false to keep it (to ask about unsaved changes first, and close it later with idunn_window_close).