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
3 // found in the LICENSE file.
5 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_X11_WINDOW_EVENT_FILTER_H_
6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_X11_WINDOW_EVENT_FILTER_H_
10 #include "base/compiler_specific.h"
11 #include "base/message_loop/message_loop.h"
12 #include "ui/events/event_handler.h"
13 #include "ui/gfx/x/x11_atom_cache.h"
14 #include "ui/gfx/x/x11_types.h"
15 #include "ui/views/views_export.h"
26 class DesktopWindowTreeHost;
27 class NativeWidgetAura;
29 // An EventFilter that sets properties on X11 windows.
30 class VIEWS_EXPORT X11WindowEventFilter : public ui::EventHandler {
32 explicit X11WindowEventFilter(DesktopWindowTreeHost* window_tree_host);
33 virtual ~X11WindowEventFilter();
35 // Changes whether borders are shown on this |root_window|.
36 void SetUseHostWindowBorders(bool use_os_border);
38 // Overridden from ui::EventHandler:
39 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
42 void ToggleMaximizedState();
44 // Dispatches a _NET_WM_MOVERESIZE message to the window manager to tell it
45 // to act as if a border or titlebar drag occurred.
46 bool DispatchHostWindowDragMovement(int hittest,
47 const gfx::Point& screen_location);
49 // The display and the native X window hosting the root window.
53 // The native root window.
54 ::Window x_root_window_;
56 ui::X11AtomCache atom_cache_;
58 DesktopWindowTreeHost* window_tree_host_;
60 // True if |xwindow_| is the current _NET_ACTIVE_WINDOW.
63 // The non-client component for the target of a MouseEvent. Mouse events can
64 // be destructive to the window tree, which can cause the component of a
65 // ui::EF_IS_DOUBLE_CLICK event to no longer be the same as that of the
66 // initial click. Acting on a double click should only occur for matching
70 DISALLOW_COPY_AND_ASSIGN(X11WindowEventFilter);
75 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_X11_WINDOW_EVENT_FILTER_H_