desktop-shell: Add beginning of pop-up menu to panel
diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
index 496d0d1..7ad6f02 100644
--- a/clients/desktop-shell.c
+++ b/clients/desktop-shell.c
@@ -46,6 +46,7 @@
struct panel {
struct window *window;
+ struct window *menu;
};
struct panel_item {
@@ -67,6 +68,21 @@
}
static void
+show_menu(struct panel *panel, struct input *input)
+{
+ int32_t x, y, width = 200, height = 200;
+ struct display *display;
+
+ input_get_position(input, &x, &y);
+ display = window_get_display(panel->window);
+ panel->menu = window_create_transient(display, panel->window,
+ x - 10, y - 10, width, height);
+
+ window_draw(panel->menu);
+ window_flush(panel->menu);
+}
+
+static void
panel_activate_item(struct panel *panel, struct panel_item *item)
{
pid_t pid;
@@ -164,6 +180,11 @@
window_schedule_redraw(panel->window);
if (state == 0)
panel_activate_item(panel, pi);
+ } else if (button == BTN_RIGHT) {
+ if (state)
+ show_menu(panel, input);
+ else
+ window_destroy(panel->menu);
}
}