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_X11_WINDOW_EVENT_FILTER_H_ | 5 #ifndef UI_VIEWS_WIDGET_X11_WINDOW_EVENT_FILTER_H_ |
6 #define UI_VIEWS_WIDGET_X11_WINDOW_EVENT_FILTER_H_ | 6 #define UI_VIEWS_WIDGET_X11_WINDOW_EVENT_FILTER_H_ |
7 | 7 |
8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
9 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class. | 9 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class. |
10 #undef RootWindow | 10 #undef RootWindow |
(...skipping 11 matching lines...) Expand all Loading... |
22 } | 22 } |
23 | 23 |
24 namespace views { | 24 namespace views { |
25 class NativeWidgetAura; | 25 class NativeWidgetAura; |
26 | 26 |
27 // An EventFilter that sets properties on X11 windows. | 27 // An EventFilter that sets properties on X11 windows. |
28 class VIEWS_EXPORT X11WindowEventFilter : public aura::EventFilter { | 28 class VIEWS_EXPORT X11WindowEventFilter : public aura::EventFilter { |
29 public: | 29 public: |
30 explicit X11WindowEventFilter( | 30 explicit X11WindowEventFilter( |
31 aura::RootWindow* root_window, | 31 aura::RootWindow* root_window, |
32 aura::DesktopActivationClient* activation_client, | 32 aura::DesktopActivationClient* activation_client); |
33 NativeWidgetAura* widget); | |
34 virtual ~X11WindowEventFilter(); | 33 virtual ~X11WindowEventFilter(); |
35 | 34 |
36 // Changes whether borders are shown on this |root_window|. | 35 // Changes whether borders are shown on this |root_window|. |
37 void SetUseHostWindowBorders(bool use_os_border); | 36 void SetUseHostWindowBorders(bool use_os_border); |
38 | 37 |
39 // Overridden from EventFilter: | 38 // Overridden from EventFilter: |
40 virtual bool PreHandleKeyEvent(aura::Window* target, | 39 virtual bool PreHandleKeyEvent(aura::Window* target, |
41 ui::KeyEvent* event) OVERRIDE; | 40 ui::KeyEvent* event) OVERRIDE; |
42 virtual bool PreHandleMouseEvent(aura::Window* target, | 41 virtual bool PreHandleMouseEvent(aura::Window* target, |
43 ui::MouseEvent* event) OVERRIDE; | 42 ui::MouseEvent* event) OVERRIDE; |
44 virtual ui::TouchStatus PreHandleTouchEvent( | 43 virtual ui::TouchStatus PreHandleTouchEvent( |
45 aura::Window* target, | 44 aura::Window* target, |
46 ui::TouchEvent* event) OVERRIDE; | 45 ui::TouchEvent* event) OVERRIDE; |
47 virtual ui::EventResult PreHandleGestureEvent( | 46 virtual ui::EventResult PreHandleGestureEvent( |
48 aura::Window* target, | 47 aura::Window* target, |
49 ui::GestureEvent* event) OVERRIDE; | 48 ui::GestureEvent* event) OVERRIDE; |
50 | 49 |
51 private: | 50 private: |
52 // Dispatches a _NET_WM_MOVERESIZE message to the window manager to tell it | 51 // Dispatches a _NET_WM_MOVERESIZE message to the window manager to tell it |
53 // to act as if a border or titlebar drag occurred. | 52 // to act as if a border or titlebar drag occurred. |
54 bool DispatchHostWindowDragMovement(int hittest, | 53 bool DispatchHostWindowDragMovement(int hittest, |
55 const gfx::Point& screen_location); | 54 const gfx::Point& screen_location); |
56 | 55 |
57 NativeWidgetAura* widget_; | |
58 aura::DesktopActivationClient* activation_client_; | 56 aura::DesktopActivationClient* activation_client_; |
59 | 57 |
60 // The display and the native X window hosting the root window. | 58 // The display and the native X window hosting the root window. |
61 Display* xdisplay_; | 59 Display* xdisplay_; |
62 ::Window xwindow_; | 60 ::Window xwindow_; |
63 | 61 |
64 // The native root window. | 62 // The native root window. |
65 ::Window x_root_window_; | 63 ::Window x_root_window_; |
66 | 64 |
67 ui::X11AtomCache atom_cache_; | 65 ui::X11AtomCache atom_cache_; |
68 | 66 |
69 // True if |xwindow_| is the current _NET_ACTIVE_WINDOW. | 67 // True if |xwindow_| is the current _NET_ACTIVE_WINDOW. |
70 bool is_active_; | 68 bool is_active_; |
71 | 69 |
72 DISALLOW_COPY_AND_ASSIGN(X11WindowEventFilter); | 70 DISALLOW_COPY_AND_ASSIGN(X11WindowEventFilter); |
73 }; | 71 }; |
74 | 72 |
75 } // namespace views | 73 } // namespace views |
76 | 74 |
77 #endif // UI_VIEWS_WIDGET_X11_WINDOW_EVENT_FILTER_H_ | 75 #endif // UI_VIEWS_WIDGET_X11_WINDOW_EVENT_FILTER_H_ |
OLD | NEW |