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.pull/438/head
parent
9d0842db48
commit
642fd48af1
|
@ -46,7 +46,12 @@ class Item : public sigc::trackable {
|
||||||
std::string menu;
|
std::string menu;
|
||||||
DbusmenuGtkMenu* dbus_menu = nullptr;
|
DbusmenuGtkMenu* dbus_menu = nullptr;
|
||||||
Gtk::Menu* gtk_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:
|
private:
|
||||||
void proxyReady(Glib::RefPtr<Gio::AsyncResult>& result);
|
void proxyReady(Glib::RefPtr<Gio::AsyncResult>& result);
|
||||||
|
|
|
@ -334,7 +334,7 @@ void Item::makeMenu(GdkEventButton* const& ev) {
|
||||||
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), 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);
|
makeMenu(ev);
|
||||||
if (gtk_menu != nullptr) {
|
if (gtk_menu != nullptr) {
|
||||||
#if GTK_CHECK_VERSION(3, 22, 0)
|
#if GTK_CHECK_VERSION(3, 22, 0)
|
||||||
|
|
Loading…
Reference in New Issue