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

Side by Side 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, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/widget/desktop_aura/desktop_root_window_host_x11.h" 5 #include "ui/views/widget/desktop_aura/desktop_root_window_host_x11.h"
6 6
7 #include <X11/extensions/shape.h> 7 #include <X11/extensions/shape.h>
8 #include <X11/extensions/XInput2.h> 8 #include <X11/extensions/XInput2.h>
9 #include <X11/Xatom.h> 9 #include <X11/Xatom.h>
10 #include <X11/Xregion.h> 10 #include <X11/Xregion.h>
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 NULL; 52 NULL;
53 53
54 DEFINE_WINDOW_PROPERTY_KEY( 54 DEFINE_WINDOW_PROPERTY_KEY(
55 aura::Window*, kViewsWindowForRootWindow, NULL); 55 aura::Window*, kViewsWindowForRootWindow, NULL);
56 56
57 DEFINE_WINDOW_PROPERTY_KEY( 57 DEFINE_WINDOW_PROPERTY_KEY(
58 DesktopRootWindowHostX11*, kHostForRootWindow, NULL); 58 DesktopRootWindowHostX11*, kHostForRootWindow, NULL);
59 59
60 namespace { 60 namespace {
61 61
62 class ModifiedMouseEvent : public ui::MouseEvent {
63 public:
64 ModifiedMouseEvent(const ui::MouseEvent& event, ui::EventType type)
65 : ui::MouseEvent(event,
66 static_cast<View*>(NULL),
67 static_cast<View*>(NULL)) {
68 SetType(type);
69 }
70
71 virtual ~ModifiedMouseEvent() {}
72 };
73
62 // Standard Linux mouse buttons for going back and forward. 74 // Standard Linux mouse buttons for going back and forward.
63 const int kBackMouseButton = 8; 75 const int kBackMouseButton = 8;
64 const int kForwardMouseButton = 9; 76 const int kForwardMouseButton = 9;
65 77
66 // Constants that are part of EWMH. 78 // Constants that are part of EWMH.
67 const int k_NET_WM_STATE_ADD = 1; 79 const int k_NET_WM_STATE_ADD = 1;
68 const int k_NET_WM_STATE_REMOVE = 0; 80 const int k_NET_WM_STATE_REMOVE = 0;
69 81
70 const char* kAtomsToCache[] = { 82 const char* kAtomsToCache[] = {
71 "WM_DELETE_WINDOW", 83 "WM_DELETE_WINDOW",
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 995
984 //////////////////////////////////////////////////////////////////////////////// 996 ////////////////////////////////////////////////////////////////////////////////
985 // DesktopRootWindowHostX11, MessageLoop::Dispatcher implementation: 997 // DesktopRootWindowHostX11, MessageLoop::Dispatcher implementation:
986 998
987 bool DesktopRootWindowHostX11::Dispatch(const base::NativeEvent& event) { 999 bool DesktopRootWindowHostX11::Dispatch(const base::NativeEvent& event) {
988 XEvent* xev = event; 1000 XEvent* xev = event;
989 1001
990 // May want to factor CheckXEventForConsistency(xev); into a common location 1002 // May want to factor CheckXEventForConsistency(xev); into a common location
991 // since it is called here. 1003 // since it is called here.
992 switch (xev->type) { 1004 switch (xev->type) {
1005 case EnterNotify: {
1006 // Widget::OnMouseEvent ignores system mouse enter events since it's not
1007 // used on other platforms. We'll convert this to a mouse move event to be
1008 // consistent. Widget::OnMouseEvent will infer that this is actually a
1009 // mouse enter event and call the correct event handler.
1010 ui::MouseEvent mouse_event(xev);
1011 ModifiedMouseEvent(mouse_event, ui::ET_MOUSE_MOVED);
1012 DispatchMouseEvent(&mouse_event);
1013 break;
1014 }
1015 case LeaveNotify: {
1016 ui::MouseEvent mouse_event(xev);
1017 DispatchMouseEvent(&mouse_event);
1018 break;
1019 }
993 case Expose: { 1020 case Expose: {
994 gfx::Rect damage_rect(xev->xexpose.x, xev->xexpose.y, 1021 gfx::Rect damage_rect(xev->xexpose.x, xev->xexpose.y,
995 xev->xexpose.width, xev->xexpose.height); 1022 xev->xexpose.width, xev->xexpose.height);
996 root_window_host_delegate_->OnHostPaint(damage_rect); 1023 root_window_host_delegate_->OnHostPaint(damage_rect);
997 break; 1024 break;
998 } 1025 }
999 case KeyPress: { 1026 case KeyPress: {
1000 ui::KeyEvent keydown_event(xev, false); 1027 ui::KeyEvent keydown_event(xev, false);
1001 root_window_host_delegate_->OnHostKeyEvent(&keydown_event); 1028 root_window_host_delegate_->OnHostKeyEvent(&keydown_event);
1002 break; 1029 break;
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 DesktopRootWindowHost* DesktopRootWindowHost::Create( 1310 DesktopRootWindowHost* DesktopRootWindowHost::Create(
1284 internal::NativeWidgetDelegate* native_widget_delegate, 1311 internal::NativeWidgetDelegate* native_widget_delegate,
1285 DesktopNativeWidgetAura* desktop_native_widget_aura, 1312 DesktopNativeWidgetAura* desktop_native_widget_aura,
1286 const gfx::Rect& initial_bounds) { 1313 const gfx::Rect& initial_bounds) {
1287 return new DesktopRootWindowHostX11(native_widget_delegate, 1314 return new DesktopRootWindowHostX11(native_widget_delegate,
1288 desktop_native_widget_aura, 1315 desktop_native_widget_aura,
1289 initial_bounds); 1316 initial_bounds);
1290 } 1317 }
1291 1318
1292 } // namespace views 1319 } // namespace views
OLDNEW
« 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