Tray: Implement dbusmenu

Co-authored-by: Ian Fan <ianfan0@gmail.com>
Co-authored-by: Nathan Schulte <nmschulte@gmail.com>

Signed-off-by: Felix Weilbach <felix.weilbach@t-online.de>
This commit is contained in:
Felix Weilbach 2021-05-30 20:45:01 +02:00 committed by RogueAI
parent f686e9ad59
commit 2fd480ff1b
11 changed files with 1468 additions and 11 deletions

View file

@ -0,0 +1,27 @@
#ifndef _SWAYBAR_TRAY_DBUSMENU_H
#define _SWAYBAR_TRAY_DBUSMENU_H
#include "swaybar/bar.h"
#include "swaybar/tray/item.h"
void swaybar_dbusmenu_open(struct swaybar_sni *sni,
struct swaybar_output *output, struct swaybar_seat *seat, uint32_t serial,
int x, int y);
bool dbusmenu_pointer_button(void *data, struct wl_pointer *wl_pointer,
uint32_t serial, uint32_t time_, uint32_t button, uint32_t state);
bool dbusmenu_pointer_motion(struct swaybar_seat *seat, struct wl_pointer *wl_pointer,
uint32_t time_, wl_fixed_t surface_x, wl_fixed_t surface_y);
bool dbusmenu_pointer_enter(void *data, struct wl_pointer *wl_pointer, uint32_t serial,
struct wl_surface *surface, wl_fixed_t surface_x, wl_fixed_t surface_y);
bool dbusmenu_pointer_leave(void *data, struct wl_pointer *wl_pointer, uint32_t serial,
struct wl_surface *surface);
bool dbusmenu_pointer_frame(struct swaybar_seat *data, struct wl_pointer *wl_pointer);
bool dbusmenu_pointer_axis(struct swaybar_seat *data, struct wl_pointer *wl_pointer);
#endif

View file

@ -18,6 +18,7 @@ struct swaybar_pixmap {
struct swaybar_sni_slot {
struct wl_list link; // swaybar_sni::slots
struct swaybar_sni *sni;
int menu_id;
const char *prop;
const char *type;
void *dest;
@ -48,6 +49,7 @@ struct swaybar_sni {
char *icon_theme_path; // non-standard KDE property
struct wl_list slots; // swaybar_sni_slot::link
char **menu_icon_theme_paths;
};
struct swaybar_sni *create_sni(char *id, struct swaybar_tray *tray);

View file

@ -32,6 +32,9 @@ struct swaybar_tray {
list_t *basedirs; // char *
list_t *themes; // struct swaybar_theme *
struct swaybar_dbusmenu *menu;
struct swaybar_dbusmenu_menu *menu_pointer_focus;
};
struct swaybar_tray *create_tray(struct swaybar *bar);