2018-08-08 21:54:58 +00:00
|
|
|
#pragma once
|
|
|
|
|
2018-08-09 10:05:48 +00:00
|
|
|
#include <json/json.h>
|
2018-08-08 21:54:58 +00:00
|
|
|
#include <gtkmm.h>
|
|
|
|
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
|
2018-08-10 22:32:59 +00:00
|
|
|
#include "xdg-output-unstable-v1-client-protocol.h"
|
2018-08-08 21:54:58 +00:00
|
|
|
|
|
|
|
namespace waybar {
|
|
|
|
|
|
|
|
struct Client;
|
|
|
|
|
|
|
|
struct Bar {
|
|
|
|
Bar(Client& client, std::unique_ptr<struct wl_output *>&& output);
|
|
|
|
Bar(const Bar&) = delete;
|
|
|
|
Client& client;
|
|
|
|
Gtk::Window window;
|
|
|
|
struct wl_surface *surface;
|
2018-08-09 08:50:16 +00:00
|
|
|
struct zwlr_layer_surface_v1 *layerSurface;
|
2018-08-08 21:54:58 +00:00
|
|
|
std::unique_ptr<struct wl_output *> output;
|
|
|
|
bool visible = true;
|
2018-08-10 22:32:59 +00:00
|
|
|
std::string outputName;
|
2018-08-10 16:46:31 +00:00
|
|
|
auto setWidth(uint32_t) -> void;
|
2018-08-08 21:54:58 +00:00
|
|
|
auto toggle() -> void;
|
|
|
|
private:
|
2018-08-10 22:32:59 +00:00
|
|
|
static void _handleLogicalPosition(void *data,
|
|
|
|
struct zxdg_output_v1 *zxdg_output_v1, int32_t x, int32_t y);
|
|
|
|
static void _handleLogicalSize(void *data,
|
|
|
|
struct zxdg_output_v1 *zxdg_output_v1, int32_t width, int32_t height);
|
|
|
|
static void _handleDone(void *data, struct zxdg_output_v1 *zxdg_output_v1);
|
|
|
|
static void _handleName(void *data, struct zxdg_output_v1 *xdg_output,
|
|
|
|
const char *name);
|
|
|
|
static void _handleDescription(void *data,
|
|
|
|
struct zxdg_output_v1 *zxdg_output_v1, const char *description);
|
2018-08-09 18:22:01 +00:00
|
|
|
static void _handleGeometry(void *data, struct wl_output *wl_output,
|
|
|
|
int32_t x, int32_t y, int32_t physical_width, int32_t physical_height,
|
|
|
|
int32_t subpixel, const char *make, const char *model, int32_t transform);
|
|
|
|
static void _handleMode(void *data, struct wl_output *wl_output,
|
|
|
|
uint32_t f, int32_t w, int32_t h, int32_t refresh);
|
|
|
|
static void _handleDone(void *data, struct wl_output *);
|
|
|
|
static void _handleScale(void *data, struct wl_output *wl_output,
|
|
|
|
int32_t factor);
|
|
|
|
static void _layerSurfaceHandleConfigure(void *data,
|
|
|
|
struct zwlr_layer_surface_v1 *surface, uint32_t serial, uint32_t width,
|
|
|
|
uint32_t height);
|
|
|
|
static void _layerSurfaceHandleClosed(void *data,
|
|
|
|
struct zwlr_layer_surface_v1 *surface);
|
2018-08-09 10:05:48 +00:00
|
|
|
auto _setupConfig() -> void;
|
2018-08-09 08:50:16 +00:00
|
|
|
auto _setupWidgets() -> void;
|
|
|
|
auto _setupCss() -> void;
|
2018-08-10 16:46:31 +00:00
|
|
|
uint32_t _width = 10;
|
|
|
|
uint32_t _height = 30;
|
2018-08-09 10:05:48 +00:00
|
|
|
Json::Value _config;
|
2018-08-09 08:50:16 +00:00
|
|
|
Glib::RefPtr<Gtk::StyleContext> _styleContext;
|
|
|
|
Glib::RefPtr<Gtk::CssProvider> _cssProvider;
|
2018-08-10 22:32:59 +00:00
|
|
|
struct zxdg_output_v1 *_xdgOutput;
|
2018-08-08 21:54:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|