OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_PLATFORM_WINDOW_X11_X11_WINDOW_H_ | 5 #ifndef UI_PLATFORM_WINDOW_X11_X11_WINDOW_H_ |
6 #define UI_PLATFORM_WINDOW_X11_X11_WINDOW_H_ | 6 #define UI_PLATFORM_WINDOW_X11_X11_WINDOW_H_ |
7 | 7 |
8 #include "ui/events/platform/platform_event_dispatcher.h" | 8 #include "ui/events/platform/platform_event_dispatcher.h" |
9 #include "ui/gfx/geometry/rect.h" | 9 #include "ui/gfx/geometry/rect.h" |
10 #include "ui/gfx/x/x11_atom_cache.h" | 10 #include "ui/gfx/x/x11_atom_cache.h" |
11 #include "ui/platform_window/platform_window.h" | 11 #include "ui/platform_window/platform_window.h" |
12 #include "ui/platform_window/platform_window_delegate.h" | 12 #include "ui/platform_window/platform_window_delegate.h" |
13 #include "ui/platform_window/x11/x11_window_export.h" | 13 #include "ui/platform_window/x11/x11_window_export.h" |
14 | 14 |
15 typedef struct _XDisplay XDisplay; | 15 typedef struct _XDisplay XDisplay; |
16 typedef unsigned long XID; | 16 typedef unsigned long XID; |
17 | 17 |
18 namespace ui { | 18 namespace ui { |
19 | 19 |
20 class X11_WINDOW_EXPORT X11Window : public PlatformWindow, | 20 class X11_WINDOW_EXPORT X11Window : public PlatformWindow, |
21 public PlatformEventDispatcher { | 21 public PlatformEventDispatcher { |
22 public: | 22 public: |
23 explicit X11Window(PlatformWindowDelegate* delegate); | 23 explicit X11Window(PlatformWindowDelegate* delegate); |
24 virtual ~X11Window(); | 24 ~X11Window() override; |
25 | 25 |
26 private: | 26 private: |
27 void Destroy(); | 27 void Destroy(); |
28 | 28 |
29 void ProcessXInput2Event(XEvent* xevent); | 29 void ProcessXInput2Event(XEvent* xevent); |
30 | 30 |
31 // PlatformWindow: | 31 // PlatformWindow: |
32 virtual void Show() override; | 32 void Show() override; |
33 virtual void Hide() override; | 33 void Hide() override; |
34 virtual void Close() override; | 34 void Close() override; |
35 virtual void SetBounds(const gfx::Rect& bounds) override; | 35 void SetBounds(const gfx::Rect& bounds) override; |
36 virtual gfx::Rect GetBounds() override; | 36 gfx::Rect GetBounds() override; |
37 virtual void SetCapture() override; | 37 void SetCapture() override; |
38 virtual void ReleaseCapture() override; | 38 void ReleaseCapture() override; |
39 virtual void ToggleFullscreen() override; | 39 void ToggleFullscreen() override; |
40 virtual void Maximize() override; | 40 void Maximize() override; |
41 virtual void Minimize() override; | 41 void Minimize() override; |
42 virtual void Restore() override; | 42 void Restore() override; |
43 virtual void SetCursor(PlatformCursor cursor) override; | 43 void SetCursor(PlatformCursor cursor) override; |
44 virtual void MoveCursorTo(const gfx::Point& location) override; | 44 void MoveCursorTo(const gfx::Point& location) override; |
45 | 45 |
46 // PlatformEventDispatcher: | 46 // PlatformEventDispatcher: |
47 virtual bool CanDispatchEvent(const PlatformEvent& event) override; | 47 bool CanDispatchEvent(const PlatformEvent& event) override; |
48 virtual uint32_t DispatchEvent(const PlatformEvent& event) override; | 48 uint32_t DispatchEvent(const PlatformEvent& event) override; |
49 | 49 |
50 PlatformWindowDelegate* delegate_; | 50 PlatformWindowDelegate* delegate_; |
51 | 51 |
52 XDisplay* xdisplay_; | 52 XDisplay* xdisplay_; |
53 XID xwindow_; | 53 XID xwindow_; |
54 XID xroot_window_; | 54 XID xroot_window_; |
55 X11AtomCache atom_cache_; | 55 X11AtomCache atom_cache_; |
56 | 56 |
57 // Setting the bounds is an asynchronous operation in X11. |requested_bounds_| | 57 // Setting the bounds is an asynchronous operation in X11. |requested_bounds_| |
58 // is the bounds requested using XConfigureWindow, and |confirmed_bounds_| is | 58 // is the bounds requested using XConfigureWindow, and |confirmed_bounds_| is |
59 // the bounds the X11 server has set on the window. | 59 // the bounds the X11 server has set on the window. |
60 gfx::Rect requested_bounds_; | 60 gfx::Rect requested_bounds_; |
61 gfx::Rect confirmed_bounds_; | 61 gfx::Rect confirmed_bounds_; |
62 | 62 |
63 bool window_mapped_; | 63 bool window_mapped_; |
64 | 64 |
65 DISALLOW_COPY_AND_ASSIGN(X11Window); | 65 DISALLOW_COPY_AND_ASSIGN(X11Window); |
66 }; | 66 }; |
67 | 67 |
68 } // namespace ui | 68 } // namespace ui |
69 | 69 |
70 #endif // UI_PLATFORM_WINDOW_X11_X11_WINDOW_H_ | 70 #endif // UI_PLATFORM_WINDOW_X11_X11_WINDOW_H_ |
OLD | NEW |