2018-07-26 11:57:19 +10:00
|
|
|
#ifndef _SWAY_NAGBAR_NAGBAR_H
|
2018-07-28 23:34:25 +10:00
|
|
|
#define _SWAY_NAGBAR_NAGBAR_H
|
2018-07-26 11:57:19 +10:00
|
|
|
#include <stdint.h>
|
|
|
|
#include "list.h"
|
|
|
|
#include "pool-buffer.h"
|
2018-07-28 23:34:25 +10:00
|
|
|
#include "swaynag/types.h"
|
2018-07-26 11:57:19 +10:00
|
|
|
#include "xdg-output-unstable-v1-client-protocol.h"
|
|
|
|
|
|
|
|
#define NAGBAR_BAR_BORDER_THICKNESS 2
|
|
|
|
#define NAGBAR_MESSAGE_PADDING 8
|
2018-07-27 15:30:35 +10:00
|
|
|
#define NAGBAR_DETAILS_BORDER_THICKNESS 3
|
2018-07-26 11:57:19 +10:00
|
|
|
#define NAGBAR_BUTTON_BORDER_THICKNESS 3
|
|
|
|
#define NAGBAR_BUTTON_GAP 20
|
|
|
|
#define NAGBAR_BUTTON_GAP_CLOSE 15
|
|
|
|
#define NAGBAR_BUTTON_MARGIN_RIGHT 2
|
|
|
|
#define NAGBAR_BUTTON_PADDING 3
|
|
|
|
|
2018-07-27 15:30:35 +10:00
|
|
|
#define NAGBAR_MAX_HEIGHT 500
|
|
|
|
|
|
|
|
enum sway_nagbar_action_type {
|
|
|
|
NAGBAR_ACTION_DISMISS,
|
|
|
|
NAGBAR_ACTION_EXPAND,
|
|
|
|
NAGBAR_ACTION_COMMAND,
|
|
|
|
};
|
|
|
|
|
2018-07-26 11:57:19 +10:00
|
|
|
struct sway_nagbar_pointer {
|
|
|
|
struct wl_pointer *pointer;
|
|
|
|
struct wl_cursor_theme *cursor_theme;
|
|
|
|
struct wl_cursor_image *cursor_image;
|
|
|
|
struct wl_surface *cursor_surface;
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sway_nagbar_output {
|
|
|
|
char *name;
|
|
|
|
struct wl_output *wl_output;
|
|
|
|
uint32_t wl_name;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sway_nagbar_button {
|
|
|
|
char *text;
|
2018-07-27 15:30:35 +10:00
|
|
|
enum sway_nagbar_action_type type;
|
2018-07-26 11:57:19 +10:00
|
|
|
char *action;
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
};
|
|
|
|
|
2018-07-27 15:30:35 +10:00
|
|
|
struct sway_nagbar_details {
|
|
|
|
bool visible;
|
|
|
|
char *message;
|
|
|
|
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
|
|
|
|
int offset;
|
|
|
|
int visible_lines;
|
|
|
|
int total_lines;
|
2018-07-28 23:34:25 +10:00
|
|
|
struct sway_nagbar_button button_details;
|
2018-07-27 15:30:35 +10:00
|
|
|
struct sway_nagbar_button button_up;
|
|
|
|
struct sway_nagbar_button button_down;
|
|
|
|
};
|
|
|
|
|
2018-07-26 11:57:19 +10:00
|
|
|
struct sway_nagbar {
|
|
|
|
bool run_display;
|
|
|
|
int querying_outputs;
|
|
|
|
|
|
|
|
struct wl_display *display;
|
|
|
|
struct wl_compositor *compositor;
|
|
|
|
struct wl_seat *seat;
|
|
|
|
struct wl_shm *shm;
|
|
|
|
struct sway_nagbar_pointer pointer;
|
|
|
|
struct zxdg_output_manager_v1 *xdg_output_manager;
|
|
|
|
struct sway_nagbar_output output;
|
|
|
|
struct zwlr_layer_shell_v1 *layer_shell;
|
|
|
|
struct zwlr_layer_surface_v1 *layer_surface;
|
|
|
|
struct wl_surface *surface;
|
|
|
|
|
|
|
|
uint32_t width;
|
|
|
|
uint32_t height;
|
|
|
|
int32_t scale;
|
|
|
|
struct pool_buffer buffers[2];
|
|
|
|
struct pool_buffer *current_buffer;
|
|
|
|
|
2018-07-28 23:34:25 +10:00
|
|
|
struct sway_nagbar_type *type;
|
2018-07-26 11:57:19 +10:00
|
|
|
uint32_t anchors;
|
|
|
|
char *message;
|
|
|
|
char *font;
|
|
|
|
list_t *buttons;
|
2018-07-27 15:30:35 +10:00
|
|
|
struct sway_nagbar_details details;
|
2018-07-26 11:57:19 +10:00
|
|
|
};
|
|
|
|
|
|
|
|
void nagbar_setup(struct sway_nagbar *nagbar);
|
|
|
|
|
|
|
|
void nagbar_run(struct sway_nagbar *nagbar);
|
|
|
|
|
|
|
|
void nagbar_destroy(struct sway_nagbar *nagbar);
|
|
|
|
|
|
|
|
#endif
|