Merge pull request #2836 from alebastr/require-gtk-layer-shell

Require gtk-layer-shell
This commit is contained in:
Alexis Rouillard
2024-02-19 22:57:50 +01:00
committed by GitHub
10 changed files with 139 additions and 777 deletions

View File

@ -53,34 +53,18 @@ class BarIpcClient;
}
#endif // HAVE_SWAY
class BarSurface {
protected:
BarSurface() = default;
public:
virtual void setExclusiveZone(bool enable) = 0;
virtual void setLayer(bar_layer layer) = 0;
virtual void setMargins(const struct bar_margins &margins) = 0;
virtual void setPassThrough(bool enable) = 0;
virtual void setPosition(Gtk::PositionType position) = 0;
virtual void setSize(uint32_t width, uint32_t height) = 0;
virtual void commit(){};
virtual ~BarSurface() = default;
};
class Bar {
public:
using bar_mode_map = std::map<std::string_view, struct bar_mode>;
using bar_mode_map = std::map<std::string, struct bar_mode>;
static const bar_mode_map PRESET_MODES;
static const std::string_view MODE_DEFAULT;
static const std::string_view MODE_INVISIBLE;
static const std::string MODE_DEFAULT;
static const std::string MODE_INVISIBLE;
Bar(struct waybar_output *w_output, const Json::Value &);
Bar(const Bar &) = delete;
~Bar();
void setMode(const std::string_view &);
void setMode(const std::string &mode);
void setVisible(bool visible);
void toggle();
void handleSignal(int);
@ -107,6 +91,8 @@ class Bar {
void setupAltFormatKeyForModule(const std::string &module_name);
void setupAltFormatKeyForModuleList(const char *module_list_name);
void setMode(const bar_mode &);
void setPassThrough(bool passthrough);
void setPosition(Gtk::PositionType position);
void onConfigure(GdkEventConfigure *ev);
void configureGlobalOffset(int width, int height);
void onOutputGeometryChanged();
@ -116,8 +102,9 @@ class Bar {
std::string last_mode_{MODE_DEFAULT};
struct bar_margins margins_;
uint32_t width_, height_;
bool passthrough_;
std::unique_ptr<BarSurface> surface_impl_;
Gtk::Box left_;
Gtk::Box center_;
Gtk::Box right_;

View File

@ -10,7 +10,6 @@
#include "util/css_reload_helper.hpp"
#include "util/portal.hpp"
struct zwlr_layer_shell_v1;
struct zwp_idle_inhibitor_v1;
struct zwp_idle_inhibit_manager_v1;
@ -26,7 +25,6 @@ class Client {
Glib::RefPtr<Gdk::Display> gdk_display;
struct wl_display *wl_display = nullptr;
struct wl_registry *registry = nullptr;
struct zwlr_layer_shell_v1 *layer_shell = nullptr;
struct zxdg_output_manager_v1 *xdg_output_manager = nullptr;
struct zwp_idle_inhibit_manager_v1 *idle_inhibit_manager = nullptr;
std::vector<std::unique_ptr<Bar>> bars;