diff options
Diffstat (limited to 'menu.h')
-rw-r--r-- | menu.h | 60 |
1 files changed, 40 insertions, 20 deletions
@@ -27,16 +27,18 @@ struct page { struct output { struct menu *menu; struct wl_output *output; - const char *name; - int32_t scale; + const char *name; // output name + int32_t scale; // output scale + struct output *next; // next output }; // Keyboard state. struct keyboard { struct menu *menu; - - struct xkb_context *xkb_context; - struct xkb_state *xkb_state; + struct wl_keyboard *keyboard; + struct xkb_context *context; + struct xkb_keymap *keymap; + struct xkb_state *state; int repeat_timer; int repeat_delay; @@ -47,19 +49,40 @@ struct keyboard { // Menu state. struct menu { + // Whether the menu appears at the bottom of the screen + bool bottom; + // The function used to match menu items + int (*strncmp)(const char *, const char *, size_t); + // The font used to display the menu + char *font; + // The number of lines to list items vertically + int lines; + // The name of the output to display on + char *output_name; + // The prompt displayed to the left of the input field + char *prompt; + // Normal colors + uint32_t normalbg, normalfg; + // Prompt colors + uint32_t promptbg, promptfg; + // Selection colors + uint32_t selectionbg, selectionfg; + + struct wl_display *display; + struct wl_registry *registry; struct wl_compositor *compositor; struct wl_shm *shm; struct wl_seat *seat; struct wl_data_device_manager *data_device_manager; struct zwlr_layer_shell_v1 *layer_shell; - - struct wl_display *display; - struct wl_surface *surface; - struct wl_data_offer *offer; + struct output *output_list; struct keyboard *keyboard; + struct wl_data_device *data_device; + struct wl_surface *surface; + struct zwlr_layer_surface_v1 *layer_surface; + struct wl_data_offer *data_offer; struct output *output; - char *output_name; struct pool_buffer buffers[2]; struct pool_buffer *current; @@ -73,15 +96,6 @@ struct menu { int left_arrow; int right_arrow; - bool bottom; - int (*strncmp)(const char *, const char *, size_t); - char *font; - int lines; - char *prompt; - uint32_t background, foreground; - uint32_t promptbg, promptfg; - uint32_t selectionbg, selectionfg; - char input[BUFSIZ]; size_t cursor; @@ -95,9 +109,15 @@ struct menu { bool failure; }; -void menu_init(struct menu *menu, int argc, char *argv[]); +struct menu *menu_create(); +struct keyboard *keyboard_create(struct menu *menu, struct wl_keyboard *wl_keyboard); +void menu_set_keyboard(struct menu *menu, struct keyboard *keyboard); +struct output *output_create(struct menu *menu, struct wl_output *wl_output); +void menu_add_output(struct menu *menu, struct output *output); +void menu_getopts(struct menu *menu, int argc, char *argv[]); void read_menu_items(struct menu *menu); void menu_keypress(struct menu *menu, enum wl_keyboard_key_state key_state, xkb_keysym_t sym); +void menu_destroy(struct menu *menu); #endif |