swayfx/include/swaybar/bar.h

106 lines
2.1 KiB
C
Raw Normal View History

2016-01-24 12:34:20 +11:00
#ifndef _SWAYBAR_BAR_H
#define _SWAYBAR_BAR_H
#include <wayland-client.h>
#include "pool-buffer.h"
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
#include "xdg-output-unstable-v1-client-protocol.h"
2016-01-24 06:55:01 +11:00
struct swaybar_config;
struct swaybar_output;
struct swaybar_workspace;
2018-03-31 12:38:28 +11:00
struct swaybar_pointer {
struct wl_pointer *pointer;
struct wl_cursor_theme *cursor_theme;
struct wl_cursor_image *cursor_image;
struct wl_surface *cursor_surface;
struct swaybar_output *current;
2018-03-31 13:42:59 +11:00
int x, y;
};
enum x11_button {
NONE,
LEFT,
MIDDLE,
RIGHT,
SCROLL_UP,
SCROLL_DOWN,
SCROLL_LEFT,
SCROLL_RIGHT,
BACK,
FORWARD,
};
enum hotspot_event_handling {
HOTSPOT_IGNORE,
HOTSPOT_PROCESS,
};
2018-03-31 13:42:59 +11:00
struct swaybar_hotspot {
struct wl_list link;
int x, y, width, height;
enum hotspot_event_handling (*callback)(struct swaybar_output *output,
int x, int y, enum x11_button button, void *data);
2018-03-31 13:42:59 +11:00
void (*destroy)(void *data);
void *data;
2018-03-31 12:38:28 +11:00
};
struct swaybar {
struct wl_display *display;
struct wl_compositor *compositor;
struct zwlr_layer_shell_v1 *layer_shell;
struct zxdg_output_manager_v1 *xdg_output_manager;
struct wl_shm *shm;
2018-03-31 12:38:28 +11:00
struct wl_seat *seat;
2016-01-24 06:55:01 +11:00
struct swaybar_config *config;
struct swaybar_output *focused_output;
2018-03-31 12:38:28 +11:00
struct swaybar_pointer pointer;
struct status_line *status;
2018-03-29 14:56:02 +11:00
int ipc_event_socketfd;
int ipc_socketfd;
struct wl_list outputs;
2016-01-24 06:55:01 +11:00
};
struct swaybar_output {
struct wl_list link;
struct swaybar *bar;
struct wl_output *output;
struct zxdg_output_v1 *xdg_output;
struct wl_surface *surface;
struct zwlr_layer_surface_v1 *layer_surface;
2018-04-06 05:39:57 +10:00
uint32_t wl_name;
2018-03-29 15:21:05 +11:00
struct wl_list workspaces;
2018-03-31 13:42:59 +11:00
struct wl_list hotspots;
2018-03-29 15:21:05 +11:00
2016-01-24 10:23:09 +11:00
char *name;
bool focused;
2016-01-24 06:55:01 +11:00
uint32_t width, height;
2018-04-04 11:06:28 +10:00
int32_t scale;
struct pool_buffer buffers[2];
struct pool_buffer *current_buffer;
2016-01-24 06:55:01 +11:00
};
2018-03-29 15:21:05 +11:00
struct swaybar_workspace {
struct wl_list link;
int num;
char *name;
bool focused;
bool visible;
bool urgent;
};
void bar_setup(struct swaybar *bar,
2018-03-29 15:21:05 +11:00
const char *socket_path,
const char *bar_id);
void bar_run(struct swaybar *bar);
void bar_teardown(struct swaybar *bar);
2018-04-25 07:04:19 +10:00
void free_workspaces(struct wl_list *list);
#endif