fix(tray): restore Activate support for compliant SNI implementation

Set ItemIsMenu to true by default because libappindicator supports
neither ItemIsMenu nor Activate method and compiant SNI implementations
are expected to reset the flag during initial property fetch.
To be revisited if anyone finds the implementation that has Activate
but does not set ItemIsMenu.
This commit is contained in:
Aleksei Bavshin 2019-06-14 06:44:11 -07:00
parent 9d0842db48
commit 642fd48af1
No known key found for this signature in database
GPG Key ID: 4F071603387A382A
2 changed files with 7 additions and 2 deletions

View File

@ -46,7 +46,12 @@ class Item : public sigc::trackable {
std::string menu;
DbusmenuGtkMenu* dbus_menu = nullptr;
Gtk::Menu* gtk_menu = nullptr;
bool item_is_menu = false;
/**
* ItemIsMenu flag means that the item only supports the context menu.
* Default value is true because libappindicator supports neither ItemIsMenu nor Activate method
* while compliant SNI implementation would always reset the flag to desired value.
*/
bool item_is_menu = true;
private:
void proxyReady(Glib::RefPtr<Gio::AsyncResult>& result);

View File

@ -334,7 +334,7 @@ void Item::makeMenu(GdkEventButton* const& ev) {
bool Item::handleClick(GdkEventButton* const& ev) {
auto parameters = Glib::VariantContainerBase::create_tuple(
{Glib::Variant<int>::create(ev->x), Glib::Variant<int>::create(ev->y)});
if ((ev->button == 1 && (item_is_menu || !menu.empty())) || ev->button == 3) {
if ((ev->button == 1 && item_is_menu) || ev->button == 3) {
makeMenu(ev);
if (gtk_menu != nullptr) {
#if GTK_CHECK_VERSION(3, 22, 0)