OLD | NEW |
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 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_X11_WINDOW_EVENT_FILTER_H_ | 5 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_X11_WINDOW_EVENT_FILTER_H_ |
6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_X11_WINDOW_EVENT_FILTER_H_ | 6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_X11_WINDOW_EVENT_FILTER_H_ |
7 | 7 |
8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "ui/events/event_handler.h" | 13 #include "ui/events/event_handler.h" |
14 #include "ui/gfx/x/x11_types.h" | 14 #include "ui/gfx/x/x11_types.h" |
15 #include "ui/views/views_export.h" | 15 #include "ui/views/views_export.h" |
16 | 16 #include "ui/views/widget/desktop_aura/window_event_filter.h" |
17 namespace aura { | |
18 class Window; | |
19 } | |
20 | 17 |
21 namespace gfx { | 18 namespace gfx { |
22 class Point; | 19 class Point; |
23 } | 20 } |
24 | 21 |
25 namespace views { | 22 namespace views { |
26 class DesktopWindowTreeHost; | 23 class DesktopWindowTreeHost; |
27 | 24 |
28 // An EventFilter that sets properties on X11 windows. | 25 // An EventFilter that sets properties on X11 windows. |
29 class VIEWS_EXPORT X11WindowEventFilter : public ui::EventHandler { | 26 class VIEWS_EXPORT X11WindowEventFilter : public WindowEventFilter { |
30 public: | 27 public: |
31 explicit X11WindowEventFilter(DesktopWindowTreeHost* window_tree_host); | 28 explicit X11WindowEventFilter(DesktopWindowTreeHost* window_tree_host); |
32 ~X11WindowEventFilter() override; | 29 ~X11WindowEventFilter() override; |
33 | 30 |
34 // Overridden from ui::EventHandler: | 31 private: |
35 void OnMouseEvent(ui::MouseEvent* event) override; | 32 // WindowEventFilter override: |
| 33 void MaybeDispatchHostWindowDragMovement(int hittest, |
| 34 ui::MouseEvent* event) override; |
| 35 void LowerWindow() override; |
36 | 36 |
37 private: | |
38 // Called when the user clicked the caption area. | |
39 void OnClickedCaption(ui::MouseEvent* event, | |
40 int previous_click_component); | |
41 | |
42 // Called when the user clicked the maximize button. | |
43 void OnClickedMaximizeButton(ui::MouseEvent* event); | |
44 | |
45 void ToggleMaximizedState(); | |
46 | |
47 // Dispatches a _NET_WM_MOVERESIZE message to the window manager to tell it | |
48 // to act as if a border or titlebar drag occurred. | |
49 bool DispatchHostWindowDragMovement(int hittest, | 37 bool DispatchHostWindowDragMovement(int hittest, |
50 const gfx::Point& screen_location); | 38 const gfx::Point& screen_location); |
51 | 39 |
52 // The display and the native X window hosting the root window. | 40 // The display and the native X window hosting the root window. |
53 XDisplay* xdisplay_; | 41 XDisplay* xdisplay_; |
54 ::Window xwindow_; | 42 ::Window xwindow_; |
55 | 43 |
56 // The native root window. | 44 // The native root window. |
57 ::Window x_root_window_; | 45 ::Window x_root_window_; |
58 | 46 |
59 DesktopWindowTreeHost* window_tree_host_; | |
60 | |
61 // The non-client component for the target of a MouseEvent. Mouse events can | |
62 // be destructive to the window tree, which can cause the component of a | |
63 // ui::EF_IS_DOUBLE_CLICK event to no longer be the same as that of the | |
64 // initial click. Acting on a double click should only occur for matching | |
65 // components. | |
66 int click_component_; | |
67 | |
68 DISALLOW_COPY_AND_ASSIGN(X11WindowEventFilter); | 47 DISALLOW_COPY_AND_ASSIGN(X11WindowEventFilter); |
69 }; | 48 }; |
70 | 49 |
71 } // namespace views | 50 } // namespace views |
72 | 51 |
73 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_X11_WINDOW_EVENT_FILTER_H_ | 52 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_X11_WINDOW_EVENT_FILTER_H_ |
OLD | NEW |