1
1
#pragma once
2
2
3
- #include < gdk/gdk.h>
4
- #include < glibmm/refptr.h>
5
- #include < gtkmm/box.h>
3
+ #include < giomm/desktopappinfo.h>
6
4
#include < gtkmm/button.h>
7
5
#include < gtkmm/icontheme.h>
8
6
#include < gtkmm/image.h>
9
7
#include < gtkmm/label.h>
10
- #include < wayland-client.h>
11
8
12
- #include < map>
13
- #include < memory>
14
- #include < string>
15
9
#include < unordered_set>
16
- #include < vector>
17
10
18
11
#include " AModule.hpp"
19
12
#include " bar.hpp"
20
- #include " client.hpp"
21
- #include " giomm/desktopappinfo.h"
22
- #include " util/json.hpp"
23
13
#include " wlr-foreign-toplevel-management-unstable-v1-client-protocol.h"
24
14
25
15
namespace waybar ::modules::wlr {
26
16
27
17
struct widget_geometry {
28
- int x, y, w, h;
18
+ double x, y;
19
+ int w, h;
29
20
};
30
21
31
22
class Taskbar ;
@@ -45,13 +36,13 @@ class Task {
45
36
INVALID = (1 << 4 )
46
37
};
47
38
// made public so TaskBar can reorder based on configuration.
48
- Gtk::Button button;
39
+ Glib::RefPtr< Gtk::Button> const button;
49
40
struct widget_geometry minimize_hint;
50
41
51
42
private:
52
43
static uint32_t global_id;
44
+ Glib::RefPtr<Gtk::GestureClick> const controllClick_;
53
45
54
- private:
55
46
const waybar::Bar &bar_;
56
47
const Json::Value &config_;
57
48
Taskbar *tbar_;
@@ -80,15 +71,9 @@ class Task {
80
71
std::string app_id_;
81
72
uint32_t state_ = 0 ;
82
73
83
- int32_t drag_start_x;
84
- int32_t drag_start_y;
85
- int32_t drag_start_button = -1 ;
86
-
87
- private:
88
74
std::string repr () const ;
89
75
std::string state_string (bool = false ) const ;
90
76
void set_minimize_hint ();
91
- void on_button_size_allocated (Gtk::Allocation &alloc);
92
77
void set_app_info_from_app_id_list (const std::string &app_id_list);
93
78
bool image_load_icon (Gtk::Image &image, const Glib::RefPtr<Gtk::IconTheme> &icon_theme,
94
79
Glib::RefPtr<Gio::DesktopAppInfo> app_info, int size);
@@ -105,7 +90,6 @@ class Task {
105
90
bool active () const { return state_ & ACTIVE; }
106
91
bool fullscreen () const { return state_ & FULLSCREEN; }
107
92
108
- public:
109
93
/* Callbacks for the wlr protocol */
110
94
void handle_title (const char *);
111
95
void handle_app_id (const char *);
@@ -116,22 +100,14 @@ class Task {
116
100
void handle_closed ();
117
101
118
102
/* Callbacks for Gtk events */
119
- bool handle_clicked (GdkEventButton *);
120
- bool handle_button_release (GdkEventButton *);
121
- bool handle_motion_notify (GdkEventMotion *);
122
- void handle_drag_data_get (const Glib::RefPtr<Gdk::DragContext> &context,
123
- Gtk::SelectionData &selection_data, guint info, guint time);
124
- void handle_drag_data_received (const Glib::RefPtr<Gdk::DragContext> &context, int x, int y,
125
- Gtk::SelectionData selection_data, guint info, guint time);
103
+ void handleClick (int n_press, double dx, double dy);
104
+ bool handleDropData (const Glib::ValueBase &, double , double );
126
105
127
- public:
128
106
bool operator ==(const Task &) const ;
129
107
bool operator !=(const Task &) const ;
130
108
131
- public:
132
109
void update ();
133
110
134
- public:
135
111
/* Interaction with the tasks */
136
112
void maximize (bool );
137
113
void minimize (bool );
@@ -169,10 +145,9 @@ class Taskbar : public waybar::AModule {
169
145
void handle_toplevel_create (struct zwlr_foreign_toplevel_handle_v1 *);
170
146
void handle_finished ();
171
147
172
- public:
173
- void add_button (Gtk::Button &);
174
- void move_button (Gtk::Button &, int );
175
- void remove_button (Gtk::Button &);
148
+ void add_button (Glib::RefPtr<Gtk::Button>);
149
+ void move_button (Glib::RefPtr<Gtk::Button>, int );
150
+ void remove_button (Glib::RefPtr<Gtk::Button>);
176
151
void remove_task (uint32_t );
177
152
178
153
bool show_output (struct wl_output *) const ;
0 commit comments