OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_WINDOW_EVENT_FILTER_H_ |
| 6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_WINDOW_EVENT_FILTER_H_ |
| 7 |
| 8 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" |
| 10 #include "base/message_loop/message_loop.h" |
| 11 #include "ui/events/event_handler.h" |
| 12 #include "ui/views/views_export.h" |
| 13 |
| 14 namespace views { |
| 15 class DesktopWindowTreeHost; |
| 16 |
| 17 // An EventFilter that sets properties on native windows. |
| 18 // The downstream effort to add wayland and x11 support with ozone |
| 19 // are using this class (to be upstreamed later). |
| 20 class VIEWS_EXPORT WindowEventFilter : public ui::EventHandler { |
| 21 public: |
| 22 explicit WindowEventFilter(DesktopWindowTreeHost* window_tree_host); |
| 23 ~WindowEventFilter() override; |
| 24 |
| 25 // Overridden from ui::EventHandler: |
| 26 void OnMouseEvent(ui::MouseEvent* event) override; |
| 27 |
| 28 private: |
| 29 // Called when the user clicked the caption area. |
| 30 void OnClickedCaption(ui::MouseEvent* event, int previous_click_component); |
| 31 |
| 32 // Called when the user clicked the maximize button. |
| 33 void OnClickedMaximizeButton(ui::MouseEvent* event); |
| 34 |
| 35 void ToggleMaximizedState(); |
| 36 |
| 37 // Dispatches a message to the window manager to tell it to act as if a border |
| 38 // or titlebar drag occurred with left mouse click. In case of X11, a |
| 39 // _NET_WM_MOVERESIZE message is sent. |
| 40 virtual void MaybeDispatchHostWindowDragMovement(int hittest, |
| 41 ui::MouseEvent* event); |
| 42 |
| 43 // A signal to lower an attached to this filter window to the bottom of the |
| 44 // stack. |
| 45 virtual void LowerWindow(); |
| 46 |
| 47 DesktopWindowTreeHost* window_tree_host_; |
| 48 |
| 49 // The non-client component for the target of a MouseEvent. Mouse events can |
| 50 // be destructive to the window tree, which can cause the component of a |
| 51 // ui::EF_IS_DOUBLE_CLICK event to no longer be the same as that of the |
| 52 // initial click. Acting on a double click should only occur for matching |
| 53 // components. |
| 54 int click_component_; |
| 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(WindowEventFilter); |
| 57 }; |
| 58 |
| 59 } // namespace views |
| 60 |
| 61 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_WINDOW_EVENT_FILTER_H_ |
OLD | NEW |