- add sources.
[platform/framework/web/crosswalk.git] / src / ui / views / widget / desktop_aura / x11_window_event_filter.h
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.
4
5 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_X11_WINDOW_EVENT_FILTER_H_
6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_X11_WINDOW_EVENT_FILTER_H_
7
8 #include <X11/Xlib.h>
9 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class.
10 #undef RootWindow
11
12 #include "base/compiler_specific.h"
13 #include "base/message_loop/message_loop.h"
14 #include "ui/events/event_handler.h"
15 #include "ui/gfx/x/x11_atom_cache.h"
16 #include "ui/gfx/x/x11_types.h"
17 #include "ui/views/views_export.h"
18
19 namespace aura {
20 class RootWindow;
21 class Window;
22 }
23
24 namespace gfx {
25 class Point;
26 }
27
28 namespace views {
29 class NativeWidgetAura;
30
31 // An EventFilter that sets properties on X11 windows.
32 class VIEWS_EXPORT X11WindowEventFilter : public ui::EventHandler {
33  public:
34   explicit X11WindowEventFilter(aura::RootWindow* root_window);
35   virtual ~X11WindowEventFilter();
36
37   // Changes whether borders are shown on this |root_window|.
38   void SetUseHostWindowBorders(bool use_os_border);
39
40   // Overridden from ui::EventHandler:
41   virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
42
43  private:
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);
48
49   // The display and the native X window hosting the root window.
50   XDisplay* xdisplay_;
51   ::Window xwindow_;
52
53   // The native root window.
54   ::Window x_root_window_;
55
56   ui::X11AtomCache atom_cache_;
57
58   // True if |xwindow_| is the current _NET_ACTIVE_WINDOW.
59   bool is_active_;
60
61   DISALLOW_COPY_AND_ASSIGN(X11WindowEventFilter);
62 };
63
64 }  // namespace views
65
66 #endif  // UI_VIEWS_WIDGET_DESKTOP_AURA_X11_WINDOW_EVENT_FILTER_H_