Skip to content

Commit

Permalink
sni: fix passing relative coordinates to dbus methods
Browse files Browse the repository at this point in the history
Doesn't correctly handle the case with both margin and width/height being set at the same time.
  • Loading branch information
Cherser-s committed Aug 22, 2023
1 parent e9cc72c commit 834fd04
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions include/modules/sni/item.hpp
Expand Up @@ -84,6 +84,8 @@ class Item : public sigc::trackable {
// visibility of items with Status == Passive
bool show_passive_ = false;

const Bar& bar_;

Glib::RefPtr<Gio::DBus::Proxy> proxy_;
Glib::RefPtr<Gio::Cancellable> cancellable_;
std::set<std::string_view> update_pending_;
Expand Down
6 changes: 4 additions & 2 deletions src/modules/sni/item.cpp
Expand Up @@ -39,7 +39,8 @@ Item::Item(const std::string& bn, const std::string& op, const Json::Value& conf
object_path(op),
icon_size(16),
effective_icon_size(0),
icon_theme(Gtk::IconTheme::create()) {
icon_theme(Gtk::IconTheme::create()),
bar_(bar) {
if (config["icon-size"].isUInt()) {
icon_size = config["icon-size"].asUInt();
}
Expand Down Expand Up @@ -410,7 +411,8 @@ void Item::makeMenu() {

bool Item::handleClick(GdkEventButton* const& ev) {
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) {
makeMenu();
if (gtk_menu != nullptr) {
Expand Down

0 comments on commit 834fd04

Please sign in to comment.