sni: fix passing relative coordinates to dbus methods

Doesn't correctly handle the case with both margin and width/height being set at the same time.
pull/2417/head
Cherser-s 2023-08-21 22:03:43 +03:00
parent 936937ec78
commit 65dfabc430
2 changed files with 6 additions and 2 deletions

View File

@ -84,6 +84,8 @@ class Item : public sigc::trackable {
// visibility of items with Status == Passive // visibility of items with Status == Passive
bool show_passive_ = false; bool show_passive_ = false;
const Bar& bar_;
Glib::RefPtr<Gio::DBus::Proxy> proxy_; Glib::RefPtr<Gio::DBus::Proxy> proxy_;
Glib::RefPtr<Gio::Cancellable> cancellable_; Glib::RefPtr<Gio::Cancellable> cancellable_;
std::set<std::string_view> update_pending_; std::set<std::string_view> update_pending_;

View File

@ -39,7 +39,8 @@ Item::Item(const std::string& bn, const std::string& op, const Json::Value& conf
object_path(op), object_path(op),
icon_size(16), icon_size(16),
effective_icon_size(0), effective_icon_size(0),
icon_theme(Gtk::IconTheme::create()) { icon_theme(Gtk::IconTheme::create()),
bar_(bar) {
if (config["icon-size"].isUInt()) { if (config["icon-size"].isUInt()) {
icon_size = config["icon-size"].asUInt(); icon_size = config["icon-size"].asUInt();
} }
@ -410,7 +411,8 @@ void Item::makeMenu() {
bool Item::handleClick(GdkEventButton* const& ev) { bool Item::handleClick(GdkEventButton* const& ev) {
auto parameters = Glib::VariantContainerBase::create_tuple( auto parameters = Glib::VariantContainerBase::create_tuple(
{Glib::Variant<int>::create(ev->x), Glib::Variant<int>::create(ev->y)}); {Glib::Variant<int>::create(ev->x_root + bar_.x_global),
Glib::Variant<int>::create(ev->y_root + bar_.y_global)});
if ((ev->button == 1 && item_is_menu) || ev->button == 3) { if ((ev->button == 1 && item_is_menu) || ev->button == 3) {
makeMenu(); makeMenu();
if (gtk_menu != nullptr) { if (gtk_menu != nullptr) {