Support a very simple root-menu

This commit is contained in:
Johan Malm 2020-10-19 22:14:17 +01:00
parent f49a3a0395
commit dc5d1ab976
9 changed files with 255 additions and 36 deletions

View file

@ -38,9 +38,10 @@
#define XCURSOR_MOVE "grabbing"
enum cursor_mode {
LAB_CURSOR_PASSTHROUGH,
LAB_CURSOR_PASSTHROUGH = 0,
LAB_CURSOR_MOVE,
LAB_CURSOR_RESIZE,
LAB_INPUT_STATE_MENU,
};
struct input {
@ -106,6 +107,8 @@ struct server {
/* Set when in cycle (alt-tab) mode */
struct view *cycle_view;
struct menu *rootmenu;
};
struct output {

35
include/menu/menu.h Normal file
View file

@ -0,0 +1,35 @@
#ifndef __LABWC_MENU_H
#define __LABWC_MENU_H
#include <wayland-server.h>
#include <wlr/render/wlr_renderer.h>
struct menuitem {
char *action;
char *command;
struct wlr_box geo_box;
struct wlr_texture *active_texture;
struct wlr_texture *inactive_texture;
bool selected;
struct wl_list link;
};
struct menu {
int x;
int y;
struct wl_list menuitems;
};
/* menu_create - create menu */
void menu_init(struct server *server, struct menu *menu);
/* menu_move - move to position (x, y) */
void menu_move(struct menu *menu, int x, int y);
/* menu_set_selected - select item at (x, y) */
void menu_set_selected(struct menu *menu, int x, int y);
/* menu_action_selected - select item at (x, y) */
void menu_action_selected(struct server *server, struct menu *menu);
#endif /* __LABWC_MENU_H */