mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
refactor: fetch outputs from Gtk::Display instead of wl_registry.
gtk-layer-shell wants Gdk::Monitor instead of wl_output; change code to deal with Gdk objects and slightly simplify it. Requires gtkmm 3.22.0+ (first release with Gdk::Monitor support).
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <gdkmm/monitor.h>
|
||||
#include <glibmm/refptr.h>
|
||||
#include <gtkmm/box.h>
|
||||
#include <gtkmm/cssprovider.h>
|
||||
@ -15,10 +16,11 @@ namespace waybar {
|
||||
|
||||
class Factory;
|
||||
struct waybar_output {
|
||||
struct wl_output * output = nullptr;
|
||||
std::string name;
|
||||
uint32_t wl_name;
|
||||
struct zxdg_output_v1 *xdg_output = nullptr;
|
||||
Glib::RefPtr<Gdk::Monitor> monitor;
|
||||
std::string name;
|
||||
|
||||
std::unique_ptr<struct zxdg_output_v1, decltype(&zxdg_output_v1_destroy)> xdg_output = {
|
||||
nullptr, &zxdg_output_v1_destroy};
|
||||
};
|
||||
|
||||
class Bar {
|
||||
|
@ -34,17 +34,15 @@ class Client {
|
||||
bool isValidOutput(const Json::Value &config, std::unique_ptr<struct waybar_output> &output);
|
||||
auto setupConfig(const std::string &config_file) -> void;
|
||||
auto setupCss(const std::string &css_file) -> void;
|
||||
std::unique_ptr<struct waybar_output> &getOutput(uint32_t wl_name);
|
||||
std::unique_ptr<struct waybar_output> &getOutput(void *);
|
||||
std::vector<Json::Value> getOutputConfigs(std::unique_ptr<struct waybar_output> &output);
|
||||
|
||||
static void handleGlobal(void *data, struct wl_registry *registry, uint32_t name,
|
||||
const char *interface, uint32_t version);
|
||||
static void handleGlobalRemove(void *data, struct wl_registry *registry, uint32_t name);
|
||||
static void handleLogicalPosition(void *, struct zxdg_output_v1 *, int32_t, int32_t);
|
||||
static void handleLogicalSize(void *, struct zxdg_output_v1 *, int32_t, int32_t);
|
||||
static void handleDone(void *, struct zxdg_output_v1 *);
|
||||
static void handleName(void *, struct zxdg_output_v1 *, const char *);
|
||||
static void handleDescription(void *, struct zxdg_output_v1 *, const char *);
|
||||
static void handleOutputName(void *, struct zxdg_output_v1 *, const char *);
|
||||
void handleMonitorAdded(Glib::RefPtr<Gdk::Monitor> monitor);
|
||||
void handleMonitorRemoved(Glib::RefPtr<Gdk::Monitor> monitor);
|
||||
|
||||
Json::Value config_;
|
||||
Glib::RefPtr<Gtk::StyleContext> style_context_;
|
||||
|
Reference in New Issue
Block a user