Skip to content

Commit

Permalink
Merge remote-tracking branch 'luka/gtk4' into gtk4
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexays committed Jan 12, 2024
2 parents f744d90 + f8eb01d commit d5bc2f3
Show file tree
Hide file tree
Showing 18 changed files with 178 additions and 273 deletions.
2 changes: 1 addition & 1 deletion include/ALabel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ALabel : public AModule {
bool alt_ = false;
std::string default_format_;

bool handleToggle(GdkEventButton *const &e) override;
//todo bool handleToggle(GdkEventButton *const &e) override;
virtual std::string getState(uint8_t value, bool lesser = false);
};

Expand Down
18 changes: 9 additions & 9 deletions include/AModule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <glibmm/dispatcher.h>
#include <glibmm/markup.h>
#include <gtkmm/eventbox.h>
//#include <gtkmm/eventbox.h>
#include <json/json.h>

#include "IModule.hpp"
Expand All @@ -28,25 +28,25 @@ class AModule : public IModule {

enum SCROLL_DIR { NONE, UP, DOWN, LEFT, RIGHT };

SCROLL_DIR getScrollDir(GdkEventScroll *e);
// SCROLL_DIR getScrollDir(GdkEventScroll *e);
bool tooltipEnabled();

const std::string name_;
const Json::Value &config_;
Gtk::EventBox event_box_;
// Gtk::EventBox event_box_;

virtual bool handleToggle(GdkEventButton *const &ev);
virtual bool handleScroll(GdkEventScroll *);
virtual bool handleRelease(GdkEventButton *const &ev);
// virtual bool handleToggle(GdkEventButton *const &ev);
// virtual bool handleScroll(GdkEventScroll *);
// virtual bool handleRelease(GdkEventButton *const &ev);

private:
bool handleUserEvent(GdkEventButton *const &ev);
// bool handleUserEvent(GdkEventButton *const &ev);
const bool isTooltip;
std::vector<int> pid_;
gdouble distance_scrolled_y_;
gdouble distance_scrolled_x_;
std::map<std::string, std::string> eventActionMap_;
static const inline std::map<std::pair<uint, GdkEventType>, std::string> eventMap_{
/* static const inline std::map<std::pair<uint, GdkEventType>, std::string> eventMap_{
{std::make_pair(1, GdkEventType::GDK_BUTTON_PRESS), "on-click"},
{std::make_pair(1, GdkEventType::GDK_BUTTON_RELEASE), "on-click-release"},
{std::make_pair(1, GdkEventType::GDK_2BUTTON_PRESS), "on-double-click"},
Expand All @@ -66,7 +66,7 @@ class AModule : public IModule {
{std::make_pair(9, GdkEventType::GDK_BUTTON_PRESS), "on-click-forward"},
{std::make_pair(9, GdkEventType::GDK_BUTTON_RELEASE), "on-click-forward-release"},
{std::make_pair(9, GdkEventType::GDK_2BUTTON_PRESS), "on-double-click-forward"},
{std::make_pair(9, GdkEventType::GDK_3BUTTON_PRESS), "on-triple-click-forward"}};
{std::make_pair(9, GdkEventType::GDK_3BUTTON_PRESS), "on-triple-click-forward"}};*/
};

} // namespace waybar
18 changes: 7 additions & 11 deletions include/bar.hpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
#pragma once

#include <gdkmm/monitor.h>
#include <glibmm/refptr.h>
#include <gtkmm/box.h>
#include <gtkmm/centerbox.h>
#include <gtkmm/cssprovider.h>
#include <gtkmm/main.h>
#include <gtkmm/window.h>
#include <json/json.h>

#include <memory>
#include <vector>

#include "AModule.hpp"
#include "group.hpp"
//#include "group.hpp"
#include "xdg-output-unstable-v1-client-protocol.h"

namespace waybar {
Expand Down Expand Up @@ -91,6 +86,7 @@ class Bar {
bool visible = true;
bool vertical = false;
Gtk::Window window;
Glib::RefPtr<Gdk::Surface> gdk_surface_;

int x_global;
int y_global;
Expand All @@ -100,13 +96,13 @@ class Bar {
#endif

private:
void onMap(GdkEventAny *);
void onMap();
auto setupWidgets() -> void;
void getModules(const Factory &, const std::string &, waybar::Group *);
// void getModules(const Factory &, const std::string &, waybar::Group *);
void setupAltFormatKeyForModule(const std::string &module_name);
void setupAltFormatKeyForModuleList(const char *module_list_name);
void setMode(const bar_mode &);
void onConfigure(GdkEventConfigure *ev);
void onConfigure(int width, int height);
void configureGlobalOffset(int width, int height);
void onOutputGeometryChanged();

Expand All @@ -120,7 +116,7 @@ class Bar {
Gtk::Box left_;
Gtk::Box center_;
Gtk::Box right_;
Gtk::Box box_;
Gtk::CenterBox box_;
std::vector<std::shared_ptr<waybar::AModule>> modules_left_;
std::vector<std::shared_ptr<waybar::AModule>> modules_center_;
std::vector<std::shared_ptr<waybar::AModule>> modules_right_;
Expand Down
7 changes: 2 additions & 5 deletions include/client.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#pragma once

#include <fmt/format.h>
#include <gdk/gdk.h>
#include <gdk/gdkwayland.h>
#include <wayland-client.h>
#include <gdk/wayland/gdkwayland.h>

#include "bar.hpp"
#include "config.hpp"
Expand Down Expand Up @@ -34,6 +31,7 @@ class Client {

private:
Client() = default;
Glib::RefPtr<Gio::ListModel> monitors_;
const std::string getStyle(const std::string &style, std::optional<Appearance> appearance);
void bindInterfaces();
void handleOutput(struct waybar_output &output);
Expand All @@ -51,7 +49,6 @@ class Client {
void handleMonitorRemoved(Glib::RefPtr<Gdk::Monitor> monitor);
void handleDeferredMonitorRemoval(Glib::RefPtr<Gdk::Monitor> monitor);

Glib::RefPtr<Gtk::StyleContext> style_context_;
Glib::RefPtr<Gtk::CssProvider> css_provider_;
std::unique_ptr<Portal> portal;
std::list<struct waybar_output> outputs_;
Expand Down
2 changes: 1 addition & 1 deletion include/group.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Group : public AModule {
virtual Gtk::Box& getBox();
void addWidget(Gtk::Widget& widget);

bool handleMouseHover(GdkEventCrossing* const& e);
// bool handleMouseHover(GdkEventCrossing* const& e);

protected:
Gtk::Box box;
Expand Down
2 changes: 1 addition & 1 deletion include/modules/cffi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ typedef struct wbcffi_module wbcffi_module;
typedef struct {
wbcffi_module* obj;
const char* waybar_version;
GtkContainer* (*get_root_widget)(wbcffi_module*);
//todo GtkContainer* (*get_root_widget)(wbcffi_module*);
void (*queue_update)(wbcffi_module*);
} wbcffi_init_info;

Expand Down
4 changes: 2 additions & 2 deletions include/modules/custom.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class Custom : public ALabel {
void parseOutputRaw();
void parseOutputJson();
void handleEvent();
bool handleScroll(GdkEventScroll* e) override;
bool handleToggle(GdkEventButton* const& e) override;
//todo bool handleScroll(GdkEventScroll* e) override;
//todo bool handleToggle(GdkEventButton* const& e) override;

const std::string name_;
const std::string output_name_;
Expand Down
2 changes: 1 addition & 1 deletion include/modules/idle_inhibitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class IdleInhibitor : public ALabel {
static bool status;

private:
bool handleToggle(GdkEventButton* const& e) override;
//todo bool handleToggle(GdkEventButton* const& e) override;
void toggleStatus();

const Bar& bar_;
Expand Down
2 changes: 1 addition & 1 deletion include/modules/user.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class User : public AIconLabel {
virtual ~User() = default;
auto update() -> void override;

bool handleToggle(GdkEventButton* const& e) override;
//todo bool handleToggle(GdkEventButton* const& e) override;

private:
util::SleeperThread thread_;
Expand Down
2 changes: 1 addition & 1 deletion include/util/SafeSignal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ struct SafeSignal : sigc::signal<void(std::decay_t<Args>...)> {
using slot_t = decltype(std::declval<signal_t>().make_slot());
using arg_tuple_t = std::tuple<std::decay_t<Args>...>;
// ensure that unwrapped methods are not accessible
using signal_t::emit_reverse;
using signal_t::emit;
using signal_t::make_slot;

void handle_event() {
Expand Down
2 changes: 1 addition & 1 deletion include/util/portal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Portal : private DBus::Proxy {
void refreshAppearance();
Appearance getAppearance();

typedef sigc::signal<void, Appearance> type_signal_appearance_changed;
typedef sigc::signal<void(Appearance)> type_signal_appearance_changed;
type_signal_appearance_changed signal_appearance_changed() { return m_signal_appearance_changed; }

private:
Expand Down
Loading

0 comments on commit d5bc2f3

Please sign in to comment.