Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(636)

Unified Diff: ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc

Issue 19664007: Dispatch Mouse enter/exit window events (Linux Aura) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: workaround for Widget ignoring mouse_enter events implmented Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc
diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc b/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc
index ca4fb27ae663333ef2d86ffa97a986a36d55a90c..6082c315678f2119bcb4dd29e85152cef8f97e9b 100644
--- a/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc
+++ b/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc
@@ -59,6 +59,18 @@ DEFINE_WINDOW_PROPERTY_KEY(
namespace {
+class ModifiedMouseEvent : public ui::MouseEvent {
+ public:
+ ModifiedMouseEvent(const ui::MouseEvent& event, ui::EventType type)
+ : ui::MouseEvent(event,
+ static_cast<View*>(NULL),
+ static_cast<View*>(NULL)) {
+ SetType(type);
+ }
+
+ virtual ~ModifiedMouseEvent() {}
+};
+
// Standard Linux mouse buttons for going back and forward.
const int kBackMouseButton = 8;
const int kForwardMouseButton = 9;
@@ -990,6 +1002,21 @@ bool DesktopRootWindowHostX11::Dispatch(const base::NativeEvent& event) {
// May want to factor CheckXEventForConsistency(xev); into a common location
// since it is called here.
switch (xev->type) {
+ case EnterNotify: {
+ // Widget::OnMouseEvent ignores system mouse enter events since it's not
+ // used on other platforms. We'll convert this to a mouse move event to be
+ // consistent. Widget::OnMouseEvent will infer that this is actually a
+ // mouse enter event and call the correct event handler.
+ ui::MouseEvent mouse_event(xev);
+ ModifiedMouseEvent(mouse_event, ui::ET_MOUSE_MOVED);
+ DispatchMouseEvent(&mouse_event);
+ break;
+ }
+ case LeaveNotify: {
+ ui::MouseEvent mouse_event(xev);
+ DispatchMouseEvent(&mouse_event);
+ break;
+ }
case Expose: {
gfx::Rect damage_rect(xev->xexpose.x, xev->xexpose.y,
xev->xexpose.width, xev->xexpose.height);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698