mirror of
https://github.com/labwc/labwc.git
synced 2025-11-03 09:01:51 -05:00
Support a very simple root-menu
This commit is contained in:
parent
f49a3a0395
commit
dc5d1ab976
9 changed files with 255 additions and 36 deletions
29
src/output.c
29
src/output.c
|
|
@ -1,6 +1,7 @@
|
|||
#define _POSIX_C_SOURCE 200809L
|
||||
#include <wlr/types/wlr_xdg_output_v1.h>
|
||||
#include "labwc.h"
|
||||
#include "menu/menu.h"
|
||||
#include "theme/theme.h"
|
||||
#include "layers.h"
|
||||
|
||||
|
|
@ -80,6 +81,29 @@ render_it:
|
|||
draw_rect_unfilled(&dd, box);
|
||||
}
|
||||
|
||||
static void
|
||||
render_rootmenu(struct output *output)
|
||||
{
|
||||
struct server *server = output->server;
|
||||
struct draw_data ddata = {
|
||||
.renderer = server->renderer,
|
||||
.transform_matrix = output->wlr_output->transform_matrix,
|
||||
};
|
||||
float matrix[9];
|
||||
|
||||
ddata.rgba = (float[4]){ 0.9, 0.3, 0.3, 0.5 };
|
||||
struct menuitem *menuitem;
|
||||
wl_list_for_each (menuitem, &server->rootmenu->menuitems, link) {
|
||||
struct wlr_texture *t;
|
||||
t = menuitem->selected ? menuitem->active_texture :
|
||||
menuitem->inactive_texture;
|
||||
wlr_matrix_project_box(matrix, &menuitem->geo_box,
|
||||
WL_OUTPUT_TRANSFORM_NORMAL, 0, ddata.transform_matrix);
|
||||
wlr_render_texture_with_matrix(ddata.renderer, t, matrix, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
render_icon(struct draw_data *d, struct wlr_box box,
|
||||
struct wlr_texture *texture)
|
||||
|
|
@ -337,6 +361,11 @@ output_frame_notify(struct wl_listener *listener, void *data)
|
|||
|
||||
render_layer(&now, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]);
|
||||
render_layer(&now, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]);
|
||||
|
||||
if (output->server->cursor_mode == LAB_INPUT_STATE_MENU) {
|
||||
render_rootmenu(output);
|
||||
}
|
||||
|
||||
/* Just in case hardware cursors not supported by GPU */
|
||||
wlr_output_render_software_cursors(output->wlr_output, NULL);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue