summaryrefslogtreecommitdiff
path: root/panel
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2016-08-24 17:01:57 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2016-08-24 17:01:57 +0200
commitffbe8909f66822865d0106de3f28c9325b0bfe63 (patch)
tree449f2974a5d4afcb50ca89d706dd1a2d3dda7a34 /panel
parent54481061016bf4be7613730fb4cc98fbe7caa290 (diff)
PanelIndicatorEntryView: be the one who ungrabs the mouse pointer
Since it's the owner of the mouse, it's also the element that has to force-ungrab it. This allows to remove workarounds from PanelView, PanelMenuView, and LockScreenPanel (bzr r3788.9.7)
Diffstat (limited to 'panel')
-rw-r--r--panel/PanelIndicatorEntryView.cpp4
-rw-r--r--panel/PanelMenuView.cpp8
-rw-r--r--panel/PanelMenuView.h2
-rw-r--r--panel/PanelView.cpp13
-rw-r--r--panel/PanelView.h1
5 files changed, 5 insertions, 23 deletions
diff --git a/panel/PanelIndicatorEntryView.cpp b/panel/PanelIndicatorEntryView.cpp
index 67a80956b..4e094274e 100644
--- a/panel/PanelIndicatorEntryView.cpp
+++ b/panel/PanelIndicatorEntryView.cpp
@@ -140,6 +140,10 @@ void PanelIndicatorEntryView::OnMouseDown(int x, int y, long button_flags, long
wm.TerminateScale();
}
+ // This is ugly... But Nux fault!
+ guint64 timestamp = nux::GetGraphicsDisplay()->GetCurrentEvent().x11_timestamp;
+ WindowManager::Default().UnGrabMousePointer(timestamp, button, x, y);
+
Activate(button);
}
}
diff --git a/panel/PanelMenuView.cpp b/panel/PanelMenuView.cpp
index f2aa86053..8860a085e 100644
--- a/panel/PanelMenuView.cpp
+++ b/panel/PanelMenuView.cpp
@@ -102,7 +102,6 @@ PanelMenuView::PanelMenuView(menu::Manager::Ptr const& menus)
, ignore_menu_visibility_(false)
, integrated_menus_(menu_manager_->integrated_menus())
, always_show_menus_(menu_manager_->always_show_menus())
- , ignore_leave_events_(false)
, desktop_name_(get_current_desktop())
{
if (ApplicationWindowPtr const& win = ApplicationManager::Default().GetActiveWindow())
@@ -1814,14 +1813,9 @@ void PanelMenuView::OnPanelViewMouseEnter(int x, int y, unsigned long mouse_butt
}
}
-void PanelMenuView::IgnoreLeaveEvents(bool ignore)
-{
- ignore_leave_events_ = ignore;
-}
-
void PanelMenuView::OnPanelViewMouseLeave(int x, int y, unsigned long mouse_button_state, unsigned long special_keys_state)
{
- if (always_show_menus_ || ignore_leave_events_)
+ if (always_show_menus_)
return;
if (is_inside_)
diff --git a/panel/PanelMenuView.h b/panel/PanelMenuView.h
index 93310d10a..7d3effb84 100644
--- a/panel/PanelMenuView.h
+++ b/panel/PanelMenuView.h
@@ -56,7 +56,6 @@ public:
bool HasKeyActivableMenus() const;
void NotifyAllMenusClosed();
- void IgnoreLeaveEvents(bool);
virtual void AddIndicator(indicator::Indicator::Ptr const& indicator);
@@ -192,7 +191,6 @@ private:
bool ignore_menu_visibility_;
bool integrated_menus_;
bool always_show_menus_;
- bool ignore_leave_events_;
nux::Geometry monitor_geo_;
const std::string desktop_name_;
diff --git a/panel/PanelView.cpp b/panel/PanelView.cpp
index bff86e856..e834437e3 100644
--- a/panel/PanelView.cpp
+++ b/panel/PanelView.cpp
@@ -117,7 +117,6 @@ PanelView::PanelView(MockableBaseWindow* parent, menu::Manager::Ptr const& menus
remote_->on_object_added.connect(sigc::mem_fun(this, &PanelView::OnObjectAdded));
remote_->on_object_removed.connect(sigc::mem_fun(this, &PanelView::OnObjectRemoved));
remote_->on_entry_activated.connect(sigc::mem_fun(this, &PanelView::OnEntryActivated));
- remote_->on_entry_show_menu.connect(sigc::mem_fun(this, &PanelView::OnEntryShowMenu));
menus->key_activate_entry.connect(sigc::mem_fun(this, &PanelView::ActivateEntry));
menus->open_first.connect(sigc::mem_fun(this, &PanelView::ActivateFirstSensitive));
@@ -739,18 +738,6 @@ void PanelView::OnEntryActivated(std::string const& panel, std::string const& en
}
}
-void PanelView::OnEntryShowMenu(std::string const& entry_id, unsigned xid,
- int x, int y, unsigned button)
-{
- if (menu_geo_.IsNull())
- {
- // This is ugly... But Nux fault!
- menu_view_->IgnoreLeaveEvents(true);
- WindowManager::Default().UnGrabMousePointer(CurrentTime, button, x, y);
- menu_view_->IgnoreLeaveEvents(false);
- }
-}
-
bool PanelView::ActivateFirstSensitive()
{
if (!IsActive())
diff --git a/panel/PanelView.h b/panel/PanelView.h
index 5532e0faa..7b7b0bc4d 100644
--- a/panel/PanelView.h
+++ b/panel/PanelView.h
@@ -88,7 +88,6 @@ protected:
void OnObjectRemoved(indicator::Indicator::Ptr const& proxy);
void OnIndicatorViewUpdated();
void OnEntryActivated(std::string const& panel, std::string const& entry_id, nux::Rect const& geo);
- void OnEntryShowMenu(std::string const& entry_id, unsigned xid, int x, int y, unsigned button);
private:
std::string GetPanelName() const;