diff --git a/cmenu/main.c b/cmenu/main.c new file mode 100644 index 0000000..11c1471 --- /dev/null +++ b/cmenu/main.c @@ -0,0 +1,9 @@ + + + + +// Opens a fuzzy finding window with the given array of strings. +// Returns the index of the picked element. +// Returns -1 on no selection. +int picker(char const *strings, int strings_len, char const *prompt) { +} diff --git a/cmenu/platform.h b/cmenu/platform.h new file mode 100644 index 0000000..e98d53b --- /dev/null +++ b/cmenu/platform.h @@ -0,0 +1,51 @@ +#ifndef PLATFORM +#define PLATFORM + +#include +#include + +typedef struct Color { + uint8_t r, g, b; +} Color; + +#define WHITE ((Color){255,255,255}) +#define BLACK ((Color){0,0,0}) + +typedef enum Key { + Key_backspace, + Key_ctrl, + Key_enter, + Key_h, + Key_n, + Key_p, + Key_y, + Count_Key +} Key; + +bool KeyIsDown(Key key); +bool KeyIsUp(Key key); +bool KeyIsJustPressedOrRepeat(Key key); +bool KeyIsJustPressed(Key key); +bool KeyIsJustReleased(Key key); +bool InputGetNextPrintable(char const *out_key); + +typedef struct Screen { + void *handle; +} Screen; + +typedef struct Window { + int width; + int height; + void *handle; + Screen screen; +} Window; + +Screen ScreenGetFocused(); +int ScreenGetWidth(Screen screen); +int ScreenGetHeight(Screen screen); +// Make a window specifically suitable for tools like launchers. +// Always on top, not resizable, closes on lost focus. +Window ScreenMakeStaticWindow(int x, int y, int width, int height); +void WindowClear(Color color); + +#endif /* PLATFORM */ diff --git a/cmenu/platform.x11.c b/cmenu/platform.x11.c new file mode 100644 index 0000000..e69de29